From 9d6e42d0c0d5378095163e51c0a24b7028a39dc1 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Mon, 7 Sep 2009 11:24:50 +0200 Subject: [PATCH] Apply Marco's git format-patch patches for bugs #1365 and #1366 --- bacula/patches/3.0.2-bug-1365.patch | 70 +++++++++++++++++++++++++++++ bacula/patches/3.0.2-bug-1366.patch | 42 +++++++++++++++++ bacula/technotes | 2 + 3 files changed, 114 insertions(+) create mode 100644 bacula/patches/3.0.2-bug-1365.patch create mode 100644 bacula/patches/3.0.2-bug-1366.patch diff --git a/bacula/patches/3.0.2-bug-1365.patch b/bacula/patches/3.0.2-bug-1365.patch new file mode 100644 index 0000000000..785d33eb36 --- /dev/null +++ b/bacula/patches/3.0.2-bug-1365.patch @@ -0,0 +1,70 @@ +>From f182fe49fca2b2e3009f26fbf6197f8c046835ad Mon Sep 17 00:00:00 2001 +From: Marco van Wieringen +Date: Sun, 6 Sep 2009 17:56:20 +0200 +Subject: [PATCH] This patch should fix bug #1365 + +--- + bacula/src/filed/restore.c | 15 +++++++-------- + 1 files changed, 7 insertions(+), 8 deletions(-) + +diff --git a/bacula/src/filed/restore.c b/bacula/src/filed/restore.c +index a4ee03a..4400e14 100644 +--- a/bacula/src/filed/restore.c ++++ b/bacula/src/filed/restore.c +@@ -120,7 +120,7 @@ static void close_previous_stream(r_ctx &rctx); + + + static bool verify_signature(JCR *jcr, r_ctx &rctx); +-int32_t extract_data(JCR *jcr, r_ctx &rctx, POOLMEM *buf, int32_t buflen, ++int32_t extract_data(JCR *jcr, BFILE *bfd, POOLMEM *buf, int32_t buflen, + uint64_t *addr, int flags, RESTORE_CIPHER_CTX *cipher_ctx); + bool flush_cipher(JCR *jcr, BFILE *bfd, uint64_t *addr, int flags, + RESTORE_CIPHER_CTX *cipher_ctx); +@@ -508,8 +508,9 @@ void do_restore(JCR *jcr) + rctx.flags |= FO_WIN32DECOMP; /* "decompose" BackupWrite data */ + } + +- if (extract_data(jcr, rctx, sd->msg, sd->msglen, &rctx.fileAddr, ++ if (extract_data(jcr, &rctx.bfd, sd->msg, sd->msglen, &rctx.fileAddr, + rctx.flags, &rctx.cipher_ctx) < 0) { ++ rctx.extract = false; + bclose(&rctx.bfd); + continue; + } +@@ -558,8 +559,9 @@ void do_restore(JCR *jcr) + Dmsg0(130, "Restoring resource fork\n"); + } + +- if (extract_data(jcr, rctx, sd->msg, sd->msglen, &rctx.fork_addr, rctx.fork_flags, ++ if (extract_data(jcr, &rctx.forkbfd, sd->msg, sd->msglen, &rctx.fork_addr, rctx.fork_flags, + &rctx.fork_cipher_ctx) < 0) { ++ rctx.extract = false; + bclose(&rctx.forkbfd); + continue; + } +@@ -1069,10 +1071,9 @@ bool store_data(JCR *jcr, BFILE *bfd, char *data, const int32_t length, bool win + * The flags specify whether to use sparse files or compression. + * Return value is the number of bytes written, or -1 on errors. + */ +-int32_t extract_data(JCR *jcr, r_ctx &rctx, POOLMEM *buf, int32_t buflen, +- uint64_t *addr, int flags, RESTORE_CIPHER_CTX *cipher_ctx) ++int32_t extract_data(JCR *jcr, BFILE *bfd, POOLMEM *buf, int32_t buflen, ++ uint64_t *addr, int flags, RESTORE_CIPHER_CTX *cipher_ctx) + { +- BFILE *bfd = &rctx.bfd; + char *wbuf; /* write buffer */ + uint32_t wsize; /* write size */ + uint32_t rsize; /* read size */ +@@ -1172,9 +1173,7 @@ int32_t extract_data(JCR *jcr, r_ctx &rctx, POOLMEM *buf, int32_t buflen, + return wsize; + + bail_out: +- rctx.extract = false; + return -1; +- + } + + +-- +1.5.6.5 + diff --git a/bacula/patches/3.0.2-bug-1366.patch b/bacula/patches/3.0.2-bug-1366.patch new file mode 100644 index 0000000000..8222a85163 --- /dev/null +++ b/bacula/patches/3.0.2-bug-1366.patch @@ -0,0 +1,42 @@ +>From 297ec720cf512a6b5045c962bfb8a2f134ac77b0 Mon Sep 17 00:00:00 2001 +From: Marco van Wieringen +Date: Sun, 6 Sep 2009 18:06:48 +0200 +Subject: [PATCH] This patch should fix bug #1366 + +--- + bacula/src/filed/restore.c | 11 ++++++++++- + 1 files changed, 10 insertions(+), 1 deletions(-) + +diff --git a/bacula/src/filed/restore.c b/bacula/src/filed/restore.c +index 4400e14..cbb0889 100644 +--- a/bacula/src/filed/restore.c ++++ b/bacula/src/filed/restore.c +@@ -367,7 +367,6 @@ void do_restore(JCR *jcr) + rctx.extract = true; + /* FALLTHROUGH */ + case CF_CREATED: /* File created, but there is no content */ +- jcr->JobFiles++; + rctx.fileAddr = 0; + print_ls_output(jcr, attr); + +@@ -377,7 +376,17 @@ void do_restore(JCR *jcr) + if (attr->type == FT_REG && rsrc_len > 0) { + rctx.extract = true; + } ++ ++ /* ++ * Count the resource forks not as regular files being restored. ++ */ ++ if (rsrc_len == 0) { ++ jcr->JobFiles++; ++ } ++ } else { ++ jcr->JobFiles++; + } ++ + if (!rctx.extract) { + /* set attributes now because file will not be extracted */ + if (jcr->plugin) { +-- +1.5.6.5 + diff --git a/bacula/technotes b/bacula/technotes index 33bc1701b0..0de62c00af 100644 --- a/bacula/technotes +++ b/bacula/technotes @@ -2,6 +2,8 @@ General: +07Sep09 +kes Apply Marco's git format-patch patches for bugs #1365 and #1366 06Sep09 kes Increment minor version to avoid future conflict. kes Increase default path/file length to 2048. This should fix -- 2.39.5