]> git.sur5r.net Git - bacula/bacula/commitdiff
Rescue updates + misc
authorKern Sibbald <kern@sibbald.com>
Wed, 21 Jul 2004 15:39:19 +0000 (15:39 +0000)
committerKern Sibbald <kern@sibbald.com>
Wed, 21 Jul 2004 15:39:19 +0000 (15:39 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1484 91ce42f0-d328-0410-95d8-f526ca767f89

13 files changed:
bacula/kernstodo
bacula/src/dird/Makefile.in
bacula/src/filed/filed.c
bacula/src/filed/filed.h
bacula/src/filed/heartbeat.c
bacula/src/filed/job.c
bacula/src/findlib/attribs.c
bacula/src/findlib/protos.h
bacula/src/stored/append.c
bacula/src/stored/block.c
bacula/src/stored/btape.c
bacula/src/stored/fd_cmds.c
bacula/src/version.h

index 2f7c3ee53c7bf230d3981c373ea9bc11a55b9bc1..95d245570943721f0242bdd39429c9dd1dc9c145 100644 (file)
@@ -2,21 +2,12 @@
                    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.
@@ -26,7 +17,9 @@
 - 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.
@@ -1101,3 +1094,8 @@ Block Position: 0
 - 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.
+
index b12a0a51cf7efe630168426e9c650f500bdf5cd4..005c756198de11f7966bf8619d5851f920099047 100644 (file)
@@ -96,16 +96,17 @@ devclean: realclean
 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 \
index 40bb9152c65d1b430d0c891cdce28f5de1628082..3d8e788d22ecd4ea7e410224f1e93b6a6901b3ad 100644 (file)
@@ -42,6 +42,7 @@ void terminate_filed(int sig);
 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;
@@ -91,7 +92,6 @@ static void usage()
 int main (int argc, char *argv[])
 {
    int ch;
-   bool no_signals = false;
    bool test_config = false;
    DIRRES *director;
    char *uid = NULL;
index a4a90910c268f9a6480af5392130ebc7832677c6..99c3045e7c15a413be2a3093d80e1dc62be779e6 100644 (file)
@@ -6,7 +6,7 @@
  *   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
index 83f090adb97cfb66f790bc423b83e508cb04c8c8..81a0e39f2ea182c963f0fdcfe386aef8b4f1ac67 100644 (file)
@@ -43,7 +43,7 @@
 
 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.
@@ -94,14 +94,24 @@ extern "C" void *sd_heartbeat_thread(void *arg)
 /* 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 */
index 09ea2129587a713dc7ab5a38bbe22bdf91dc39f3..591a1d6ac2831d37549fb15a17b13b263c500253 100644 (file)
@@ -1112,7 +1112,6 @@ static int storage_cmd(JCR *jcr)
    /* 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);
@@ -1120,6 +1119,7 @@ static int storage_cmd(JCR *jcr)
          jcr->stored_addr, stored_port);
       return 0;
    }
+   Dmsg0(110, "Connection OK to SD.\n");
 
    jcr->store_bsock = sd;
 
index 0c6e6cb840cabb1471689681f80da64ee9e036dc..492e5b8024c38b337ef047ed4a564de2e9d64f7d 100755 (executable)
@@ -34,7 +34,7 @@
 #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);
@@ -284,14 +284,14 @@ int32_t decode_LinkFI(char *buf, struct stat *statp)
  *  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 &&
@@ -300,7 +300,7 @@ int set_attributes(JCR *jcr, ATTR *attr, BFILE *ofd)
           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) {
@@ -308,7 +308,7 @@ int set_attributes(JCR *jcr, ATTR *attr, BFILE *ofd)
         bclose(ofd); 
       }
       pm_strcpy(&attr->ofname, "*none*");
-      return 1;
+      return true;
    }
 
 
@@ -337,40 +337,46 @@ int set_attributes(JCR *jcr, ATTR *attr, BFILE *ofd)
       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;
 }
 
 
@@ -467,10 +473,10 @@ int encode_attribsEx(JCR *jcr, char *attribsEx, FF_PKT *ff_pkt)
  *  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;
@@ -479,7 +485,7 @@ static int set_win32_attributes(JCR *jcr, ATTR *attr, BFILE *ofd)
    POOLMEM *win32_ofile;
 
    if (!p_GetFileAttributesEx) {                                
-      return 0;
+      return false;
    }
 
    if (!p || !*p) {                  /* we should have attributes */
@@ -487,7 +493,7 @@ static int set_win32_attributes(JCR *jcr, ATTR *attr, BFILE *ofd)
       if (is_bopen(ofd)) {
         bclose(ofd);
       }
-      return 0;
+      return false;
    } else {
       Dmsg2(100, "Attribs %s = %s\n", attr->ofname, attr->attrEx);
    }
@@ -547,7 +553,7 @@ static int set_win32_attributes(JCR *jcr, ATTR *attr, BFILE *ofd)
       }
    }
    free_pool_memory(win32_ofile);
-   return 1;
+   return true;
 }
 
 void win_error(JCR *jcr, char *prefix, POOLMEM *win32_ofile)
index 135c304d4624b1747d4a378dec168d77a92d7e0b..58566d9cfd18898975190df4f6477c6faaa899fa 100644 (file)
 
  */
 /* 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();
@@ -47,11 +47,11 @@ void  add_fname_to_exclude_list(FF_PKT *ff, const char *fname);
 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);
 
 
@@ -61,7 +61,7 @@ int enable_backup_privileges(JCR *jcr, int ignore_errors);
 
 /* 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 */
index 2a8df378ffdf3af63d3afbbca7b8e61be4a050d5..cff97bf8d3e705aa3aa5c7ee722bbec4dc7700ec 100644 (file)
@@ -37,7 +37,7 @@ static char OK_data[]    = "3000 OK data\n";
  *  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;
@@ -56,7 +56,7 @@ int do_append_data(JCR *jcr)
    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;
    }
 
    /* 
@@ -67,7 +67,7 @@ int do_append_data(JCR *jcr)
    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;
index 0c8f24d440c84c7682d08e961e2a9d488b315545..8e5725adeb14614090534fb71a64f0f706f12743 100644 (file)
@@ -566,7 +566,8 @@ bool write_block_to_dev(DCR *dcr, DEV_BLOCK *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);
       }  
 
index ee168b41e53c2a2002641d90c062dd80c53ca7d9..674307dbb3a28581f1f5ab2ddedd6be42e1a9406 100644 (file)
@@ -1002,6 +1002,10 @@ static int append_test()
    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();
index 17e94d8bf5e109c82d8d1301ff55f820761c4fdf..99ab03a0303d4195658786ee02caaf4ab1a02666 100644 (file)
@@ -40,8 +40,8 @@ extern STORES *me;
 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 */
 
index 2c8ff5b7731e4053698d56007b6f2a8c0c2de38a..274d86b0945525d78d5dba3d4054f949b4d790be 100644 (file)
@@ -1,8 +1,8 @@
 /* */
 #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