14 July 2004
1.35 Items to do:
-- Fix GROUP BYs in all SQL.
-- Add new DCR calling sequences everywhere in SD.
- This will permit simultaneous use of multiple
- devices by a single job.
-- Make btape release the drive during the "test" append.
- Do tape alerts -- see tapealert.txt
- Revisit and revise Disaster Recovery (fix SCSI and RAID
disk detection)
- Document a get out of jail procedure if everything breaks if
you lost/broke the Catalog -- do the same for "I know my
file is there how do I get it back?".
-- Make FD run on Win95 if possible:
- The error I when I installed 1.34.2 clients:
- The BACULA-FD file is
- linked to missing export KERNEL32.DLL:GetFileAttributesExA.
- Add better error codes to run_program (10000+)
- When passwords do not match, print message that points the
user to the doc.
- Look at adding Client run command that will use the
port opened by the client.
- Fix find_device in stored/dircmd.c:462
-- Make entering multiple Storage names in Dir illegal.
+- Add new DCR calling sequences everywhere in SD.
+ This will permit simultaneous use of multiple
+ devices by a single job.
Documentation to do: (any release a little bit at a time)
- Document query file format.
- Look at Win32 inc problem when new directory added files not saved???
- Require resource names to be unique.
- Make sure that all errors from libacl are printed.
+- Make FD run on Win95 if possible (not really possible).
+- Fix GROUP BYs in all SQL (done by Dan -- thanks)
+- Make entering multiple Storage names in Dir illegal.
+- Make btape release the drive during the "test" append.
+
install: all
$(INSTALL_PROGRAM) bacula-dir $(DESTDIR)$(sbindir)/bacula-dir
@srcconf=bacula-dir.conf; \
- if test -f ${DESTDIR}${sysconfdir}/$$srcconf; then \
- destconf=$$srcconf.new; \
- echo " ==> Found existing $$srcconf, installing new conf file as $$destconf"; \
- else \
- destconf=$$srcconf; \
- fi; \
- echo "${INSTALL_CONFIG} $$srcconf ${DESTDIR}${sysconfdir}/$$destconf"; \
- ${INSTALL_CONFIG} $$srcconf ${DESTDIR}${sysconfdir}/$$destconf
- if test -f ${DESTDIR}${scriptdir}/query.sql; then \
- $(MV) -f ${DESTDIR}${scriptdir}/query.sql ${DESTDIR}${scriptdir}/query.sql.save; \
+ if test -f ${DESTDIR}${sysconfdir}/$$srcconf; then \
+ destconf=$$srcconf.new; \
+ echo " ==> Found existing $$srcconf, installing new conf file as $$destconf"; \
+ else \
+ destconf=$$srcconf; \
+ fi; \
+ echo "${INSTALL_CONFIG} $$srcconf ${DESTDIR}${sysconfdir}/$$destconf"; \
+ ${INSTALL_CONFIG} $$srcconf ${DESTDIR}${sysconfdir}/$$destconf
+ @if test -f ${DESTDIR}${scriptdir}/query.sql; then \
+ echo " ==> Saving existing query.sql to query.sql.old"; \
+ $(MV) -f ${DESTDIR}${scriptdir}/query.sql ${DESTDIR}${scriptdir}/query.sql.old; \
fi
${INSTALL_DATA} query.sql ${DESTDIR}${scriptdir}/query.sql
@if test -f static-bacula-dir; then \
CLIENT *me; /* my resource */
char OK_msg[] = "2000 OK\n";
char TERM_msg[] = "2999 Terminate\n";
+bool no_signals = false;
#if defined(HAVE_CYGWIN) || defined(HAVE_WIN32)
const int win32_client = 1;
int main (int argc, char *argv[])
{
int ch;
- bool no_signals = false;
bool test_config = false;
DIRRES *director;
char *uid = NULL;
* Version $Id$
*/
/*
- Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker
+ Copyright (C) 2000-2004 Kern Sibbald and John Walker
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
extern "C" void *sd_heartbeat_thread(void *arg);
extern "C" void *dir_heartbeat_thread(void *arg);
-
+extern bool no_signals;
/*
* Listen on the SD socket for heartbeat signals.
/* Startup the heartbeat thread -- see above */
void start_heartbeat_monitor(JCR *jcr)
{
- jcr->hb_bsock = NULL;
- pthread_create(&jcr->heartbeat_id, NULL, sd_heartbeat_thread, (void *)jcr);
+ /*
+ * If no signals are set, do not start the heartbeat because
+ * it gives a constant stream of TIMEOUT_SIGNAL signals that
+ * make debugging impossible.
+ */
+ if (!no_signals) {
+ jcr->hb_bsock = NULL;
+ pthread_create(&jcr->heartbeat_id, NULL, sd_heartbeat_thread, (void *)jcr);
+ }
}
/* Terminate the heartbeat thread. Used for both SD and DIR */
void stop_heartbeat_monitor(JCR *jcr)
{
int cnt = 0;
+ if (no_signals) {
+ return;
+ }
/* Wait max 10 secs for heartbeat thread to start */
while (jcr->hb_bsock == NULL && cnt++ < 200) {
bmicrosleep(0, 50); /* avoid race */
/* Try to connect for 1 hour at 10 second intervals */
sd = bnet_connect(jcr, 10, (int)me->SDConnectTimeout, _("Storage daemon"),
jcr->stored_addr, NULL, stored_port, 1);
- Dmsg0(110, "Connection OK to SD.\n");
if (sd == NULL) {
Jmsg(jcr, M_FATAL, 0, _("Failed to connect to Storage daemon: %s:%d\n"),
jcr->stored_addr, stored_port);
jcr->stored_addr, stored_port);
return 0;
}
+ Dmsg0(110, "Connection OK to SD.\n");
jcr->store_bsock = sd;
#if defined(HAVE_CYGWIN) || defined(HAVE_WIN32)
/* Forward referenced subroutines */
-static int set_win32_attributes(JCR *jcr, ATTR *attr, BFILE *ofd);
+static bool set_win32_attributes(JCR *jcr, ATTR *attr, BFILE *ofd);
void unix_name_to_win32(POOLMEM **win32_name, char *name);
void win_error(JCR *jcr, char *prefix, POOLMEM *ofile);
HANDLE bget_handle(BFILE *bfd);
* fname is the original filename
* ofile is the output filename (may be in a different directory)
*
- * Returns: 1 on success
- * 0 on failure
+ * Returns: true on success
+ * false on failure
*/
-int set_attributes(JCR *jcr, ATTR *attr, BFILE *ofd)
+bool set_attributes(JCR *jcr, ATTR *attr, BFILE *ofd)
{
struct utimbuf ut;
mode_t old_mask;
- int stat = 1;
+ bool ok = true;
#if defined(HAVE_CYGWIN) || defined(HAVE_WIN32)
if (attr->stream == STREAM_UNIX_ATTRIBUTES_EX &&
bclose(ofd);
}
pm_strcpy(&attr->ofname, "*none*");
- return 1;
+ return true;
}
if (attr->data_stream == STREAM_WIN32_DATA ||
attr->data_stream == STREAM_WIN32_GZIP_DATA) {
bclose(ofd);
}
pm_strcpy(&attr->ofname, "*none*");
- return 1;
+ return true;
}
if (lchown(attr->ofname, attr->statp.st_uid, attr->statp.st_gid) < 0) {
Jmsg2(jcr, M_ERROR, 0, _("Unable to set file owner %s: ERR=%s\n"),
attr->ofname, strerror(errno));
- stat = 0;
+ ok = false;
}
} else {
if (chown(attr->ofname, attr->statp.st_uid, attr->statp.st_gid) < 0) {
Jmsg2(jcr, M_ERROR, 0, _("Unable to set file owner %s: ERR=%s\n"),
attr->ofname, strerror(errno));
- stat = 0;
+ ok = false;
}
if (chmod(attr->ofname, attr->statp.st_mode) < 0) {
Jmsg2(jcr, M_ERROR, 0, _("Unable to set file modes %s: ERR=%s\n"),
attr->ofname, strerror(errno));
- stat = 0;
+ ok = false;
}
- /* FreeBSD user flags */
-#ifdef HAVE_CHFLAGS
- if (chflags(attr->ofname, attr->statp.st_flags) < 0) {
- Jmsg2(jcr, M_ERROR, 0, _("Unable to set file flags %s: ERR=%s\n"),
- attr->ofname, strerror(errno));
- stat = 0;
- }
-#endif
/*
* Reset file times.
*/
if (utime(attr->ofname, &ut) < 0) {
Jmsg2(jcr, M_ERROR, 0, _("Unable to set file times %s: ERR=%s\n"),
attr->ofname, strerror(errno));
- stat = 0;
+ ok = false;
+ }
+#ifdef HAVE_CHFLAGS
+ /*
+ * FreeBSD user flags
+ *
+ * Note, this should really be done before the utime() above,
+ * but if the immutable bit is set, it will make the utimes()
+ * fail.
+ */
+ if (chflags(attr->ofname, attr->statp.st_flags) < 0) {
+ Jmsg2(jcr, M_ERROR, 0, _("Unable to set file flags %s: ERR=%s\n"),
+ attr->ofname, strerror(errno));
+ ok = false;
}
+#endif
}
pm_strcpy(&attr->ofname, "*none*");
umask(old_mask);
- return stat;
+ return ok;
}
* fname is the original filename
* ofile is the output filename (may be in a different directory)
*
- * Returns: 1 on success
- * 0 on failure
+ * Returns: true on success
+ * false on failure
*/
-static int set_win32_attributes(JCR *jcr, ATTR *attr, BFILE *ofd)
+static bool set_win32_attributes(JCR *jcr, ATTR *attr, BFILE *ofd)
{
char *p = attr->attrEx;
int64_t val;
POOLMEM *win32_ofile;
if (!p_GetFileAttributesEx) {
- return 0;
+ return false;
}
if (!p || !*p) { /* we should have attributes */
if (is_bopen(ofd)) {
bclose(ofd);
}
- return 0;
+ return false;
} else {
Dmsg2(100, "Attribs %s = %s\n", attr->ofname, attr->attrEx);
}
}
}
free_pool_memory(win32_ofile);
- return 1;
+ return true;
}
void win_error(JCR *jcr, char *prefix, POOLMEM *win32_ofile)
*/
/* from attribs.c */
-void encode_stat (char *buf, FF_PKT *ff_pkt, int data_stream);
-int decode_stat (char *buf, struct stat *statp, int32_t *LinkFI);
-int32_t decode_LinkFI (char *buf, struct stat *statp);
-int encode_attribsEx (JCR *jcr, char *attribsEx, FF_PKT *ff_pkt);
-int set_attributes (JCR *jcr, ATTR *attr, BFILE *ofd);
-int select_data_stream(FF_PKT *ff_pkt);
+void encode_stat (char *buf, FF_PKT *ff_pkt, int data_stream);
+int decode_stat (char *buf, struct stat *statp, int32_t *LinkFI);
+int32_t decode_LinkFI (char *buf, struct stat *statp);
+int encode_attribsEx (JCR *jcr, char *attribsEx, FF_PKT *ff_pkt);
+bool set_attributes (JCR *jcr, ATTR *attr, BFILE *ofd);
+int select_data_stream(FF_PKT *ff_pkt);
/* from create_file.c */
-int create_file (JCR *jcr, ATTR *attr, BFILE *ofd, int replace);
+int create_file (JCR *jcr, ATTR *attr, BFILE *ofd, int replace);
/* From find.c */
FF_PKT *init_find_files();
int file_is_excluded(FF_PKT *ff, const char *file);
int file_is_included(FF_PKT *ff, const char *file);
struct s_included_file *get_next_included_file(FF_PKT *ff,
- struct s_included_file *inc);
+ struct s_included_file *inc);
/* From find_one.c */
int find_one_file(JCR *jcr, FF_PKT *ff, int handle_file(FF_PKT *ff_pkt, void *hpkt),
- void *pkt, char *p, dev_t parent_device, int top_level);
+ void *pkt, char *p, dev_t parent_device, int top_level);
int term_find_one(FF_PKT *ff);
/* from makepath.c */
int make_path(JCR *jcr, const char *argpath, int mode,
- int parent_mode, uid_t owner, gid_t group,
- int preserve_existing, char *verbose_fmt_string);
+ int parent_mode, uid_t owner, gid_t group,
+ int preserve_existing, char *verbose_fmt_string);
/* from bfile.c -- see bfile.h */
* Append Data sent from File daemon
*
*/
-int do_append_data(JCR *jcr)
+bool do_append_data(JCR *jcr)
{
int32_t n;
int32_t file_index, stream, last_file_index;
if (!bnet_set_buffer_size(ds, jcr->device->max_network_buffer_size, BNET_SETBUF_WRITE)) {
set_jcr_job_status(jcr, JS_ErrorTerminated);
Jmsg(jcr, M_FATAL, 0, _("Unable to set network buffer size.\n"));
- return 0;
+ return false;
}
/*
Dmsg0(100, "just before acquire_device\n");
if (!(dcr=acquire_device_for_append(jcr))) {
set_jcr_job_status(jcr, JS_ErrorTerminated);
- return 0;
+ return false;
}
dev = dcr->dev;
block = dcr->block;
dev->file, dev->block_num, dev->dev_name, strerror(dev->dev_errno));
} else {
dev->dev_errno = ENOSPC; /* out of space */
- Jmsg(jcr, M_INFO, 0, _("End of medium at %u:%u on device %s. Write of %u bytes got %d.\n"),
+ Jmsg(jcr, M_INFO, 0, _("End of Volume \"%s\" at %u:%u on device %s. Write of %u bytes got %d.\n"),
+ dev->VolCatInfo.VolCatName,
dev->file, dev->block_num, dev->dev_name, wlen, stat);
}
if (dev_cap(dev, CAP_TWOEOF)) {
weofcmd();
}
+ force_close_dev(dev); /* release device */
+ if (!open_the_device()) {
+ return -1;
+ }
rewindcmd();
Pmsg0(0, _("Now moving to end of medium.\n"));
eodcmd();
static char ferrmsg[] = "3900 Invalid command\n";
/* Imported functions */
-extern int do_append_data(JCR *jcr);
-extern int do_read_data(JCR *jcr);
+extern bool do_append_data(JCR *jcr);
+extern bool do_read_data(JCR *jcr);
/* Forward referenced functions */
/* */
#undef VERSION
#define VERSION "1.35.1"
-#define BDATE "18 July 2004"
-#define LSMDATE "18Jul04"
+#define BDATE "21 July 2004"
+#define LSMDATE "21Jul04"
/* Debug flags */
#undef DEBUG