]> git.sur5r.net Git - bacula/bacula/commitdiff
Misc cleanups
authorKern Sibbald <kern@sibbald.com>
Sat, 10 May 2003 19:41:29 +0000 (19:41 +0000)
committerKern Sibbald <kern@sibbald.com>
Sat, 10 May 2003 19:41:29 +0000 (19:41 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@503 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/kernstodo
bacula/src/dird/ua_label.c
bacula/src/filed/restore.c
bacula/src/findlib/create_file.c
bacula/src/lib/util.c
bacula/src/stored/mount.c
bacula/src/version.h

index 8fcc4af0bdee4b0cd8889444626556a06a9ac537..fb34318d634dd851c7cc882ccf83b122102586c0 100644 (file)
@@ -19,6 +19,17 @@ Testing to do: (painful)
 
 
 For 1.31 release:
+- Shell character expansion is failing occassionally.
+- One block was orphaned in the SD probably after cancel.
+- Test if rewind at end of tape waits for tape to rewind.
+- Check if cancel works with FD.
+- Error labeling tape from console gets Jmsg error because of no Job.
+- Fix the following:
+  rufus-dir: Max configured use duration exceeded. Marking Volume "MatouBackup" as Used.
+   rufus-sd: Volume "" previously written, moving to end of data.
+   rufus-sd: Matou.2003-05-10_10.39.18 Error: I canot write on this volume because:
+      The number of files mismatch! Volume=1 Catalog=0
+   rufus-sd: Matou.2003-05-10_10.39.18 Error: askdir.c:155 NULL Volume name. This shouldn't happen!!!
 - Properly configure console and gconsole (currently for source not
   configured for installation).
 - Fix "access not allowed" for backup of files on WinXP.
index c42445707114482758bd67e6feac9bb15808a0ac..bd6481a91faa27ed3de730a1c0d939f1bb6b7870 100644 (file)
@@ -205,7 +205,7 @@ checkVol:
 
    /* Get a new Volume name */
    for ( ;; ) {
-      if (!get_cmd(ua, _("Enter new Volume name: ")) || ua->cmd[0] == '.') {
+      if (!get_cmd(ua, _("Enter new Volume name: "))) {
         return 1;
       }
 checkName:
@@ -234,7 +234,7 @@ checkName:
            }
            first = 0;
         } else {
-            if (!get_cmd(ua, _("Enter slot (0 for none): ")) || ua->cmd[0] == '.') {
+            if (!get_cmd(ua, _("Enter slot (0 for none): "))) {
               return 1;
            }
            mr.Slot = atoi(ua->cmd);
index e3ee6944807d84b8f7e421e49fd8d05eeb848aed..b32647b8728de1353840f5089a4ba607f971132c 100644 (file)
@@ -264,8 +264,9 @@ void do_restore(JCR *jcr)
            }
         }
 
-         Dmsg1(30, "Outfile=%s\n", ofile);
+        jcr->num_files_examined++;
 
+         Dmsg1(30, "Outfile=%s\n", ofile);
         extract = FALSE;
         stat = create_file(jcr, fname, ofile, lname, type, 
                            stream, &statp, attribsEx, &bfd, jcr->replace, 
@@ -294,7 +295,6 @@ void do_restore(JCR *jcr)
            break;
         }  
 
-        jcr->num_files_examined++;
 
       /* Data stream */
       } else if (stream == STREAM_FILE_DATA || stream == STREAM_SPARSE_DATA) {
@@ -429,7 +429,7 @@ extern char *getgroup(gid_t gid);
  */
 static void print_ls_output(JCR *jcr, char *fname, char *lname, int type, struct stat *statp)
 {
-   char buf[2000]; 
+   char buf[5000]; 
    char ec1[30];
    char *p, *f;
    int n;
@@ -459,6 +459,6 @@ static void print_ls_output(JCR *jcr, char *fname, char *lname, int type, struct
    }
    *p++ = '\n';
    *p = 0;
-   Dmsg0(20, buf);
+   Dmsg1(20, "%s", buf);
    Jmsg(jcr, M_RESTORED, 0, "%s", buf);
 }
index 42555260e28501229dab2d537745a6ff0681213f..a6d54d6e87cb4bb4917f1d3a2fb9ff1a675d9ac6 100644 (file)
@@ -137,10 +137,8 @@ int create_file(void *jcr, char *fname, char *ofile, char *lname,
             * execute bit set (i.e. parent_mode), and preserve what already
             * exists. Normally, this should do nothing.
             */
-           stat = !make_path(jcr, ofile, parent_mode, parent_mode, uid, gid, 1, NULL);
-           if (stat == 0) {
+           if (!make_path(jcr, ofile, parent_mode, parent_mode, uid, gid, 1, NULL)) {
                Dmsg1(0, "Could not make path. %s\n", ofile);
-               Jmsg1(jcr, M_ERROR, 0, _("Could not make path. %s\n"), ofile);
               return CF_ERROR;
            }
         }
@@ -158,7 +156,8 @@ int create_file(void *jcr, char *fname, char *ofile, char *lname,
         }
          Dmsg1(50, "Create file: %s\n", ofile);
         if ((bopen(ofd, ofile, mode, S_IRUSR | S_IWUSR)) < 0) {
-            Jmsg2(jcr, M_ERROR, 0, _("Could not create %s: ERR=%s\n"), ofile, berror(ofd));
+            Jmsg2(jcr, M_ERROR, 0, _("Could not create %s: ERR=%s\n"), 
+                 ofile, berror(ofd));
            return CF_ERROR;
         }
         return CF_EXTRACT;
@@ -169,13 +168,15 @@ int create_file(void *jcr, char *fname, char *ofile, char *lname,
         if (S_ISFIFO(statp->st_mode)) {
             Dmsg1(200, "Restore fifo: %s\n", ofile);
            if (mkfifo(ofile, statp->st_mode) != 0 && errno != EEXIST) {
-               Jmsg2(jcr, M_ERROR, 0, _("Cannot make fifo %s: ERR=%s\n"), ofile, berror(ofd));
+               Jmsg2(jcr, M_ERROR, 0, _("Cannot make fifo %s: ERR=%s\n"), 
+                    ofile, strerror(errno));
               return CF_ERROR;
            }
         } else {          
             Dmsg1(200, "Restore node: %s\n", ofile);
            if (mknod(ofile, statp->st_mode, statp->st_rdev) != 0 && errno != EEXIST) {
-               Jmsg2(jcr, M_ERROR, 0, _("Cannot make node %s: ERR=%s\n"), ofile, berror(ofd));
+               Jmsg2(jcr, M_ERROR, 0, _("Cannot make node %s: ERR=%s\n"), 
+                    ofile, strerror(errno));
               return CF_ERROR;
            }
         }       
@@ -190,7 +191,8 @@ int create_file(void *jcr, char *fname, char *ofile, char *lname,
               tid = NULL;
            }
            if ((bopen(ofd, ofile, mode, 0)) < 0) {
-               Jmsg2(jcr, M_ERROR, 0, _("Could not open %s: ERR=%s\n"), ofile, berror(ofd));
+               Jmsg2(jcr, M_ERROR, 0, _("Could not open %s: ERR=%s\n"), 
+                    ofile, berror(ofd));
               stop_thread_timer(tid);
               return CF_ERROR;
            }
@@ -204,7 +206,7 @@ int create_file(void *jcr, char *fname, char *ofile, char *lname,
          Dmsg2(130, "FT_LNK should restore: %s -> %s\n", ofile, lname);
         if (symlink(lname, ofile) != 0 && errno != EEXIST) {
             Jmsg3(jcr, M_ERROR, 0, _("Could not symlink %s -> %s: ERR=%s\n"),
-                 ofile, lname, berror(ofd));
+                 ofile, lname, strerror(errno));
            return CF_ERROR;
         }
         return CF_CREATED;
@@ -212,8 +214,8 @@ int create_file(void *jcr, char *fname, char *ofile, char *lname,
       case FT_LNKSAVED:                 /* Hard linked, file already saved */
       Dmsg2(130, "Hard link %s => %s\n", ofile, lname);
       if (link(lname, ofile) != 0) {
-         Jmsg3(jcr, M_ERROR, 0, _("Could not hard link %s ==> %s: ERR=%s\n"),
-              ofile, lname, berror(ofd));
+         Jmsg3(jcr, M_ERROR, 0, _("Could not hard link %s -> %s: ERR=%s\n"),
+              ofile, lname, strerror(errno));
         return CF_ERROR;
       }
       return CF_CREATED;
@@ -222,9 +224,7 @@ int create_file(void *jcr, char *fname, char *ofile, char *lname,
 
    case FT_DIR:
       Dmsg2(300, "Make dir mode=%o dir=%s\n", new_mode, ofile);
-      if (make_path(jcr, ofile, new_mode, parent_mode, uid, gid, 0, NULL) != 0) {
-         Jmsg2(jcr, M_ERROR, 0, _("Could not make directory %s: ERR=%s\n"), 
-              ofile, berror(ofd));
+      if (!make_path(jcr, ofile, new_mode, parent_mode, uid, gid, 0, NULL)) {
         return CF_ERROR;
       }
       return CF_CREATED;
index 6d3e3b6ae965a9020dd1e89da9a88a4aef4ae80f..4b46b247c0ac8938f3c8ab59a612e8d386d2527a 100644 (file)
@@ -436,33 +436,34 @@ int do_shell_expansion(char *name)
 
        case 0:                           /* child */
          /* look for shell */
-          if ((shellcmd = getenv("SHELL")) == NULL)
+          if ((shellcmd = getenv("SHELL")) == NULL) {
              shellcmd = "/bin/sh";
+         }
          close(1); dup(pfd[1]);          /* attach pipes to stdin and stdout */
          close(2); dup(pfd[1]);
          for (i = 3; i < 32; i++)        /* close everything else */
             close(i);
           strcpy(echout, "echo ");        /* form echo command */
-         strcat(echout, name);
+         bstrncat(echout, name, sizeof(echout));
           execl(shellcmd, shellcmd, "-c", echout, NULL); /* give to shell */
           exit(127);                      /* shouldn't get here */
 
        default:                          /* parent */
          /* read output from child */
+         echout[0] = 0;
          i = read(pfd[0], echout, sizeof echout);
-         echout[--i] = 0;                /* set end of string */
-         /* look for first word or first line. */
-         while (--i >= 0) {
-             if (echout[i] == ' ' || echout[i] == '\n')
-               echout[i] = 0;            /* keep only first one */
+         if (i > 0) {
+            echout[--i] = 0;                /* set end of string */
+            /* look for first line. */
+            while (--i >= 0) {
+                if (echout[i] == '\n') {
+                  echout[i] = 0;            /* keep only first one */
+               }
+            }
          }
-         istat = signal(SIGINT, SIG_IGN);
-         qstat = signal(SIGQUIT, SIG_IGN);
          /* wait for child to exit */
          while ((wpid = wait(&waitstatus)) != pid && wpid != -1)
             { ; }
-         signal(SIGINT, istat);
-         signal(SIGQUIT, qstat);
          strcpy(name, echout);
          stat = 1;
          break;
index 449cc284957e5bacae52aa23865816e9a626c863..61c31b35ff7c6018ef31389c6ebf485c5be20196 100644 (file)
@@ -77,6 +77,9 @@ mount_next_vol:
       if (!dev_is_tape(dev) || !dev_cap(dev, CAP_ALWAYSOPEN)) {
         if (dev_cap(dev, CAP_OFFLINEUNMOUNT)) {
            offline_dev(dev);
+        } else if (!rewind_dev(dev)) {
+            Jmsg2(jcr, M_WARNING, 0, _("Rewind error on device %s. ERR=%s\n"), 
+                 dev_name(dev), strerror_dev(dev));
         }
         close_dev(dev);
       }
@@ -85,8 +88,7 @@ mount_next_vol:
       if (dev->state & ST_OPENED) {
         if (dev_cap(dev, CAP_OFFLINEUNMOUNT)) {
            offline_dev(dev);
-        }
-        if (!rewind_dev(dev)) {
+        } else if (!rewind_dev(dev)) {
             Jmsg2(jcr, M_WARNING, 0, _("Rewind error on device %s. ERR=%s\n"), 
                  dev_name(dev), strerror_dev(dev));
         }
index f40a9ce646bcd1871e2a6109466721586b0e68e9..e9655e1084b8569f94881f243b19ff6330a6014b 100644 (file)
@@ -1,8 +1,8 @@
 /* */
 #define VERSION "1.31"
 #define VSTRING "1"
-#define BDATE   "08 May 2003"
-#define LSMDATE "08May03"
+#define BDATE   "10 May 2003"
+#define LSMDATE "10May03"
 
 /* Debug flags */
 #define DEBUG 1