]> git.sur5r.net Git - bacula/bacula/commitdiff
Implement new Include/Exclude + fix segfaults in variable expansion + print warning...
authorKern Sibbald <kern@sibbald.com>
Wed, 10 Sep 2003 11:22:06 +0000 (11:22 +0000)
committerKern Sibbald <kern@sibbald.com>
Wed, 10 Sep 2003 11:22:06 +0000 (11:22 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@694 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/kernstodo
bacula/src/dird/dird_conf.c
bacula/src/dird/dird_conf.h
bacula/src/dird/expand.c
bacula/src/dird/inc_conf.c
bacula/src/dird/ua_cmds.c
bacula/src/version.h

index 369ef992ed354f36333dacb5e472effe7f667b5e..b5c8b1e9adb3ed194be8d0feb9da4622f3c314f9 100644 (file)
@@ -37,9 +37,11 @@ For 1.32:
 - Don't print "Warning: Wrong Volume mounted ..." if mounting second
   volume.
 - Implement List Volume Job=xxx  or List scheduled volumes or Status Director 
-   
+- Add heartbeat from FD to SD if hb interval expires.
 
 For 1.33
+- Suppress read error on blank tape when doing a label.
+- Can we dynamically change FileSets.
 - If pool specified to label command and Label Format is specified,
   automatically generate the Volume name.
 - Take a careful look a the Basic recycling algorithm.  When Bacula
@@ -895,4 +897,3 @@ Done: (see kernsdone for more)
 - Check to see if "blocked" is set during restore.
 - Figure out what is interrupting sql command in console.
 - Make new job print warning User Unmounted Tape.
-
index 2170928f4e45ef165f1ad51dcdfcb602fb2e74f8..e455804ec74ef3717e32101c93800d9846f1a6b3 100644 (file)
@@ -227,10 +227,8 @@ static struct res_items job_items[] = {
 static struct res_items fs_items[] = {
    {"name",        store_name, ITEM(res_fs.hdr.name), 0, ITEM_REQUIRED, 0},
    {"description", store_str,  ITEM(res_fs.hdr.desc), 0, 0, 0},
-   {"include",     store_inc,  NULL,                  0, 0, 0},
-   {"finclude",    store_finc, NULL,                  0, ITEM_NO_EQUALS, 0},
-   {"exclude",     store_inc,  NULL,                  1, 0, 0},
-   {"fexclude",    store_finc, NULL,                  1, ITEM_NO_EQUALS, 0},
+   {"include",     store_inc,  NULL,                  0, ITEM_NO_EQUALS, 0},
+   {"exclude",     store_inc,  NULL,                  1, ITEM_NO_EQUALS, 0},
    {NULL,         NULL,       NULL,                  0, 0, 0} 
 };
 
@@ -433,17 +431,19 @@ void dump_resource(int type, RES *reshdr, void sendit(void *sock, char *fmt, ...
         res->res_con.hdr.name, res->res_con.enable_ssl);
       break;
    case R_COUNTER:
-      sendit(sock, "Counter: name=%s min=%d max=%d\n",
-        res->res_counter.hdr.name, res->res_counter.MinValue, 
-        res->res_counter.MaxValue);
+      if (res->res_counter.WrapCounter) {
+         sendit(sock, "Counter: name=%s min=%d max=%d wrapcntr=%s\n",
+           res->res_counter.hdr.name, res->res_counter.MinValue, 
+           res->res_counter.MaxValue, res->res_counter.WrapCounter->hdr.name);
+      } else {
+         sendit(sock, "Counter: name=%s min=%d max=%d\n",
+           res->res_counter.hdr.name, res->res_counter.MinValue, 
+           res->res_counter.MaxValue);
+      }
       if (res->res_counter.Catalog) {
          sendit(sock, "  --> ");
         dump_resource(-R_CATALOG, (RES *)res->res_counter.Catalog, sendit, sock);
       }
-      if (res->res_counter.WrapCounter) {
-         sendit(sock, "  --> ");
-        dump_resource(-R_COUNTER, (RES *)res->res_counter.WrapCounter, sendit, sock);
-      }
       break;
 
    case R_CLIENT:
index fad79e2e080146f6ade4550c66f0c391022e2aeb..5c4aad6b66570ad8d41efdc3c7fd71fbccffdf5c 100644 (file)
@@ -235,7 +235,7 @@ struct INCEXE {
 struct FILESET {
    RES   hdr;
 
-   int finclude;                      /* Set if finclude/fexclude used */
+   int new_include;                   /* Set if new include used */
    INCEXE **include_items;            /* array of incexe structures */
    int num_includes;                  /* number in array */
    INCEXE **exclude_items;
index 308624f7943b7c23d364881cea78b7ff5a1241bf..4002dbb34ace3ecd81151a944b1dcfc9eac2741e 100644 (file)
@@ -212,7 +212,11 @@ static var_rc_t lookup_counter_var(var_t *ctx, void *my_ctx,
               counter->CurrentValue++;
            }
            cr.CurrentValue = counter->CurrentValue;
-           bstrncpy(cr.WrapCounter, counter->WrapCounter->hdr.name, sizeof(cr.WrapCounter));
+           if (counter->WrapCounter) {
+              bstrncpy(cr.WrapCounter, counter->WrapCounter->hdr.name, sizeof(cr.WrapCounter));
+           } else {
+              cr.WrapCounter[0] = 0;
+           }
            if (!db_update_counter_record(jcr, jcr->db, &cr)) {
                Jmsg(jcr, M_ERROR, 0, _("Count not update counter %s: ERR=%s\n"),
                  counter->hdr.name, db_strerror(jcr->db));
index d4cf2953710f350b1ce733d9d068cdacf8a44c6c..bacd5bbead282d35aeaadcc806b85ff6f5934889 100644 (file)
@@ -1,6 +1,6 @@
 /*
- *   Configuration file parser for Include, Exclude, Finclude
- *    and FExclude records.
+ *   Configuration file parser for new and old Include and
+ *     Exclude records
  *
  *     Kern Sibbald, March MMIII
  *
@@ -32,8 +32,8 @@
 /* Forward referenced subroutines */
 
 void store_inc(LEX *lc, struct res_items *item, int index, int pass);
-void store_finc(LEX *lc, struct res_items *item, int index, int pass);
 
+static void store_newinc(LEX *lc, struct res_items *item, int index, int pass);
 static void store_match(LEX *lc, struct res_items *item, int index, int pass);
 static void store_opts(LEX *lc, struct res_items *item, int index, int pass);
 static void store_fname(LEX *lc, struct res_items *item, int index, int pass);
@@ -49,14 +49,14 @@ static void setup_current_opts(void);
 extern URES res_all;
 extern int  res_all_size;
 
-/* We build the current Finclude Fexclude item here */
+/* We build the current new Include and Exclude items here */
 static INCEXE res_incexe;
 
 /* 
- * FInclude/FExclude items
+ * new Include/Exclude items
  *   name            handler     value                        code flags default_value
  */
-static struct res_items finc_items[] = {
+static struct res_items newinc_items[] = {
    {"compression",     store_opts,    NULL,     0, 0, 0},
    {"signature",       store_opts,    NULL,     0, 0, 0},
    {"verify",          store_opts,    NULL,     0, 0, 0},
@@ -87,7 +87,7 @@ static struct res_items finc_items[] = {
 #define INC_KW_PORTABLE    10
 
 /* Include keywords -- these are keywords that can appear
- *    in the options lists of an include ( Include = compression= ...)
+ *    in the options lists of an old include ( Include = compression= ...)
  */
 static struct s_kw FS_option_kw[] = {
    {"compression", INC_KW_COMPRESSION},
@@ -151,7 +151,7 @@ static struct s_fs_opt FS_options[] = {
 
 
 /* 
- * Scan for Include options (keyword=option) is converted into one or
+ * Scan for old Include options (keyword=option) is converted into one or
  *  two characters. Verifyopts=xxxx is Vxxxx:
  */
 static void scan_include_options(LEX *lc, int keyword, char *opts, int optlen)
@@ -204,12 +204,26 @@ void store_inc(LEX *lc, struct res_items *item, int index, int pass)
    char inc_opts[100];
    int inc_opts_len;
 
+   /*
+    * Decide if we are doing a new Include or an old include. The
+    *  new Include is followed immediately by {, whereas the
+    *  old include has options following the Include.
+    */
+   token = lex_get_token(lc, T_ALL);           
+   if (token == T_BOB) {
+      store_newinc(lc, item, index, pass);
+      return;
+   }
+   if (token != T_EQUALS) {
+      scan_err1(lc, _("Expecting an equals sign, got: %s\n"), lc->str);
+   }
    lc->options |= LOPT_NO_IDENT;      /* make spaces significant */
    memset(&res_incexe, 0, sizeof(INCEXE));
 
    /* Get include options */
    inc_opts[0] = 0;
    while ((token=lex_get_token(lc, T_ALL)) != T_BOB) {
+        
       keyword = INC_KW_NONE;
       for (i=0; FS_option_kw[i].name; i++) {
         if (strcasecmp(lc->str, FS_option_kw[i].name) == 0) {
@@ -230,6 +244,7 @@ void store_inc(LEX *lc, struct res_items *item, int index, int pass)
         break;
       }
    }
+
    if (!inc_opts[0]) {
       strcat(inc_opts, "0");          /* set no options */
    }
@@ -312,7 +327,7 @@ void store_inc(LEX *lc, struct res_items *item, int index, int pass)
  *  resource.  We treat the Finclude/Fexeclude like a sort of
  *  mini-resource within the FileSet resource.
  */
-void store_finc(LEX *lc, struct res_items *item, int index, int pass)
+static void store_newinc(LEX *lc, struct res_items *item, int index, int pass)
 {
    int token, i;
    INCEXE *incexe;
@@ -321,12 +336,8 @@ void store_finc(LEX *lc, struct res_items *item, int index, int pass)
       MD5Init(&res_all.res_fs.md5c);
       res_all.res_fs.have_MD5 = TRUE;
    }
-   res_all.res_fs.finclude = TRUE;
-   token = lex_get_token(lc, T_ALL);           
-   if (token != T_BOB) {
-      scan_err1(lc, _("Expecting a beginning brace, got: %s\n"), lc->str);
-   }
    memset(&res_incexe, 0, sizeof(INCEXE));
+   res_all.res_fs.new_include = TRUE;
    while ((token = lex_get_token(lc, T_ALL)) != T_EOF) {
       if (token == T_EOL) {
         continue;
@@ -337,14 +348,14 @@ void store_finc(LEX *lc, struct res_items *item, int index, int pass)
       if (token != T_IDENTIFIER) {
          scan_err1(lc, _("Expecting keyword, got: %s\n"), lc->str);
       }
-      for (i=0; finc_items[i].name; i++) {
-        if (strcasecmp(finc_items[i].name, lc->str) == 0) {
+      for (i=0; newinc_items[i].name; i++) {
+        if (strcasecmp(newinc_items[i].name, lc->str) == 0) {
            token = lex_get_token(lc, T_ALL);
            if (token != T_EQUALS) {
                scan_err1(lc, "expected an equals, got: %s", lc->str);
            }
            /* Call item handler */
-           finc_items[i].handler(lc, &finc_items[i], i, pass);
+           newinc_items[i].handler(lc, &newinc_items[i], i, pass);
            i = -1;
            break;
         }
index 214bc6a1308dd761aa915f71839cbcdd209d8101..9056b087b653e69a87b58b207b5458d20892b7d6 100644 (file)
@@ -1277,6 +1277,10 @@ static int setdebug_cmd(UAContext *ua, char *cmd)
 static int var_cmd(UAContext *ua, char *cmd)
 {
    POOLMEM *var = get_pool_memory(PM_FNAME);
+
+   if (!open_db(ua)) {
+      return 1;
+   }
    for (int i=1; i<ua->argc; i++) {
       if (ua->argk[i] && variable_expansion(ua->jcr, ua->argk[i], &var)) {
          bsendmsg(ua, "%s\n", var);
index 809c094d633a89c5ab0b1760e711d036f8efce2a..fd71f7c705d759a7b8ce50ef958a58153450077c 100644 (file)
@@ -2,8 +2,8 @@
 #undef  VERSION
 #define VERSION "1.32"
 #define VSTRING "1"
-#define BDATE   "07 Sep 2003"
-#define LSMDATE "07Sep03"
+#define BDATE   "10 Sep 2003"
+#define LSMDATE "10Sep03"
 
 /* Debug flags */
 #undef  DEBUG