]> git.sur5r.net Git - bacula/bacula/commitdiff
Fix breaks in bextract + in restore print only volumes to be actually used
authorKern Sibbald <kern@sibbald.com>
Sun, 6 Jul 2003 16:41:52 +0000 (16:41 +0000)
committerKern Sibbald <kern@sibbald.com>
Sun, 6 Jul 2003 16:41:52 +0000 (16:41 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@622 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/ChangeLog
bacula/kernstodo
bacula/src/dird/bsr.c
bacula/src/filed/restore.c
bacula/src/stored/bextract.c

index 85a38eab740c4d168e25572ca571de2ffe5c146e..ea78e15b6b2a901cde2c2985de03dec7810dc156 100644 (file)
@@ -1,5 +1,7 @@
 
 2003-07-xx Version 1.31 Beta xxJul03
+- In restore print only volumes that will actually be used.
+- Fix bextract -- add appropriate breaks in new case code.
 - Add a new test -- bsr-opt-test for testing bsr optimization. As usual,
   it pointed out a bug where the directory tree handling code destroyed
   the restore arg list.
index 2c627d324e337ad5039004f8c3d45909ac6a8113..f6756b0334d8af4731674f3e3931ecebb0fb3beb 100644 (file)
@@ -1,5 +1,5 @@
                  Kern's ToDo List
-                  27 June 2003 
+                   6 July 2003 
 
 Documentation to do: (any release a little bit at a time)
 - Document running a test version.
@@ -44,8 +44,7 @@ For 1.31 release:
    ERR=The system cannot find the path specified.
 - Finish Windows implementation (add setting of correct type on restore,
   add Portable Data Format flag).
-- Remove multiple simultaneous devices code in SD.
-- Check that Block number in JobMedia are correct.
+- Maybe remove multiple simultaneous devices code in SD.
 - Increment DB version prior to releasing.
 - Turn off FULL_DEBUG prior to releasing.
 - On Windows with very long path names, it may be impossible to create 
@@ -53,23 +52,17 @@ For 1.31 release:
   We must cd into the directory then create the file without the
   full path name.
 - Move JobFiles and JobBytes to SD rather than FD -- more correct.
-- Add client name to cram-md5 challenge so Director can immediately
-  verify if it is the correct client.
 - lstat() is not going to work on Win32 for testing date.
 - Implement a Recycle command
 - Something is not right in last block of fill command.
-- Implement List Volume Job=xxx  or List scheduled volumes or
-  Status Director 
+- Implement List Volume Job=xxx  or List scheduled volumes or Status Director 
 - Check if Incremental is working correctly when it looks for the previous Job 
   (Phil's problem).
-- Add next Volume to be used to status output.
-- The bsr for Dan's job has file indexes covering the whole range rather
-  than only the range contained on the volume.
-  Constrain FileIndex to be within range for Volume.
-- Pass prefix_links to FD.
 
 
 For 1.32:
+- Add client name to cram-md5 challenge so Director can immediately
+  verify if it is the correct client.
 - Implement ClientRunBeforeJob and ClientRunAfterJob.
 - Implement new alist in FileSet scanning.
 - Add JobLevel in FD status (but make sure it is defined).
@@ -1018,4 +1011,10 @@ Done: (see kernsdone for more)
 - To link with mysqlclient_r may require -lssl -lcrypto
 - Document Heart beat code 
 - Non-fatal errors are not correct counting attribs.c:277
+- Check that Block number in JobMedia are correct.
+- The bsr for Dan's job has file indexes covering the whole range rather
+  than only the range contained on the volume.
+  Constrain FileIndex to be within range for Volume.
+- Pass prefix_links to FD.
+- Fix restore list of volumes if Volume not selected.
+
index e2bc4e0115fdc182f2ec7b807c5c364a03d7d665..f843a6f20d59297b13a54c43638cb9a7977a41e1 100644 (file)
@@ -187,7 +187,9 @@ int write_bsr_file(UAContext *ua, RBSR *bsr)
    start_prompt(ua, "");
    for (RBSR *nbsr=bsr; nbsr; nbsr=nbsr->next) {
       for (int i=0; i < nbsr->VolCount; i++) {
-        add_prompt(ua, nbsr->VolParams[i].VolumeName);
+        if (nbsr->VolParams[i].VolumeName[0]) {
+           add_prompt(ua, nbsr->VolParams[i].VolumeName);
+        }
       }
    }
    for (int i=0; i < ua->num_prompts; i++) {
@@ -206,6 +208,7 @@ static void write_bsr(UAContext *ua, RBSR *bsr, FILE *fd)
       for (int i=0; i < bsr->VolCount; i++) {
         if (!is_volume_selected(bsr->fi, bsr->VolParams[i].FirstIndex,
              bsr->VolParams[i].LastIndex)) {
+           bsr->VolParams[i].VolumeName[0] = 0;  /* zap VolumeName */
            continue;
         }
          fprintf(fd, "Volume=\"%s\"\n", bsr->VolParams[i].VolumeName);
index bc50195b7b4b500f43cb68b712a6e770cc0fea4a..bf1116abc8956478f87afc4e7b7697ac3281acb0 100644 (file)
@@ -236,13 +236,13 @@ void do_restore(JCR *jcr)
       case STREAM_WIN32_GZIP_DATA:  
 #ifdef HAVE_LIBZ
         if (extract) {
-           ser_declare;
            uLong compress_len;
-           uint64_t faddr;
-           char ec1[50];
            int stat;
 
            if (stream == STREAM_SPARSE_GZIP_DATA) {
+              ser_declare;
+              uint64_t faddr;
+              char ec1[50];
               wbuf = sd->msg + SPARSE_FADDR_SIZE;
               wsize = sd->msglen - SPARSE_FADDR_SIZE;
               ser_begin(sd->msg, SPARSE_FADDR_SIZE);
index f8d5175a3279f8ea3adc39ffb2b3cf4e2e06ee3c..c602eb4bfad0d880620e80cf3ed6b270ab6b5bcb 100644 (file)
@@ -256,8 +256,8 @@ static void record_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec)
         if (!is_bopen(&bfd)) {
             Emsg0(M_ERROR, 0, _("Logic error output file should be open but is not.\n"));
         }
-        extract = FALSE;
         set_attributes(jcr, attr, &bfd);
+        extract = FALSE;
       }
 
       if (!unpack_attributes_record(jcr, rec->Stream, rec->data, attr)) {
@@ -277,6 +277,7 @@ static void record_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec)
                Jmsg(jcr, M_ERROR, 0, _("%s stream not supported on this Client.\n"),
                  stream_to_ascii(attr->data_stream));
            }
+           extract = FALSE;
            return;
         }
 
@@ -303,6 +304,7 @@ static void record_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec)
            break;
         }  
       }
