]> git.sur5r.net Git - bacula/bacula/commitdiff
Move patch files
authorKern Sibbald <kern@sibbald.com>
Wed, 20 Oct 2004 13:55:29 +0000 (13:55 +0000)
committerKern Sibbald <kern@sibbald.com>
Wed, 20 Oct 2004 13:55:29 +0000 (13:55 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1659 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/patches/1.34.6/1.34.6-ACL.patch [new file with mode: 0644]
bacula/patches/1.34.6/1.34.6-block.patch [new file with mode: 0644]
bacula/patches/1.34.6/1.34.6-deadlock.patch [new file with mode: 0644]
bacula/patches/1.34.6/1.34.6-duration.patch [new file with mode: 0644]
bacula/patches/1.34.6/1.34.6-find.patch [new file with mode: 0644]
bacula/patches/1.34.6/1.34.6-gnome-console-Makefile.in.patch [new file with mode: 0644]
bacula/patches/1.34.6/1.34.6-poll.patch [new file with mode: 0644]
bacula/patches/1.34.6/1.34.6-pool.patch [new file with mode: 0644]
bacula/patches/1.34.6/1.34.6-resched.patch [new file with mode: 0644]
bacula/patches/1.34.6/1.34.6-slots.patch [new file with mode: 0644]

diff --git a/bacula/patches/1.34.6/1.34.6-ACL.patch b/bacula/patches/1.34.6/1.34.6-ACL.patch
new file mode 100644 (file)
index 0000000..58d61d7
--- /dev/null
@@ -0,0 +1,28 @@
+
+This patch fixes a bug where the enable_acl=yes flag was not
+being properly received by the File daemon.
+It can be applied to version 1.34.6 with the following:
+
+ cd <bacula-source>
+ patch -p0 <1.34.6-ACL.patch
+ make
+ make install
+ ...
+
+Index: src/filed/job.c
+===================================================================
+RCS file: /cvsroot/bacula/bacula/src/filed/job.c,v
+retrieving revision 1.78
+diff -u -r1.78 job.c
+--- src/filed/job.c    12 Jun 2004 12:38:16 -0000      1.78
++++ src/filed/job.c    15 Oct 2004 07:20:28 -0000
+@@ -833,6 +833,9 @@
+       case 'k':
+        fo->flags |= FO_KEEPATIME;
+        break;
++      case 'A':
++       fo->flags |= FO_ACL;
++       break;
+       case 'V':                  /* verify options */
+        /* Copy Verify Options */
+          for (j=0; *p && *p != ':'; p++) {
diff --git a/bacula/patches/1.34.6/1.34.6-block.patch b/bacula/patches/1.34.6/1.34.6-block.patch
new file mode 100644 (file)
index 0000000..71934be
--- /dev/null
@@ -0,0 +1,108 @@
+
+In some cases, Bacula will get an error
+on a tape and not be able to write and EOF mark. In this
+case, the tape will no longer be readable. When this happens,
+Bacula tries to plunge on but gets into lots of trouble.
+This patch should fix that by immediately marking the Job
+in error, and by avoiding running through code that doesn't
+make any sense after a fatal error.
+
+Apply the patch to Bacula 1.34.6 (possibly earlier versions)
+with:
+
+  cd <bacula-source>
+  patch -p0 <1.34.6-block.patch
+  make
+  make install
+  ...
+
+Index: src/stored/block.c
+===================================================================
+RCS file: /cvsroot/bacula/bacula/src/stored/block.c,v
+retrieving revision 1.74.2.1
+diff -u -r1.74.2.1 block.c
+--- src/stored/block.c 20 Jun 2004 11:43:04 -0000      1.74.2.1
++++ src/stored/block.c 23 Aug 2004 19:02:10 -0000
+@@ -356,7 +356,7 @@
+       /* Create a jobmedia record for this job */
+       if (!dir_create_jobmedia_record(jcr)) {
+        dev->dev_errno = EIO;
+-         Jmsg(jcr, M_ERROR, 0, _("Could not create JobMedia record for Volume=\"%s\" Job=%s\n"),
++         Jmsg(jcr, M_FATAL, 0, _("Could not create JobMedia record for Volume=\"%s\" Job=%s\n"),
+           jcr->VolCatInfo.VolCatName, jcr->Job);
+        set_new_volume_parameters(jcr, dev);
+        stat = 0;
+@@ -372,7 +372,11 @@
+    }
+    if (!write_block_to_dev(dcr, block)) {
+-       stat = fixup_device_block_write_error(jcr, dev, block);
++       if (job_canceled(jcr)) {
++        stat = 0;
++       } else {
++        stat = fixup_device_block_write_error(jcr, dev, block);
++       }
+    }
+ bail_out:
+@@ -393,7 +397,7 @@
+    ssize_t stat = 0;
+    uint32_t wlen;                   /* length to write */
+    int hit_max1, hit_max2;
+-   bool ok;
++   bool ok = true;
+    DEVICE *dev = dcr->dev;
+    JCR *jcr = dcr->jcr;
+@@ -463,9 +467,9 @@
+           edit_uint64_with_commas(max_cap, ed1),  dev->dev_name);
+       block->write_failed = true;
+       if (weof_dev(dev, 1) != 0) {          /* end tape */
+-         Jmsg(jcr, M_ERROR, 0, "%s", dev->errmsg);
++         Jmsg(jcr, M_FATAL, 0, "%s", dev->errmsg);
+        dev->VolCatInfo.VolCatErrors++;
+-      }
++      } 
+       /* Don't do update after second EOF or file count will be wrong */
+       Dmsg0(100, "dir_update_volume_info\n");
+       dev->VolCatInfo.VolCatFiles = dev->file;
+@@ -485,7 +489,7 @@
+       if (dev_state(dev, ST_TAPE) && weof_dev(dev, 1) != 0) {          /* write eof */
+        /* Write EOF */
+-         Jmsg(jcr, M_ERROR, 0, "%s", dev->errmsg);
++         Jmsg(jcr, M_FATAL, 0, "%s", dev->errmsg);
+        block->write_failed = true;
+        dev->VolCatInfo.VolCatErrors++;
+        dev->state |= (ST_EOF | ST_EOT | ST_WEOT);
+@@ -559,18 +563,18 @@
+       block->write_failed = true;
+       if (weof_dev(dev, 1) != 0) {       /* end the tape */
+        dev->VolCatInfo.VolCatErrors++;
+-         Jmsg(jcr, M_ERROR, 0, "%s", dev->errmsg);
++         Jmsg(jcr, M_FATAL, 0, "%s", dev->errmsg);
++       ok = false;
+       }
+       Dmsg0(100, "dir_update_volume_info\n");
+       dev->VolCatInfo.VolCatFiles = dev->file;
+       dir_update_volume_info(jcr, dev, 0);
+-      if (dev_cap(dev, CAP_TWOEOF) && weof_dev(dev, 1) != 0) {        /* end the tape */
++      if (ok && dev_cap(dev, CAP_TWOEOF) && weof_dev(dev, 1) != 0) {  /* end the tape */
+        dev->VolCatInfo.VolCatErrors++;
+          Jmsg(jcr, M_ERROR, 0, "%s", dev->errmsg);
+       }
+       dev->state |= (ST_EOF | ST_EOT | ST_WEOT);
+       
+-      ok = true;
+ #define CHECK_LAST_BLOCK
+ #ifdef        CHECK_LAST_BLOCK
+       /* 
+@@ -580,7 +584,7 @@
+        *   then re-read it and verify that the block number is
+        *   correct.
+        */
+-      if (dev->state & ST_TAPE && dev_cap(dev, CAP_BSR)) {
++      if (ok && dev->state & ST_TAPE && dev_cap(dev, CAP_BSR)) {
+        /* Now back up over what we wrote and read the last block */
+        if (!bsf_dev(dev, 1)) {
diff --git a/bacula/patches/1.34.6/1.34.6-deadlock.patch b/bacula/patches/1.34.6/1.34.6-deadlock.patch
new file mode 100644 (file)
index 0000000..bfe31a4
--- /dev/null
@@ -0,0 +1,83 @@
+
+ This patch fixes two problems: 1. A deadlock between the job
+ queue scheduler and the watchdog thread. 2. A bad initialization
+ of the watchdog queue which could cause memory corruption. It also
+ reduces the watchdog granularity from 1 second to 10 seconds.
+
+ Apply the patch to Bacula 1.34.6 (probably any 1.34.x version) with:
+
+ cd <bacula-source>
+ patch -p0 <1.34.6-deadlock.patch
+ make
+ ...
+
+
+Index: src/dird/jobq.c
+===================================================================
+RCS file: /cvsroot/bacula/bacula/src/dird/jobq.c,v
+retrieving revision 1.19
+diff -u -r1.19 jobq.c
+--- src/dird/jobq.c    1 Jun 2004 20:10:04 -0000       1.19
++++ src/dird/jobq.c    9 Aug 2004 06:08:08 -0000
+@@ -501,8 +501,10 @@
+           jcr->db = NULL;
+        }
+          Dmsg1(300, "====== Termination job=%d\n", jcr->JobId);
++       V(jq->mutex);                /* release internal job queue lock */
+        free_jcr(jcr);
+        free(je);                    /* release job entry */
++       P(jq->mutex);                /* acquire internal job queue lock */
+       }
+       /*
+        * If any job in the wait queue can be run,
+Index: src/lib/watchdog.c
+===================================================================
+RCS file: /cvsroot/bacula/bacula/src/lib/watchdog.c,v
+retrieving revision 1.27
+diff -u -r1.27 watchdog.c
+--- src/lib/watchdog.c 1 Apr 2004 16:37:01 -0000       1.27
++++ src/lib/watchdog.c 9 Aug 2004 06:08:08 -0000
+@@ -32,11 +32,12 @@
+ /* Exported globals */
+ time_t watchdog_time = 0;           /* this has granularity of SLEEP_TIME */
++time_t watchdog_sleep_time = 10;      /* examine things every 10 seconds */
+-#define SLEEP_TIME 1                /* examine things every second */
+ /* Forward referenced functions */
+-static void *watchdog_thread(void *arg);
++void *watchdog_thread(void *arg);
++
+ static void wd_lock();
+ static void wd_unlock();
+@@ -71,8 +72,8 @@
+       Emsg1(M_ABORT, 0, _("Unable to initialize watchdog lock. ERR=%s\n"), 
+           strerror(errstat));
+    }
+-   wd_queue = new dlist(wd_queue, &dummy->link);
+-   wd_inactive = new dlist(wd_inactive, &dummy->link);
++   wd_queue = new dlist(dummy, &dummy->link);
++   wd_inactive = new dlist(dummy, &dummy->link);
+    if ((stat = pthread_create(&wd_tid, NULL, watchdog_thread, NULL)) != 0) {
+       return stat;
+@@ -214,7 +215,7 @@
+    return ret;
+ }
+-static void *watchdog_thread(void *arg)
++void *watchdog_thread(void *arg)
+ {
+    Dmsg0(400, "NicB-reworked watchdog thread entered\n");
+@@ -259,7 +260,7 @@
+       }
+       wd_unlock();
+       unlock_jcr_chain();
+-      bmicrosleep(SLEEP_TIME, 0);
++      bmicrosleep(watchdog_sleep_time, 0);
+    }
+    Dmsg0(400, "NicB-reworked watchdog thread exited\n");
diff --git a/bacula/patches/1.34.6/1.34.6-duration.patch b/bacula/patches/1.34.6/1.34.6-duration.patch
new file mode 100644 (file)
index 0000000..70c5504
--- /dev/null
@@ -0,0 +1,692 @@
+ Patch to allow more natural input of time durations.
+ Permitted form is "1 day 2 hours 5 sec" with and without
+ spaces. The different duration specifications (day, hour, ...) 
+ can be in any order.
+ Apply to version 1.34.6 with:
+
+ cd <bacula-source>
+ patch -p0 <1.34.6-duration.patch
+ make
+ ...
+
+Index: src/dird/ua_cmds.c
+===================================================================
+RCS file: /cvsroot/bacula/bacula/src/dird/ua_cmds.c,v
+retrieving revision 1.112
+diff -u -r1.112 ua_cmds.c
+--- src/dird/ua_cmds.c 8 Jun 2004 08:44:04 -0000       1.112
++++ src/dird/ua_cmds.c 5 Aug 2004 19:58:51 -0000
+@@ -682,7 +682,7 @@
+ static void update_volretention(UAContext *ua, char *val, MEDIA_DBR *mr)
+ {
+-   char ed1[50];
++   char ed1[150];
+    POOLMEM *query;
+    if (!duration_to_utime(val, &mr->VolRetention)) {
+       bsendmsg(ua, _("Invalid retention period specified: %s\n"), val);
+@@ -694,7 +694,7 @@
+    if (!db_sql_query(ua->db, query, NULL, NULL)) {  
+       bsendmsg(ua, "%s", db_strerror(ua->db));
+    } else {
+-      bsendmsg(ua, _("New retention seconds is: %s\n"),
++      bsendmsg(ua, _("New retention period is: %s\n"),
+        edit_utime(mr->VolRetention, ed1));
+    }
+    free_pool_memory(query);
+@@ -702,7 +702,7 @@
+ static void update_voluseduration(UAContext *ua, char *val, MEDIA_DBR *mr)
+ {
+-   char ed1[50];
++   char ed1[150];
+    POOLMEM *query;
+    if (!duration_to_utime(val, &mr->VolUseDuration)) {
+@@ -851,7 +851,7 @@
+    MEDIA_DBR mr;
+    POOL_DBR pr;
+    POOLMEM *query;
+-   char ed1[30];
++   char ed1[130];
+    bool done = false;
+    char *kw[] = {
+       N_("VolStatus"),                /* 0 */
+@@ -943,7 +943,7 @@
+        update_volstatus(ua, ua->cmd, &mr);
+        break;
+       case 1:                       /* Retention */
+-         bsendmsg(ua, _("Current retention seconds is: %s\n"),
++         bsendmsg(ua, _("Current retention period is: %s\n"),
+           edit_utime(mr.VolRetention, ed1));
+          if (!get_cmd(ua, _("Enter Volume Retention period: "))) {
+           return 0;
+Index: src/dird/ua_select.c
+===================================================================
+RCS file: /cvsroot/bacula/bacula/src/dird/ua_select.c,v
+retrieving revision 1.50
+diff -u -r1.50 ua_select.c
+--- src/dird/ua_select.c       5 Jun 2004 10:15:55 -0000       1.50
++++ src/dird/ua_select.c       5 Aug 2004 19:58:52 -0000
+@@ -38,7 +38,7 @@
+  */
+ int confirm_retention(UAContext *ua, utime_t *ret, char *msg)
+ {
+-   char ed1[30];
++   char ed1[130];
+    for ( ;; ) {
+        bsendmsg(ua, _("The current %s retention period is: %s\n"), 
+Index: src/lib/edit.c
+===================================================================
+RCS file: /cvsroot/bacula/bacula/src/lib/edit.c,v
+retrieving revision 1.17
+diff -u -r1.17 edit.c
+--- src/lib/edit.c     10 Jun 2004 09:45:41 -0000      1.17
++++ src/lib/edit.c     5 Aug 2004 19:58:54 -0000
+@@ -3,7 +3,7 @@
+  * 
+  *    Kern Sibbald, December MMII
+  *
+- *   Version $Id$
++ *   Version $Id$
+  */
+ /*
+@@ -77,7 +77,6 @@
+ }
+-
+ /*
+  * Edit an integer number with commas, the supplied buffer
+  * must be at least 27 bytes long.  The incoming number
+@@ -85,7 +84,21 @@
+  */
+ char *edit_uint64_with_commas(uint64_t val, char *buf)
+ {
+-   sprintf(buf, "%" llu, val);
++   /*  
++    * Replacement for sprintf(buf, "%" llu, val)
++    */
++   char mbuf[50];
++   mbuf[sizeof(mbuf)-1] = 0;
++   int i = sizeof(mbuf)-2;               /* edit backward */
++   if (val == 0) {
++      mbuf[i--] = '0';
++   } else {
++      while (val != 0) {
++         mbuf[i--] = "0123456789"[val%10];
++       val /= 10;
++      }
++   }
++   strcpy(buf, &mbuf[i+1]);
+    return add_commas(buf, buf);
+ }
+@@ -96,7 +109,21 @@
+  */
+ char *edit_uint64(uint64_t val, char *buf)
+ {
+-   sprintf(buf, "%" llu, val);
++   /*  
++    * Replacement for sprintf(buf, "%" llu, val)
++    */
++   char mbuf[50];
++   mbuf[sizeof(mbuf)-1] = 0;
++   int i = sizeof(mbuf)-2;               /* edit backward */
++   if (val == 0) {
++      mbuf[i--] = '0';
++   } else {
++      while (val != 0) {
++         mbuf[i--] = "0123456789"[val%10];
++       val /= 10;
++      }
++   }
++   strcpy(buf, &mbuf[i+1]);
+    return buf;
+ }
+@@ -104,9 +131,10 @@
+  * Given a string "str", separate the integer part into
+  *   str, and the modifier into mod.
+  */
+-static bool get_modifier(char *str, char *mod, int mod_len)
++static bool get_modifier(char *str, char *num, int num_len, char *mod, int mod_len)
+ {
+-   int i, len;
++   int i, len, num_begin, num_end, mod_begin, mod_end;
++       
+    /*
+     * Look for modifier by walking back looking for the first
+     * space or digit.
+@@ -114,36 +142,50 @@
+    strip_trailing_junk(str);
+    len = strlen(str);
+-   /* Find beginning of the modifier */
+-   for (i=len; i > 0; i--) {
+-      if (!B_ISALPHA(str[i-1])) {
++   for (i=0; i<len; i++) {
++      if (!B_ISSPACE(str[i])) {
+        break;
+       }
+    }
++   num_begin = i;
+-   /* If nothing found, error */
+-   if (i == 0) {
+-      Dmsg2(200, "error i=%d len=%d\n", i, len);
++   /* Walk through integer part */
++   for ( ; i<len; i++) {
++      if (!B_ISDIGIT(str[i])) {
++       break;
++      }
++   }
++   num_end = i;
++   if (num_len > (num_end - num_begin + 1)) {
++      num_len = num_end - num_begin + 1;
++   }
++   if (num_len == 0) {
+       return false;
+    }
+-
+-   /* Move modifier to its location */
+-   bstrncpy(mod, &str[i], mod_len);
+-   Dmsg2(200, "in=%s  mod=%s:\n", str, mod);
+-
+-   /* Backup over any spaces in front of modifier */
+-   for ( ; i > 0; i--) {
+-      if (B_ISSPACE(str[i-1])) {
+-       continue;
++   for ( ; i<len; i++) {
++      if (!B_ISSPACE(str[i])) {
++       break;
++      }
++   }
++   mod_begin = i;
++   for ( ; i<len; i++) {
++      if (!B_ISALPHA(str[i])) {
++       break;
+       }
+-      str[i] = 0;
+-      break;
+    }
+-   /* The remainder (beginning) should be our number */
+-   if (!is_a_number(str)) {
+-      Dmsg0(200, "input not a number\n");
++   mod_end = i;
++   if (mod_len > (mod_end - mod_begin + 1)) {
++      mod_len = mod_end - mod_begin + 1;
++   }
++   Dmsg5(900, "str=%s: num_beg=%d num_end=%d mod_beg=%d mod_end=%d\n",
++      str, num_begin, num_end, mod_begin, mod_end);
++   bstrncpy(num, &str[num_begin], num_len);
++   bstrncpy(mod, &str[mod_begin], mod_len);
++   if (!is_a_number(num)) {
+       return false;
+    }
++   bstrncpy(str, &str[mod_end], len);
++
+    return true;
+ }
+@@ -155,8 +197,9 @@
+ int duration_to_utime(char *str, utime_t *value)
+ {
+    int i, mod_len;
+-   double val;
++   double val, total = 0.0;
+    char mod_str[20];
++   char num_str[50];
+    /*
+     * The "n" = mins and months appears before minutes so that m maps
+     *   to months. These "kludges" make it compatible with pre 1.31 
+@@ -167,26 +210,33 @@
+    static const int32_t mult[] = {60, 1, 60*60*24*30, 60, 
+                 60*60, 60*60*24, 60*60*24*7, 60*60*24*91, 60*60*24*365};
+-   if (!get_modifier(str, mod_str, sizeof(mod_str))) {
+-      return 0;
+-   }
+-   /* Now find the multiplier corresponding to the modifier */
+-   mod_len = strlen(mod_str);
+-   for (i=0; mod[i]; i++) {
+-      if (strncasecmp(mod_str, mod[i], mod_len) == 0) {
+-       break;
++   while (*str) {
++      if (!get_modifier(str, num_str, sizeof(num_str), mod_str, sizeof(mod_str))) {
++       return 0;
++      }
++      /* Now find the multiplier corresponding to the modifier */
++      mod_len = strlen(mod_str);
++      if (mod_len == 0) {
++       i = 1;                          /* assume seconds */
++      } else {
++       for (i=0; mod[i]; i++) {
++          if (strncasecmp(mod_str, mod[i], mod_len) == 0) {
++             break;
++          }
++       }
++       if (mod[i] == NULL) {
++          i = 1;                       /* no modifier, assume secs */
++       }
++      }
++      Dmsg2(900, "str=%s: mult=%d\n", num_str, mult[i]);
++      errno = 0;
++      val = strtod(num_str, NULL);
++      if (errno != 0 || val < 0) {
++       return 0;
+       }
++      total += val * mult[i];
+    }
+-   if (mod[i] == NULL) {
+-      i = 1;                        /* no modifier, assume 1 */
+-   }
+-   Dmsg2(200, "str=%s: mult=%d\n", str, mult[i]);
+-   errno = 0;
+-   val = strtod(str, NULL);
+-   if (errno != 0 || val < 0) {
+-      return 0;
+-   }
+-  *value = (utime_t)(val * mult[i]);
++   *value = (utime_t)total;
+    return 1;
+ }
+@@ -195,32 +245,33 @@
+  */
+ char *edit_utime(utime_t val, char *buf)
+ {
+-   char mybuf[30];
++   char mybuf[200];
+    static const int32_t mult[] = {60*60*24*365, 60*60*24*30, 60*60*24, 60*60, 60};
+    static const char *mod[]  = {"year",  "month",  "day", "hour", "min"};
+    int i;
+    uint32_t times;
++   int buf_len = 50;
+    *buf = 0;
+    for (i=0; i<5; i++) {
+       times = (uint32_t)(val / mult[i]);
+       if (times > 0) {
+        val = val - (utime_t)times * mult[i];
+-         sprintf(mybuf, "%d %s%s ", times, mod[i], times>1?"s":"");
+-       strcat(buf, mybuf);
++         bsnprintf(mybuf, sizeof(mybuf), "%d %s%s ", times, mod[i], times>1?"s":"");
++       bstrncat(buf, mybuf, buf_len);
+       }
+    }
+    if (val == 0 && strlen(buf) == 0) {           
+-      strcat(buf, "0 secs");
++      bstrncat(buf, "0 secs", buf_len);
+    } else if (val != 0) {
+-      sprintf(mybuf, "%d sec%s", (uint32_t)val, val>1?"s":"");
+-      strcat(buf, mybuf);
++      bsnprintf(mybuf, sizeof(mybuf), "%d sec%s", (uint32_t)val, val>1?"s":"");
++      bstrncat(buf, mybuf, buf_len);
+    }
+    return buf;
+ }
+ /*
+- * Convert a size size in bytes to uint64_t
++ * Convert a size in bytes to uint64_t
+  * Returns 0: if error
+          1: if OK, and value stored in value
+  */
+@@ -229,6 +280,7 @@
+    int i, mod_len;
+    double val;
+    char mod_str[20];
++   char num_str[50];
+    static const char *mod[]  = {"*", "k", "kb", "m", "mb",  "g", "gb",  NULL}; /* first item * not used */
+    const int64_t mult[] = {1,           /* byte */
+                          1024,          /* kilobyte */
+@@ -238,7 +290,7 @@
+                          1073741824,    /* gigabyte */
+                          1000000000};   /* gb gigabyte */
+-   if (!get_modifier(str, mod_str, sizeof(mod_str))) {
++   if (!get_modifier(str, num_str, sizeof(num_str), mod_str, sizeof(mod_str))) {
+       return 0;
+    }
+    /* Now find the multiplier corresponding to the modifier */
+@@ -251,9 +303,9 @@
+    if (mod[i] == NULL) {
+       i = 0;                        /* no modifier found, assume 1 */
+    }
+-   Dmsg2(200, "str=%s: mult=%d\n", str, mult[i]);
++   Dmsg2(900, "str=%s: mult=%d\n", str, mult[i]);
+    errno = 0;
+-   val = strtod(str, NULL);
++   val = strtod(num_str, NULL);
+    if (errno != 0 || val < 0) {
+       return 0;
+    }
+@@ -265,7 +317,7 @@
+  * Check if specified string is a number or not.
+  *  Taken from SQLite, cool, thanks.
+  */
+-int is_a_number(const char *n)
++bool is_a_number(const char *n)
+ {
+    bool digit_seen = false;
+@@ -291,7 +343,7 @@
+ /*
+  * Check if the specified string is an integer         
+  */
+-int is_an_integer(const char *n)
++bool is_an_integer(const char *n)
+ {
+    bool digit_seen = false;
+    while (B_ISDIGIT(*n)) {
+Index: src/lib/protos.h
+===================================================================
+RCS file: /cvsroot/bacula/bacula/src/lib/protos.h,v
+retrieving revision 1.77
+diff -u -r1.77 protos.h
+--- src/lib/protos.h   12 Jun 2004 07:51:26 -0000      1.77
++++ src/lib/protos.h   5 Aug 2004 19:58:54 -0000
+@@ -26,99 +26,99 @@
+ struct JCR;
+ /* attr.c */
+-ATTR     *new_attr();
+-void      free_attr(ATTR *attr);
+-int       unpack_attributes_record(JCR *jcr, int32_t stream, char *rec, ATTR *attr);
+-void      build_attr_output_fnames(JCR *jcr, ATTR *attr);
+-void      print_ls_output(JCR *jcr, ATTR *attr);
++ATTR   *new_attr();
++void    free_attr(ATTR *attr);
++int     unpack_attributes_record(JCR *jcr, int32_t stream, char *rec, ATTR *attr);
++void    build_attr_output_fnames(JCR *jcr, ATTR *attr);
++void    print_ls_output(JCR *jcr, ATTR *attr);
+ /* base64.c */
+-void      base64_init            (void);
+-int       to_base64              (intmax_t value, char *where);
+-int       from_base64            (intmax_t *value, char *where);
+-int       bin_to_base64          (char *buf, char *bin, int len);
++void    base64_init            (void);
++int     to_base64              (intmax_t value, char *where);
++int     from_base64            (intmax_t *value, char *where);
++int     bin_to_base64          (char *buf, char *bin, int len);
+ /* bsys.c */
+-char     *bstrncpy               (char *dest, const char *src, int maxlen);
+-char     *bstrncat               (char *dest, const char *src, int maxlen);
+-void     *b_malloc               (const char *file, int line, size_t size);
++char   *bstrncpy               (char *dest, const char *src, int maxlen);
++char   *bstrncat               (char *dest, const char *src, int maxlen);
++void   *b_malloc               (const char *file, int line, size_t size);
+ #ifndef DEBUG
+-void     *bmalloc                (size_t size);
++void   *bmalloc                (size_t size);
+ #endif
+-void     *brealloc               (void *buf, size_t size);
+-void     *bcalloc                (size_t size1, size_t size2);
+-int       bsnprintf              (char *str, int32_t size, const char *format, ...);
+-int       bvsnprintf             (char *str, int32_t size, const char *format, va_list ap);
+-int       pool_sprintf           (char *pool_buf, const char *fmt, ...);
+-void      create_pid_file        (char *dir, const char *progname, int port);
+-int       delete_pid_file        (char *dir, const char *progname, int port);
+-void      drop                   (char *uid, char *gid);
+-int       bmicrosleep            (time_t sec, long usec);
+-char     *bfgets                 (char *s, int size, FILE *fd);
+-void      make_unique_filename   (POOLMEM **name, int Id, char *what);
++void   *brealloc               (void *buf, size_t size);
++void   *bcalloc                (size_t size1, size_t size2);
++int     bsnprintf              (char *str, int32_t size, const char *format, ...);
++int     bvsnprintf             (char *str, int32_t size, const char *format, va_list ap);
++int     pool_sprintf           (char *pool_buf, const char *fmt, ...);
++void    create_pid_file        (char *dir, const char *progname, int port);
++int     delete_pid_file        (char *dir, const char *progname, int port);
++void    drop                   (char *uid, char *gid);
++int     bmicrosleep            (time_t sec, long usec);
++char   *bfgets                 (char *s, int size, FILE *fd);
++void    make_unique_filename   (POOLMEM **name, int Id, char *what);
+ #ifndef HAVE_STRTOLL
+-long long int strtoll            (const char *ptr, char **endptr, int base);
++long long int strtoll          (const char *ptr, char **endptr, int base);
+ #endif
+ void read_state_file(char *dir, const char *progname, int port);
+ /* bnet.c */
+-int32_t    bnet_recv             (BSOCK *bsock);
+-int        bnet_send             (BSOCK *bsock);
+-int        bnet_fsend            (BSOCK *bs, const char *fmt, ...);
+-int        bnet_set_buffer_size  (BSOCK *bs, uint32_t size, int rw);
+-int        bnet_sig              (BSOCK *bs, int sig);
+-int        bnet_ssl_server       (BSOCK *bsock, char *password, int ssl_need, int ssl_has);
+-int        bnet_ssl_client       (BSOCK *bsock, char *password, int ssl_need);
+-BSOCK *    bnet_connect            (JCR *jcr, int retry_interval,
+-               int max_retry_time, const char *name, char *host, char *service, 
+-               int port, int verbose);
+-void       bnet_close            (BSOCK *bsock);
+-BSOCK *    init_bsock            (JCR *jcr, int sockfd, const char *who, char *ip, 
+-                                  int port, struct sockaddr_in *client_addr);
+-BSOCK *    dup_bsock             (BSOCK *bsock);
+-void       term_bsock            (BSOCK *bsock);
+-char *     bnet_strerror         (BSOCK *bsock);
+-char *     bnet_sig_to_ascii     (BSOCK *bsock);
+-int        bnet_wait_data        (BSOCK *bsock, int sec);
+-int        bnet_wait_data_intr   (BSOCK *bsock, int sec);
+-int        bnet_despool_to_bsock (BSOCK *bsock, void update(ssize_t size), ssize_t size);
+-int        is_bnet_stop          (BSOCK *bsock);
+-int        is_bnet_error         (BSOCK *bsock);
+-void       bnet_suppress_error_messages(BSOCK *bsock, bool flag);
++int32_t    bnet_recv           (BSOCK *bsock);
++int      bnet_send             (BSOCK *bsock);
++int      bnet_fsend            (BSOCK *bs, const char *fmt, ...);
++int      bnet_set_buffer_size  (BSOCK *bs, uint32_t size, int rw);
++int      bnet_sig              (BSOCK *bs, int sig);
++int      bnet_ssl_server       (BSOCK *bsock, char *password, int ssl_need, int ssl_has);
++int      bnet_ssl_client       (BSOCK *bsock, char *password, int ssl_need);
++BSOCK *    bnet_connect          (JCR *jcr, int retry_interval,
++             int max_retry_time, const char *name, char *host, char *service, 
++             int port, int verbose);
++void     bnet_close            (BSOCK *bsock);
++BSOCK *    init_bsock          (JCR *jcr, int sockfd, const char *who, char *ip, 
++                                int port, struct sockaddr_in *client_addr);
++BSOCK *    dup_bsock           (BSOCK *bsock);
++void     term_bsock            (BSOCK *bsock);
++char *           bnet_strerror         (BSOCK *bsock);
++char *           bnet_sig_to_ascii     (BSOCK *bsock);
++int      bnet_wait_data        (BSOCK *bsock, int sec);
++int      bnet_wait_data_intr   (BSOCK *bsock, int sec);
++int      bnet_despool_to_bsock (BSOCK *bsock, void update(ssize_t size), ssize_t size);
++int      is_bnet_stop          (BSOCK *bsock);
++int      is_bnet_error         (BSOCK *bsock);
++void     bnet_suppress_error_messages(BSOCK *bsock, bool flag);
+ /* bget_msg.c */
+-int      bget_msg(BSOCK *sock);
++int    bget_msg(BSOCK *sock);
+ /* bpipe.c */
+-BPIPE *          open_bpipe(char *prog, int wait, const char *mode);
+-int              close_wpipe(BPIPE *bpipe);
+-int              close_bpipe(BPIPE *bpipe);
++BPIPE *        open_bpipe(char *prog, int wait, const char *mode);
++int            close_wpipe(BPIPE *bpipe);
++int            close_bpipe(BPIPE *bpipe);
+ /* cram-md5.c */
+ int cram_md5_get_auth(BSOCK *bs, char *password, int ssl_need);
+ int cram_md5_auth(BSOCK *bs, char *password, int ssl_need);
+ void hmac_md5(uint8_t* text, int text_len, uint8_t*  key,
+-              int key_len, uint8_t *hmac);
++            int key_len, uint8_t *hmac);
+ /* crc32.c */
+ uint32_t bcrc32(uint8_t *buf, int len);
+ /* daemon.c */
+-void     daemon_start            ();
++void   daemon_start            ();
+ /* edit.c */
+-uint64_t         str_to_uint64(char *str);
+-int64_t          str_to_int64(char *str);
+-char *           edit_uint64_with_commas   (uint64_t val, char *buf);
+-char *           add_commas              (char *val, char *buf);
+-char *           edit_uint64             (uint64_t val, char *buf);
+-int              duration_to_utime       (char *str, utime_t *value);
+-int              size_to_uint64(char *str, int str_len, uint64_t *rtn_value);
+-char             *edit_utime             (utime_t val, char *buf);
+-int              is_a_number             (const char *num);
+-int              is_an_integer           (const char *n);
+-bool             is_name_valid           (char *name, POOLMEM **msg);
++uint64_t       str_to_uint64(char *str);
++int64_t        str_to_int64(char *str);
++char *                 edit_uint64_with_commas   (uint64_t val, char *buf);
++char *                 add_commas              (char *val, char *buf);
++char *                 edit_uint64             (uint64_t val, char *buf);
++int            duration_to_utime       (char *str, utime_t *value);
++int            size_to_uint64(char *str, int str_len, uint64_t *rtn_value);
++char           *edit_utime             (utime_t val, char *buf);
++bool           is_a_number             (const char *num);
++bool           is_an_integer           (const char *n);
++bool           is_name_valid           (char *name, POOLMEM **msg);
+ /* jcr.c (most definitions are in src/jcr.h) */
+ void init_last_jobs_list();
+@@ -132,36 +132,36 @@
+ /* lex.c */
+-LEX *     lex_close_file         (LEX *lf);
+-LEX *     lex_open_file          (LEX *lf, const char *fname, LEX_ERROR_HANDLER *scan_error);
+-int       lex_get_char           (LEX *lf);
+-void      lex_unget_char         (LEX *lf);
+-const char *  lex_tok_to_str     (int token);
+-int       lex_get_token          (LEX *lf, int expect);
++LEX *   lex_close_file         (LEX *lf);
++LEX *   lex_open_file          (LEX *lf, const char *fname, LEX_ERROR_HANDLER *scan_error);
++int     lex_get_char           (LEX *lf);
++void    lex_unget_char         (LEX *lf);
++const char *  lex_tok_to_str   (int token);
++int     lex_get_token          (LEX *lf, int expect);
+ /* message.c */
+-void       my_name_is            (int argc, char *argv[], const char *name);
+-void       init_msg              (JCR *jcr, MSGS *msg);
+-void       term_msg              (void);
+-void       close_msg             (JCR *jcr);
+-void       add_msg_dest          (MSGS *msg, int dest, int type, char *where, char *dest_code);
+-void       rem_msg_dest          (MSGS *msg, int dest, int type, char *where);
+-void       Jmsg                  (JCR *jcr, int type, int level, const char *fmt, ...);
+-void       dispatch_message      (JCR *jcr, int type, int level, char *buf);
+-void       init_console_msg      (char *wd);
+-void       free_msgs_res         (MSGS *msgs);
+-void       dequeue_messages      (JCR *jcr);
+-void       set_trace             (int trace_flag);
+-void       set_exit_on_error     (int value);
++void     my_name_is            (int argc, char *argv[], const char *name);
++void     init_msg              (JCR *jcr, MSGS *msg);
++void     term_msg              (void);
++void     close_msg             (JCR *jcr);
++void     add_msg_dest          (MSGS *msg, int dest, int type, char *where, char *dest_code);
++void     rem_msg_dest          (MSGS *msg, int dest, int type, char *where);
++void     Jmsg                  (JCR *jcr, int type, int level, const char *fmt, ...);
++void     dispatch_message      (JCR *jcr, int type, int level, char *buf);
++void     init_console_msg      (char *wd);
++void     free_msgs_res         (MSGS *msgs);
++void     dequeue_messages      (JCR *jcr);
++void     set_trace             (int trace_flag);
++void     set_exit_on_error     (int value);
+ /* bnet_server.c */
+-void       bnet_thread_server(char *bind_addr, int port, int max_clients, workq_t *client_wq, 
+-                   void *handle_client_request(void *bsock));
+-void       bnet_stop_thread_server(pthread_t tid);
+-void             bnet_server             (int port, void handle_client_request(BSOCK *bsock));
+-int              net_connect             (int port);
+-BSOCK *          bnet_bind               (int port);
+-BSOCK *          bnet_accept             (BSOCK *bsock, char *who);
++void     bnet_thread_server(char *bind_addr, int port, int max_clients, workq_t *client_wq, 
++                 void *handle_client_request(void *bsock));
++void     bnet_stop_thread_server(pthread_t tid);
++void           bnet_server             (int port, void handle_client_request(BSOCK *bsock));
++int            net_connect             (int port);
++BSOCK *        bnet_bind               (int port);
++BSOCK *        bnet_accept             (BSOCK *bsock, char *who);
+ /* idcache.c */
+ char *getuser(uid_t uid);
+@@ -171,41 +171,41 @@
+ /* signal.c */
+-void             init_signals             (void terminate(int sig));
+-void             init_stack_dump          (void);
++void           init_signals             (void terminate(int sig));
++void           init_stack_dump          (void);
+ /* scan.c */
+-void             strip_trailing_junk     (char *str);
+-void             strip_trailing_slashes  (char *dir);
+-bool             skip_spaces             (char **msg);
+-bool             skip_nonspaces          (char **msg);
+-int              fstrsch                 (char *a, char *b);
+-char            *next_arg(char **s);
+-int              parse_args(POOLMEM *cmd, POOLMEM **args, int *argc, 
+-                        char **argk, char **argv, int max_args);
+-void            split_path_and_filename(const char *fname, POOLMEM **path, 
+-                        int *pnl, POOLMEM **file, int *fnl);
+-int             bsscanf(const char *buf, const char *fmt, ...);
++void           strip_trailing_junk     (char *str);
++void           strip_trailing_slashes  (char *dir);
++bool           skip_spaces             (char **msg);
++bool           skip_nonspaces          (char **msg);
++int            fstrsch                 (char *a, char *b);
++char          *next_arg(char **s);
++int            parse_args(POOLMEM *cmd, POOLMEM **args, int *argc, 
++                      char **argk, char **argv, int max_args);
++void          split_path_and_filename(const char *fname, POOLMEM **path, 
++                      int *pnl, POOLMEM **file, int *fnl);
++int           bsscanf(const char *buf, const char *fmt, ...);
+ /* util.c */
+-int              is_buf_zero             (char *buf, int len);
+-void             lcase                   (char *str);
+-void             bash_spaces             (char *str);
+-void             unbash_spaces           (char *str);
+-char *           encode_time             (time_t time, char *buf);
+-char *           encode_mode             (mode_t mode, char *buf);
+-int              do_shell_expansion      (char *name, int name_len);
+-void             jobstatus_to_ascii      (int JobStatus, char *msg, int maxlen);
+-int              pm_strcat               (POOLMEM **pm, const char *str);
+-int              pm_strcpy               (POOLMEM **pm, const char *str);
+-int              run_program             (char *prog, int wait, POOLMEM *results);
+-char *           job_type_to_str         (int type);
+-char *           job_status_to_str       (int stat);
+-char *           job_level_to_str        (int level);
+-void             make_session_key        (char *key, char *seed, int mode);
+-POOLMEM         *edit_job_codes(JCR *jcr, char *omsg, char *imsg, const char *to);
+-void             set_working_directory(char *wd);
++int            is_buf_zero             (char *buf, int len);
++void           lcase                   (char *str);
++void           bash_spaces             (char *str);
++void           unbash_spaces           (char *str);
++char *                 encode_time             (time_t time, char *buf);
++char *                 encode_mode             (mode_t mode, char *buf);
++int            do_shell_expansion      (char *name, int name_len);
++void           jobstatus_to_ascii      (int JobStatus, char *msg, int maxlen);
++int            pm_strcat               (POOLMEM **pm, const char *str);
++int            pm_strcpy               (POOLMEM **pm, const char *str);
++int            run_program             (char *prog, int wait, POOLMEM *results);
++char *                 job_type_to_str         (int type);
++char *                 job_status_to_str       (int stat);
++char *                 job_level_to_str        (int level);
++void           make_session_key        (char *key, char *seed, int mode);
++POOLMEM       *edit_job_codes(JCR *jcr, char *omsg, char *imsg, const char *to);
++void           set_working_directory(char *wd);
+ /* watchdog.c */
diff --git a/bacula/patches/1.34.6/1.34.6-find.patch b/bacula/patches/1.34.6/1.34.6-find.patch
new file mode 100644 (file)
index 0000000..8acd2e3
--- /dev/null
@@ -0,0 +1,48 @@
+
+ This patch fixes a problem where the Options are not properly passed
+ from the last Option group to the NULL option group -- i.e. some of
+ the files do not get the correct options.
+
+ Apply to Bacula 1.34.6 with:
+ cd <bacula-source>
+ patch -p0 <1.34.6-find.patch
+ make
+ ...
+
+Index: src/findlib/find.c
+===================================================================
+RCS file: /cvsroot/bacula/bacula/src/findlib/find.c,v
+retrieving revision 1.18
+diff -u -r1.18 find.c
+--- src/findlib/find.c 9 Jun 2004 11:52:24 -0000       1.18
++++ src/findlib/find.c 6 Aug 2004 13:25:52 -0000
+@@ -160,10 +160,10 @@
+    for (j=0; j<incexe->opts_list.size(); j++) {
+       findFOPTS *fo = (findFOPTS *)incexe->opts_list.get(j);
++      ff->flags = fo->flags;
++      ff->GZIP_level = fo->GZIP_level;
+       for (k=0; k<fo->wild.size(); k++) {
+        if (fnmatch((char *)fo->wild.get(k), ff->fname, 0) == 0) {
+-          ff->flags = fo->flags;
+-          ff->GZIP_level = fo->GZIP_level;
+           if (ff->flags & FO_EXCLUDE) {
+              return false;          /* reject file */
+           }
+@@ -205,7 +205,6 @@
+    case FT_NOFOLLOW:
+    case FT_NOSTAT:
+    case FT_NOCHG:
+-   case FT_DIRNOCHG:
+    case FT_ISARCH:
+    case FT_NORECURSE:
+    case FT_NOFSCHG:
+@@ -222,6 +221,7 @@
+    case FT_RAW:
+    case FT_FIFO:
+    case FT_SPEC:
++   case FT_DIRNOCHG:
+       if (accept_file(ff)) {
+        return ff->callback(ff, hpkt);
+       } else {
diff --git a/bacula/patches/1.34.6/1.34.6-gnome-console-Makefile.in.patch b/bacula/patches/1.34.6/1.34.6-gnome-console-Makefile.in.patch
new file mode 100644 (file)
index 0000000..aec11b2
--- /dev/null
@@ -0,0 +1,25 @@
+--- Makefile.in        2004-07-29 15:29:56.000000000 -0400
++++ gnome-console-Makefile.in  2004-08-01 14:22:04.000000000 -0400
+@@ -12,7 +12,7 @@
+ # top dir
+ topdir = ../..
+ # this dir relative to top dir
+-thisdir = src/gnome2-console
++thisdir = src/gnome-console
+ DEBUG=@DEBUG@
+@@ -26,10 +26,9 @@
+ #
+-CONSSRCS = console.c console_conf.c authenticate.c support.c interface.c callbacks.c \
+-         restore.c
+-CONSOBJS = console.o console_conf.o authenticate.o support.o interface.o callbacks.o \
+-         restore.o
++CONSSRCS = console.c console_conf.c authenticate.c support.c interface.c callbacks.c
++
++CONSOBJS = console.o console_conf.o authenticate.o support.o interface.o callbacks.o 
+ # these are the objects that are changed by the .configure process
+ EXTRAOBJS = @OBJLIST@
diff --git a/bacula/patches/1.34.6/1.34.6-poll.patch b/bacula/patches/1.34.6/1.34.6-poll.patch
new file mode 100644 (file)
index 0000000..846c08f
--- /dev/null
@@ -0,0 +1,64 @@
+
+This patch fixes two bugs:
+1. It ignores an device open failure if polling.
+2. It disables the insanity check on reading the 
+   tape label while polling. Normally the check
+   doesn't allow the label to be read more than 100
+   times.
+
+Apply the patch to version 1.34.6 (possibly earlier versions) with:
+
+ cd <bacula-source>
+ patch -p0 <1.34.6-poll.patch
+ make
+ ...
+
+Index: src/stored/label.c
+===================================================================
+RCS file: /cvsroot/bacula/bacula/src/stored/label.c,v
+retrieving revision 1.42.2.1
+diff -u -r1.42.2.1 label.c
+--- src/stored/label.c 20 Jun 2004 11:43:04 -0000      1.42.2.1
++++ src/stored/label.c 2 Sep 2004 12:21:00 -0000
+@@ -74,8 +74,8 @@
+         * Cancel Job if too many label errors
+         *  => we are in a loop
+         */
+-       if (jcr->label_errors++ > 100) {
+-            Jmsg(jcr, M_FATAL, 0, "%s", jcr->errmsg);
++       if (!dev->poll && jcr->label_errors++ > 100) {
++            Jmsg(jcr, M_FATAL, 0, "Too many tries: %s", jcr->errmsg);
+        }
+        return jcr->label_status = VOL_NAME_ERROR;
+       }
+@@ -157,8 +157,8 @@
+        * Cancel Job if too many label errors
+        *  => we are in a loop
+        */
+-      if (jcr->label_errors++ > 100) {
+-         Jmsg(jcr, M_FATAL, 0, "%s", jcr->errmsg);
++      if (!dev->poll && jcr->label_errors++ > 100) {
++         Jmsg(jcr, M_FATAL, 0, "Too many tries: %s", jcr->errmsg);
+       }
+       return jcr->label_status = VOL_NAME_ERROR;
+    }
+Index: src/stored/mount.c
+===================================================================
+RCS file: /cvsroot/bacula/bacula/src/stored/mount.c,v
+retrieving revision 1.59.2.1
+diff -u -r1.59.2.1 mount.c
+--- src/stored/mount.c 20 Jun 2004 11:43:04 -0000      1.59.2.1
++++ src/stored/mount.c 2 Sep 2004 12:21:00 -0000
+@@ -154,7 +154,11 @@
+    /* Ensure the device is open */
+    if (!open_device(jcr, dev)) {
+-      return 0;
++      if (dev->poll) {
++       goto mount_next_vol;
++      } else {
++       return 0;
++      }
+    }
+    /*
diff --git a/bacula/patches/1.34.6/1.34.6-pool.patch b/bacula/patches/1.34.6/1.34.6-pool.patch
new file mode 100644 (file)
index 0000000..ba6521a
--- /dev/null
@@ -0,0 +1,58 @@
+
+ This patch fixes a bug where Inc, Diff, and Full Pool overrides
+ would incorrectly override a Pool= on the Run card. The patch
+ also includes the Pool actually used in the Job Report.
+
+ Apply the patch to version 1.34.6 with:
+
+ cd <bacula-source>
+ patch -p0 <1.34.6-pool.patch
+ make
+ ...
+
+Index: src/dird/scheduler.c
+===================================================================
+RCS file: /cvsroot/bacula/bacula/src/dird/scheduler.c,v
+retrieving revision 1.24
+diff -u -r1.24 scheduler.c
+--- src/dird/scheduler.c       13 Mar 2004 09:30:10 -0000      1.24
++++ src/dird/scheduler.c       11 Aug 2004 07:38:51 -0000
+@@ -147,15 +147,6 @@
+    if (run->pool) {
+       jcr->pool = run->pool;        /* override pool */
+    }
+-   if (run->full_pool) {
+-      jcr->pool = run->full_pool;     /* override full pool */
+-   }
+-   if (run->inc_pool) {
+-      jcr->pool = run->inc_pool;      /* override inc pool */
+-   }
+-   if (run->dif_pool) {
+-      jcr->pool = run->dif_pool;      /* override dif pool */
+-   }
+    if (run->storage) {
+       jcr->store = run->storage;      /* override storage */
+    }
+Index: src/dird/backup.c
+===================================================================
+RCS file: /cvsroot/bacula/bacula/src/dird/backup.c,v
+retrieving revision 1.65
+diff -u -r1.65 backup.c
+--- src/dird/backup.c  19 Apr 2004 14:27:00 -0000      1.65
++++ src/dird/backup.c  11 Aug 2004 07:38:52 -0000
+@@ -468,6 +468,7 @@
+ Backup Level:           %s%s\n\
+ Client:                 %s\n\
+ FileSet:                \"%s\" %s\n\
++Pool:                   \"%s\"\n\
+ Start time:             %s\n\
+ End time:               %s\n\
+ FD Files Written:       %s\n\
+@@ -491,6 +492,7 @@
+       level_to_str(jcr->JobLevel), since,
+       jcr->client->hdr.name,
+       jcr->fileset->hdr.name, fsr->cCreateTime,
++      jcr->pool->hdr.name,
+       sdt,
+       edt,
+       edit_uint64_with_commas(jcr->jr.JobFiles, ec1),
diff --git a/bacula/patches/1.34.6/1.34.6-resched.patch b/bacula/patches/1.34.6/1.34.6-resched.patch
new file mode 100644 (file)
index 0000000..9e8a448
--- /dev/null
@@ -0,0 +1,65 @@
+
+ This patch fixes two bugs in the job queue scheduling:
+ 1. It clears the SD status when rescheduling a job so that
+    the correct status will be displayed by the Director.
+ 2. When starting a reschedule thread, it decrements the jcr
+    use_count so that the job will not become a zombie.
+
+ Apply it to 1.34.6 (possibly to earlier versions with):
+
+ cd <bacula-source>
+ patch -p0 <1.34.6-resched.patch
+ make
+ ...
+
+Index: src/dird/jobq.c
+===================================================================
+RCS file: /cvsroot/bacula/bacula/src/dird/jobq.c,v
+retrieving revision 1.19
+diff -u -r1.19 jobq.c
+--- src/dird/jobq.c    1 Jun 2004 20:10:04 -0000       1.19
++++ src/dird/jobq.c    1 Sep 2004 17:22:51 -0000
+@@ -160,11 +160,11 @@
+    Dmsg0(300, "Enter sched_wait.\n");
+    free(arg);
+    time_t wtime = jcr->sched_time - time(NULL);
++   set_jcr_job_status(jcr, JS_WaitStartTime);
+    /* Wait until scheduled time arrives */
+    if (wtime > 0 && verbose) {
+       Jmsg(jcr, M_INFO, 0, _("Job %s waiting %d seconds for scheduled start time.\n"), 
+        jcr->Job, wtime);
+-      set_jcr_job_status(jcr, JS_WaitStartTime);
+    }
+    /* Check every 30 seconds if canceled */ 
+    while (wtime > 0) {
+@@ -217,10 +217,10 @@
+       sched_pkt = (wait_pkt *)malloc(sizeof(wait_pkt));
+       sched_pkt->jcr = jcr;
+       sched_pkt->jq = jq;
++      jcr->use_count--;          /* release our use of jcr */
+       stat = pthread_create(&id, &jq->attr, sched_wait, (void *)sched_pkt);      
+       if (stat != 0) {                      /* thread not created */
+          Jmsg1(jcr, M_ERROR, 0, "pthread_thread_create: ERR=%s\n", strerror(stat));
+-       jcr->use_count--;            /* release jcr */
+       }
+       return stat;
+    }
+@@ -465,6 +465,7 @@
+             Dmsg2(300, "Rescheduled Job %s to re-run in %d seconds.\n", jcr->Job,
+              (int)jcr->job->RescheduleInterval);
+           jcr->JobStatus = JS_Created; /* force new status */
++          jcr->SDJobStatus = 0;
+           dird_free_jcr(jcr);          /* partial cleanup old stuff */
+           if (jcr->JobBytes == 0) {
+                Dmsg1(300, "Requeue job=%d\n", jcr->JobId);
+@@ -501,8 +502,10 @@
+           jcr->db = NULL;
+        }
+          Dmsg1(300, "====== Termination job=%d\n", jcr->JobId);
++       V(jq->mutex);                /* release internal job queue lock */
+        free_jcr(jcr);
+        free(je);                    /* release job entry */
++       P(jq->mutex);                /* acquire internal job queue lock */
+       }
+       /*
+        * If any job in the wait queue can be run,
diff --git a/bacula/patches/1.34.6/1.34.6-slots.patch b/bacula/patches/1.34.6/1.34.6-slots.patch
new file mode 100644 (file)
index 0000000..31c21e5
--- /dev/null
@@ -0,0 +1,25 @@
+
+ This patch eliminates unwanted output (some 5000 lines) when doing
+ an "update slots" command.
+ Apply to version 1.34.6 with:
+
+ cd <bacula-source>
+ patch -p0 <1.34.6-slots.patch
+ make
+ ...
+
+Index: src/dird/ua_label.c
+===================================================================
+RCS file: /cvsroot/bacula/bacula/src/dird/ua_label.c,v
+retrieving revision 1.34
+diff -u -r1.34 ua_label.c
+--- src/dird/ua_label.c        10 Jun 2004 13:08:01 -0000      1.34
++++ src/dird/ua_label.c        5 Aug 2004 20:05:27 -0000
+@@ -255,7 +255,6 @@
+        db_lock(ua->db);
+        db_make_inchanger_unique(ua->jcr, ua->db, &mr);
+        db_unlock(ua->db);
+-         bsendmsg(ua, _("No VolName for Slot=%d set InChanger to zero.\n"), i);
+       }
+    }
+