]> git.sur5r.net Git - bacula/bacula/commitdiff
03Dec07
authorKern Sibbald <kern@sibbald.com>
Mon, 3 Dec 2007 19:27:38 +0000 (19:27 +0000)
committerKern Sibbald <kern@sibbald.com>
Mon, 3 Dec 2007 19:27:38 +0000 (19:27 +0000)
kes  This patch fixes bcopy so that it produces correct Volumes.
     It fixes bug #1022.
kes  This patch eliminates spurious output to the console during a VerifyVolume
     job that contains encrypted data. It fixes bug #1024.

git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/branches/Branch-2.2@6017 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/patches/2.2.6-bcopy.patch [new file with mode: 0644]
bacula/patches/2.2.6-verify-vol.patch [new file with mode: 0644]
bacula/src/filed/verify_vol.c
bacula/src/stored/bcopy.c
bacula/technotes-2.1

diff --git a/bacula/patches/2.2.6-bcopy.patch b/bacula/patches/2.2.6-bcopy.patch
new file mode 100644 (file)
index 0000000..a02dec4
--- /dev/null
@@ -0,0 +1,78 @@
+
+ This patch fixes bcopy so that it produces correct Volumes.
+ It fixes bug #1022.
+
+ Apply this patch to version 2.2.6 and possibly any 2.2.x version with:
+
+ cd <bacula-source>
+ patch -p0 2.2.6-bcopy.patch
+ ./configure <your-options>
+ make
+ ...
+ make install
+
+
+Index: src/stored/bcopy.c
+===================================================================
+--- src/stored/bcopy.c (revision 6010)
++++ src/stored/bcopy.c (working copy)
+@@ -89,6 +89,7 @@
+    char *iVolumeName = NULL;
+    char *oVolumeName = NULL;
+    bool ignore_label_errors = false;
++   bool ok;
+    setlocale(LC_ALL, "");
+    bindtextdomain("bacula", LOCALEDIR);
+@@ -199,9 +200,11 @@
+    }
+    out_block = out_jcr->dcr->block;
+-   read_records(in_jcr->dcr, record_cb, mount_next_read_volume);
+-   if (!write_block_to_device(out_jcr->dcr)) {
+-      Pmsg0(000, _("Write of last block failed.\n"));
++   ok = read_records(in_jcr->dcr, record_cb, mount_next_read_volume);
++   if (ok || out_dev->can_write()) {
++      if (!write_block_to_device(out_jcr->dcr)) {
++         Pmsg0(000, _("Write of last block failed.\n"));
++      }
+    }
+    Pmsg2(000, _("%u Jobs copied. %u records copied.\n"), jobs, records);
+@@ -253,6 +256,7 @@
+                   out_dev->print_name(), out_dev->bstrerror());
+                Jmsg(out_jcr, M_FATAL, 0, _("Cannot fixup device error. %s\n"),
+                      out_dev->bstrerror());
++               return false;
+             }
+          }
+          if (!write_block_to_device(out_jcr->dcr)) {
+@@ -260,8 +264,9 @@
+                out_dev->print_name(), out_dev->bstrerror());
+             Jmsg(out_jcr, M_FATAL, 0, _("Cannot fixup device error. %s\n"),
+                   out_dev->bstrerror());
++            return false;
+          }
+-         break;
++         return true;
+       case EOM_LABEL:
+          Pmsg0(000, _("EOM label not copied.\n"));
+          return true;
+@@ -269,7 +274,7 @@
+          Pmsg0(000, _("EOT label not copied.\n"));
+          return true;
+       default:
+-         break;
++         return true;
+       }
+    }
+@@ -283,7 +288,7 @@
+             out_dev->print_name(), out_dev->bstrerror());
+          Jmsg(out_jcr, M_FATAL, 0, _("Cannot fixup device error. %s\n"),
+                out_dev->bstrerror());
+-         break;
++         return false;
+       }
+    }
+    return true;
diff --git a/bacula/patches/2.2.6-verify-vol.patch b/bacula/patches/2.2.6-verify-vol.patch
new file mode 100644 (file)
index 0000000..264d108
--- /dev/null
@@ -0,0 +1,51 @@
+
+ This patch eliminates spurious output to the console during a VerifyVolume
+ job that contains encrypted data.  
+ It fixes bug #1024.
+
+ Apply this patch to Bacula version 2.2.6 and previous 2.2.x versions with:
+
+ cd <bacula-source>
+ patch -p0 <2.2.6-verify-vol.patch
+ ./configure <your-options>
+ make
+ ...
+ make install
+
+
+Index: src/filed/verify_vol.c
+===================================================================
+--- src/filed/verify_vol.c     (revision 6010)
++++ src/filed/verify_vol.c     (working copy)
+@@ -211,19 +211,6 @@
+          }
+          break;
+-      /* Data streams to ignore */
+-      case STREAM_ENCRYPTED_SESSION_DATA:
+-      case STREAM_FILE_DATA:
+-      case STREAM_SPARSE_DATA:
+-      case STREAM_WIN32_DATA:
+-      case STREAM_WIN32_GZIP_DATA:
+-      case STREAM_GZIP_DATA:
+-      case STREAM_SPARSE_GZIP_DATA:
+-      case STREAM_SIGNED_DIGEST:
+-
+-        /* Do nothing */
+-        break;
+-
+       case STREAM_MD5_DIGEST:
+          bin_to_base64(digest, sizeof(digest), (char *)sd->msg, CRYPTO_DIGEST_MD5_SIZE, true);
+          Dmsg2(400, "send inx=%d MD5=%s\n", jcr->JobFiles, digest);
+@@ -256,9 +243,10 @@
+          Dmsg2(20, "bfiled>bdird: SHA512 len=%d: msg=%s\n", dir->msglen, dir->msg);
+          break;
++      /* Ignore everything else */
+       default:
+-         Pmsg2(0, "None of above!!! stream=%d data=%s\n", stream,sd->msg);
+          break;
++
+       } /* end switch */
+    } /* end while bnet_get */
+    set_jcr_job_status(jcr, JS_Terminated);
index bd94ad3a6589fbcdc1ff28347437b5c747713b75..efc7ea4d1850b84c44f6317abfffc88dca0b8220 100644 (file)
@@ -211,19 +211,6 @@ void do_verify_volume(JCR *jcr)
          }
          break;
 