+      break;
 
    /* Data stream and extracting */
    case STREAM_FILE_DATA:
@@ -336,7 +338,7 @@ static void record_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec)
         }
         fileAddr += wsize;
       }
-
+      break;
 
    /* GZIP data stream */
    case STREAM_GZIP_DATA:
@@ -344,12 +346,13 @@ static void record_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec)
    case STREAM_WIN32_GZIP_DATA:  
 #ifdef HAVE_LIBZ
       if (extract) {
-        uLongf compress_len;
+        uLong compress_len;
         int stat;
 
         if (rec->Stream == STREAM_SPARSE_GZIP_DATA) {
            ser_declare;
            uint64_t faddr;
+           char ec1[50];
            wbuf = rec->data + SPARSE_FADDR_SIZE;
            wsize = rec->data_len - SPARSE_FADDR_SIZE;
            ser_begin(rec->data, SPARSE_FADDR_SIZE);
@@ -357,8 +360,10 @@ static void record_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec)
            if (fileAddr != faddr) {
               fileAddr = faddr;
               if (blseek(&bfd, (off_t)fileAddr, SEEK_SET) < 0) {
-                  Emsg2(M_ERROR, 0, _("Seek error on %s: %s\n"), 
-                    attr->ofname, strerror(errno));
+                  Emsg3(M_ERROR, 0, _("Seek to %s error on %s: ERR=%s\n"), 
+                    edit_uint64(fileAddr, ec1), attr->ofname, berror(&bfd));
+                 extract = FALSE;
+                 return;
               }
            }
         } else {
@@ -368,14 +373,18 @@ static void record_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec)
         compress_len = compress_buf_size;
         if ((stat=uncompress((Bytef *)compress_buf, &compress_len, 
               (const Bytef *)wbuf, (uLong)wsize) != Z_OK)) {
-            Emsg1(M_ERROR_TERM, 0, _("Uncompression error. ERR=%d\n"), stat);
+            Emsg1(M_ERROR, 0, _("Uncompression error. ERR=%d\n"), stat);
+           extract = FALSE;
+           return;
         }
 
          Dmsg2(100, "Write uncompressed %d bytes, total before write=%d\n", compress_len, total);
         if ((uLongf)bwrite(&bfd, compress_buf, (size_t)compress_len) != compress_len) {
             Pmsg0(0, "===Write error===\n");
-            Emsg2(M_ERROR_TERM, 0, _("Write error on %s: %s\n"), 
+            Emsg2(M_ERROR, 0, _("Write error on %s: %s\n"), 
               attr->ofname, strerror(errno));
+           extract = FALSE;
+           return;
         }
         total += compress_len;
         fileAddr += compress_len;
@@ -389,6 +398,7 @@ static void record_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec)
         return;
       }
 #endif
+      break;
 
    case STREAM_MD5_SIGNATURE:
    case STREAM_SHA1_SIGNATURE:
@@ -408,8 +418,8 @@ static void record_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec)
         if (!is_bopen(&bfd)) {
             Emsg0(M_ERROR, 0, "Logic error output file should be open but is not.\n");
         }
-        extract = FALSE;
         set_attributes(jcr, attr, &bfd);
+        extract = FALSE;
       }
       Jmsg(jcr, M_ERROR, 0, _("Unknown stream=%d ignored. This shouldn't happen!\n"), 
         rec->Stream);