From: Kern Sibbald Date: Mon, 3 Dec 2007 19:27:38 +0000 (+0000) Subject: 03Dec07 X-Git-Tag: Release-2.2.7~22 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=a5b713da10ccae3502fd519c9802ebddb9cd71ca;p=bacula%2Fbacula 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. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/branches/Branch-2.2@6017 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/patches/2.2.6-bcopy.patch b/bacula/patches/2.2.6-bcopy.patch new file mode 100644 index 0000000000..a02dec4bda --- /dev/null +++ b/bacula/patches/2.2.6-bcopy.patch @@ -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 + patch -p0 2.2.6-bcopy.patch + ./configure + 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 index 0000000000..264d108842 --- /dev/null +++ b/bacula/patches/2.2.6-verify-vol.patch @@ -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 + patch -p0 <2.2.6-verify-vol.patch + ./configure + 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); diff --git a/bacula/src/filed/verify_vol.c b/bacula/src/filed/verify_vol.c index bd94ad3a65..efc7ea4d18 100644 --- a/bacula/src/filed/verify_vol.c +++ b/bacula/src/filed/verify_vol.c @@ -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); diff --git a/bacula/src/stored/bcopy.c b/bacula/src/stored/bcopy.c index 76c5cde892..edec449576 100644 --- a/bacula/src/stored/bcopy.c +++ b/bacula/src/stored/bcopy.c @@ -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; diff --git a/bacula/technotes-2.1 b/bacula/technotes-2.1 index 59500b7f48..ce8a0482f8 100644 --- a/bacula/technotes-2.1 +++ b/bacula/technotes-2.1 @@ -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