-      /* Data streams to ignore */
-      case STREAM_ENCRYPTED_SESSION_DATA:
-      case STREAM_FILE_DATA:
-      case STREAM_SPARSE_DATA:
-      case STREAM_WIN32_DATA:
-      case STREAM_WIN32_GZIP_DATA:
-      case STREAM_GZIP_DATA:
-      case STREAM_SPARSE_GZIP_DATA:
-      case STREAM_SIGNED_DIGEST:
-
-        /* Do nothing */
-        break;
-
       case STREAM_MD5_DIGEST:
          bin_to_base64(digest, sizeof(digest), (char *)sd->msg, CRYPTO_DIGEST_MD5_SIZE, true);
          Dmsg2(400, "send inx=%d MD5=%s\n", jcr->JobFiles, digest);
@@ -256,9 +243,10 @@ void do_verify_volume(JCR *jcr)
          Dmsg2(20, "bfiled>bdird: SHA512 len=%d: msg=%s\n", dir->msglen, dir->msg);
          break;
 
+      /* Ignore everything else */
       default:
-         Pmsg2(0, "None of above!!! stream=%d data=%s\n", stream,sd->msg);
          break;
+
       } /* end switch */
    } /* end while bnet_get */
    set_jcr_job_status(jcr, JS_Terminated);
index 76c5cde892651879c4fa716252c2f501ceaa5b8c..edec449576a27cd9fab4781fc2df0d1afa5ca832 100644 (file)
@@ -89,6 +89,7 @@ int main (int argc, char *argv[])
    char *iVolumeName = NULL;
    char *oVolumeName = NULL;
    bool ignore_label_errors = false;
+   bool ok;
 
    setlocale(LC_ALL, "");
    bindtextdomain("bacula", LOCALEDIR);
@@ -199,9 +200,11 @@ int main (int argc, char *argv[])
    }
    out_block = out_jcr->dcr->block;
 
-   read_records(in_jcr->dcr, record_cb, mount_next_read_volume);
-   if (!write_block_to_device(out_jcr->dcr)) {
-      Pmsg0(000, _("Write of last block failed.\n"));
+   ok = read_records(in_jcr->dcr, record_cb, mount_next_read_volume);
+   if (ok || out_dev->can_write()) {
+      if (!write_block_to_device(out_jcr->dcr)) {
+         Pmsg0(000, _("Write of last block failed.\n"));
+      }
    }
 
    Pmsg2(000, _("%u Jobs copied. %u records copied.\n"), jobs, records);
@@ -253,6 +256,7 @@ static bool record_cb(DCR *in_dcr, DEV_RECORD *rec)
                   out_dev->print_name(), out_dev->bstrerror());
                Jmsg(out_jcr, M_FATAL, 0, _("Cannot fixup device error. %s\n"),
                      out_dev->bstrerror());
+               return false;
             }
          }
          if (!write_block_to_device(out_jcr->dcr)) {
@@ -260,8 +264,9 @@ static bool record_cb(DCR *in_dcr, DEV_RECORD *rec)
                out_dev->print_name(), out_dev->bstrerror());
             Jmsg(out_jcr, M_FATAL, 0, _("Cannot fixup device error. %s\n"),
                   out_dev->bstrerror());
+            return false;
          }
-         break;
+         return true;
       case EOM_LABEL:
          Pmsg0(000, _("EOM label not copied.\n"));
          return true;
@@ -269,7 +274,7 @@ static bool record_cb(DCR *in_dcr, DEV_RECORD *rec)
          Pmsg0(000, _("EOT label not copied.\n"));
          return true;
       default:
-         break;
+         return true;
       }
    }
 
@@ -283,7 +288,7 @@ static bool record_cb(DCR *in_dcr, DEV_RECORD *rec)
             out_dev->print_name(), out_dev->bstrerror());
          Jmsg(out_jcr, M_FATAL, 0, _("Cannot fixup device error. %s\n"),
                out_dev->bstrerror());
-         break;
+         return false;
       }
    }
    return true;
index 59500b7f48fea93655b7cf1ab02556f5c3c1cf18..ce8a0482f8da57bdcc608eddd0265de5cf9d4f8f 100644 (file)
@@ -1,6 +1,11 @@
               Technical notes on version 2.2
 
 General:
+03Dec07
+kes  This patch fixes bcopy so that it produces correct Volumes.
+     It fixes bug #1022.
+kes  This patch eliminates spurious output to the console during a VerifyVolume
+     job that contains encrypted data. It fixes bug #1024.
 02Dec07
 kes  This patch prevents the 'status dir' command from trying to use a scratch
      volume and possibly moving it from one pool to another.  This patch fixes