From 2d15744f322c3dfad8aa8938f2c7bd74374157be Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Sat, 10 Mar 2012 10:25:15 +0100 Subject: [PATCH] Force the re-initialization of BaseJobOpts, AccurateOpts and VerifyOpts between two Include{} When using this configuration FileSet { Name = X Include { Options { Accurate = A } File = /tmp } Include { Options { Compression = GZIP1 } File = /elsewhere } } The second Include {} block is using the Accurate=A option from the first Include{}. With this fix, the Accurate/BaseJob/Verify options are set to default between two Include{}. We still have the same kind of problem for the "flags" that contains most options. Something like the following configuration won't work as expected: FileSet { Name = X Include { Options { Portable = no } File = /tmp } Include { Options { Portable = yes } File = /elsewhere } } --- bacula/src/findlib/find.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/bacula/src/findlib/find.c b/bacula/src/findlib/find.c index df615480fd..d31714ec05 100644 --- a/bacula/src/findlib/find.c +++ b/bacula/src/findlib/find.c @@ -178,14 +178,19 @@ find_files(JCR *jcr, FF_PKT *ff, int file_save(JCR *jcr, FF_PKT *ff_pkt, bool to findFILESET *fileset = ff->fileset; if (fileset) { int i, j; + /* TODO: We probably need be move the initialization in the fileset loop, + * at this place flags options are "concatenated" accross Include {} blocks + * (not only Options{} blocks inside a Include{}) + */ ff->flags = 0; - ff->VerifyOpts[0] = 'V'; - ff->VerifyOpts[1] = 0; - strcpy(ff->AccurateOpts, "Cmcs"); /* mtime+ctime+size by default */ - strcpy(ff->BaseJobOpts, "Jspug5"); /* size+perm+user+group+chk */ for (i=0; iinclude_list.size(); i++) { findINCEXE *incexe = (findINCEXE *)fileset->include_list.get(i); fileset->incexe = incexe; + + strcpy(ff->VerifyOpts, "V"); + strcpy(ff->AccurateOpts, "Cmcs"); /* mtime+ctime+size by default */ + strcpy(ff->BaseJobOpts, "Jspug5"); /* size+perm+user+group+chk */ + /* * By setting all options, we in effect OR the global options * which is what we want. @@ -200,7 +205,7 @@ find_files(JCR *jcr, FF_PKT *ff, int file_save(JCR *jcr, FF_PKT *ff_pkt, bool to ff->drivetypes = fo->drivetype; ff->plugin = fo->plugin; /* TODO: generate a plugin event ? */ ff->opt_plugin = (ff->plugin != NULL)? true : false; - bstrncat(ff->VerifyOpts, fo->VerifyOpts, sizeof(ff->VerifyOpts)); + bstrncat(ff->VerifyOpts, fo->VerifyOpts, sizeof(ff->VerifyOpts)); /* TODO: Concat or replace? */ if (fo->AccurateOpts[0]) { bstrncpy(ff->AccurateOpts, fo->AccurateOpts, sizeof(ff->AccurateOpts)); } @@ -208,7 +213,8 @@ find_files(JCR *jcr, FF_PKT *ff, int file_save(JCR *jcr, FF_PKT *ff_pkt, bool to bstrncpy(ff->BaseJobOpts, fo->BaseJobOpts, sizeof(ff->BaseJobOpts)); } } - Dmsg3(50, "Verify=<%s> Accurate=<%s> BaseJob=<%s>\n", ff->VerifyOpts, ff->AccurateOpts, ff->BaseJobOpts); + Dmsg4(50, "Verify=<%s> Accurate=<%s> BaseJob=<%s> flags=<%d>\n", + ff->VerifyOpts, ff->AccurateOpts, ff->BaseJobOpts, ff->flags); dlistString *node; foreach_dlist(node, &incexe->name_list) { char *fname = node->c_str(); -- 2.39.5