From 5ec2ac1ba02d3e6822487ad2248d8be07dac26ae Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Fri, 19 Oct 2007 10:07:03 +0000 Subject: [PATCH] kes Make explicit exception to GPL in LICENSE to permit linking the Win32 FD with Microsoft VSS code. kes Apply the Solaris package patch from Masopust, Christian kes Apply the patch to optionally add a timestamp in the debug output submitted by Mariusz Czulada git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@5769 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/LICENSE | 8 +++ bacula/kernstodo | 13 ++++ bacula/platforms/solaris/bacula-dir.in | 6 -- bacula/platforms/solaris/bacula-fd.in | 6 -- bacula/platforms/solaris/bacula-sd.in | 6 -- bacula/platforms/solaris/copyright | 28 ++++++++ bacula/platforms/solaris/makepkg.sh | 82 ++++++++++++++++++++++ bacula/platforms/solaris/pkginfo | 12 ++++ bacula/platforms/solaris/postinstall | 9 +++ bacula/platforms/solaris/postremove | 9 +++ bacula/platforms/solaris/prototype.master | 24 +++++++ bacula/src/cats/bdb.c | 4 +- bacula/src/cats/mysql.c | 6 +- bacula/src/cats/postgresql.c | 6 +- bacula/src/cats/protos.h | 2 +- bacula/src/cats/sql_create.c | 16 ++--- bacula/src/cats/sqlite.c | 6 +- bacula/src/console/console.c | 13 ++-- bacula/src/dird/dird.c | 13 ++-- bacula/src/dird/getmsg.c | 2 +- bacula/src/dird/ua_run.c | 5 +- bacula/src/filed/filed.c | 13 ++-- bacula/src/lib/message.c | 13 +++- bacula/src/lib/message.h | 1 + bacula/src/stored/bcopy.c | 14 ++-- bacula/src/stored/bextract.c | 14 ++-- bacula/src/stored/bls.c | 14 ++-- bacula/src/stored/bscan.c | 14 ++-- bacula/src/stored/btape.c | 13 ++-- bacula/src/stored/stored.c | 13 ++-- bacula/src/tools/bbatch.c | 14 ++-- bacula/src/tools/bregex.c | 12 +++- bacula/src/tools/bregtest.c | 12 +++- bacula/src/tools/bsmtp.c | 13 ++-- bacula/src/tools/dbcheck.c | 14 ++-- bacula/src/tools/testfind.c | 7 +- bacula/src/tools/testls.c | 13 ++-- bacula/src/tray-monitor/eggmarshalers.list | 17 ----- bacula/src/tray-monitor/tray-monitor.c | 13 ++-- bacula/src/version.h | 4 +- bacula/technotes-2.3 | 15 +++- 41 files changed, 393 insertions(+), 126 deletions(-) create mode 100644 bacula/platforms/solaris/copyright create mode 100644 bacula/platforms/solaris/makepkg.sh create mode 100644 bacula/platforms/solaris/pkginfo create mode 100644 bacula/platforms/solaris/postinstall create mode 100644 bacula/platforms/solaris/postremove create mode 100644 bacula/platforms/solaris/prototype.master delete mode 100644 bacula/src/tray-monitor/eggmarshalers.list diff --git a/bacula/LICENSE b/bacula/LICENSE index d9b5fd4fb3..751103f54a 100644 --- a/bacula/LICENSE +++ b/bacula/LICENSE @@ -23,6 +23,14 @@ project's "OpenSSL" library (or with modified versions of it that use the same license as the "OpenSSL" library), and distribute the linked executables. You must obey the GNU General Public License in all respects for all of the code used other than "OpenSSL". + +As a special exception to the GPLv2, the Bacula Project gives +permission to link the code of its release of the Bacula Win32 File +daemon with the Microsoft supplied Volume Shadow Copy (VSS) libraries +and distribute the linked executables. You must obey the GNU General +Public License in all respects for all of the code used other than for +the Microsoft VSS code, where you must obey their license terms. + =================================== diff --git a/bacula/kernstodo b/bacula/kernstodo index 7a1c1ee607..db0218fc73 100644 --- a/bacula/kernstodo +++ b/bacula/kernstodo @@ -69,6 +69,19 @@ Professional Needs: - Implement Diff,Inc Retention Periods Priority: +- Encrypt sd_auth_key = s with director's key = d + k[i] = s[i] + (d[i] & 0xF)) & 0xFF + 'A' skip - + Decrypt key = k with director's key + x = k[i] - (d[i] & 0xF)) + if (x < 0) { + x = k[i] - (d[i] & 0xF) + 16 + } + s[i] = x + 'A'; +- finish implementation of fdcalled -- see ua_run.c:105 +- Fix problem in postgresql.c in my_postgresql_query, where the + generation of the error message doesn't differentiate result==NULL + and a bad status from that result. Not only that, the result is + cleared on a bail_out without having generated the error message. - Erabt if min_block_size > max_block_size - KIWI - Implement wait on multiple objects diff --git a/bacula/platforms/solaris/bacula-dir.in b/bacula/platforms/solaris/bacula-dir.in index 0346dafcc2..0563e44c0d 100755 --- a/bacula/platforms/solaris/bacula-dir.in +++ b/bacula/platforms/solaris/bacula-dir.in @@ -14,16 +14,10 @@ case "$1" in start) echo "Starting the Bacula Director: " @sbindir@/bacula-dir $2 -c @sysconfdir@/bacula-dir.conf - RETVAL=$? - echo - [ $RETVAL -eq 0 ] && touch @subsysdir@/bacula-dir ;; stop) echo "Stopping the Director daemon: " pkill -x bacula-dir - RETVAL=$? - echo - [ $RETVAL -eq 0 ] && rm -f @subsysdir@/bacula-dir ;; restart) $0 stop diff --git a/bacula/platforms/solaris/bacula-fd.in b/bacula/platforms/solaris/bacula-fd.in index 31dbbad476..018dfe48d4 100755 --- a/bacula/platforms/solaris/bacula-fd.in +++ b/bacula/platforms/solaris/bacula-fd.in @@ -13,16 +13,10 @@ case "$1" in start) echo "Starting the Bacula File daemon: " @sbindir@/bacula-fd $2 -c @sysconfdir@/bacula-fd.conf - RETVAL=$? - echo - [ $RETVAL -eq 0 ] && touch @subsysdir@/bacula-fd ;; stop) echo "Stopping the Bacula File daemon: " pkill -x bacula-fd - RETVAL=$? - echo - [ $RETVAL -eq 0 ] && rm -f @subsysdir@/bacula-fd ;; restart) $0 stop diff --git a/bacula/platforms/solaris/bacula-sd.in b/bacula/platforms/solaris/bacula-sd.in index 37230ff971..9544f4918d 100755 --- a/bacula/platforms/solaris/bacula-sd.in +++ b/bacula/platforms/solaris/bacula-sd.in @@ -13,16 +13,10 @@ case "$1" in start) echo "Starting the Bacula Storage daemon: " @sbindir@/bacula-sd $2 -c @sysconfdir@/bacula-sd.conf - RETVAL=$? - echo - [ $RETVAL -eq 0 ] && touch @subsysdir@/bacula-sd ;; stop) echo "Stopping the Bacula Storage daemon: " pkill -x bacula-sd - RETVAL=$? - echo - [ $RETVAL -eq 0 ] && rm -f @subsysdir@/bacula-sd ;; restart) $0 stop diff --git a/bacula/platforms/solaris/copyright b/bacula/platforms/solaris/copyright new file mode 100644 index 0000000000..1660acf753 --- /dev/null +++ b/bacula/platforms/solaris/copyright @@ -0,0 +1,28 @@ + + Bacula - The Network Backup Solution + + Copyright (C) 2000-2006 Free Software Foundation Europe e.V. + + The main author of Bacula is Kern Sibbald, with contributions from + many others, a complete list can be found in the file AUTHORS. + This program is Free Software; you can redistribute it and/or + modify it under the terms of version two of the GNU General Public + License as published by the Free Software Foundation, a copy of which + is in the LICENSE file + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. + + Bacula is a registered trademark of John Walker. + The licensor of Bacula is the Free Software Foundation Europe + (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 ZC prototype + +pkgproto $TMPINSTALLDIR/$INSTALL_BASE=. >> prototype + +pkgmk -o -d /tmp -b $TMPINSTALLDIR/$INSTALL_BASE -f prototype + +if [ $? = 0 ]; then + pkgtrans /tmp bacula-$VERSION.pkg Bacula + echo "Package has been created in /tmp" +fi + diff --git a/bacula/platforms/solaris/pkginfo b/bacula/platforms/solaris/pkginfo new file mode 100644 index 0000000000..006321361a --- /dev/null +++ b/bacula/platforms/solaris/pkginfo @@ -0,0 +1,12 @@ +PKG=Bacula +NAME=Bacula Client +ARCH=sparc +VERSION=2.2.5 +MAXINST=1 +CATEGORY=application +DESC=Bacula - It comes by night and sucks the essence from your computers +VENDOR=http://www.bacula.org +HOTLINE=none +EMAIL=christian.masopust@siemens.com +CLASSES=none +BASEDIR=/opt/bacula diff --git a/bacula/platforms/solaris/postinstall b/bacula/platforms/solaris/postinstall new file mode 100644 index 0000000000..c05972d4b0 --- /dev/null +++ b/bacula/platforms/solaris/postinstall @@ -0,0 +1,9 @@ +#!/bin/sh +# +# postinstall for Bacula +# +if [ ! -d /var/bacula ]; then + mkdir /var/bacula +fi + +exit 0 diff --git a/bacula/platforms/solaris/postremove b/bacula/platforms/solaris/postremove new file mode 100644 index 0000000000..ea142ec87c --- /dev/null +++ b/bacula/platforms/solaris/postremove @@ -0,0 +1,9 @@ +#!/bin/sh +# +# postremove for Bacula +# +if [ ! -d /var/bacula ]; then + rm -rf /var/bacula +fi + +exit 0 diff --git a/bacula/platforms/solaris/prototype.master b/bacula/platforms/solaris/prototype.master new file mode 100644 index 0000000000..7f5d76a7c4 --- /dev/null +++ b/bacula/platforms/solaris/prototype.master @@ -0,0 +1,24 @@ +# +# Information files +# +i pkginfo=./pkginfo +i copyright=./copyright +i postinstall=./postinstall +i postremove=./postremove +# +# Stuff that goes into the system areas +# +d none /etc ? ? ? +d none /etc/init.d ? ? ? +f none /etc/init.d/bacula=__PKGSOURCE__/bacula-fd 0754 root bin +d none /etc/rc2.d ? ? ? +s none /etc/rc2.d/S99bacula=/etc/init.d/bacula +d none /etc/rc0.d ? ? ? +s none /etc/rc0.d/K01bacula=/etc/init.d/bacula +# +d none /var ? ? ? +d none /var/bacula 0755 root root +# +# +# Dynamically added entries (by pkgproto) +# diff --git a/bacula/src/cats/bdb.c b/bacula/src/cats/bdb.c index d9862abab1..2a262f8075 100644 --- a/bacula/src/cats/bdb.c +++ b/bacula/src/cats/bdb.c @@ -318,9 +318,9 @@ char *db_strerror(B_DB *mdb) return mdb->errmsg; } -int db_sql_query(B_DB *mdb, char const *query, DB_RESULT_HANDLER *result_handler, void *ctx) +bool db_sql_query(B_DB *mdb, char const *query, DB_RESULT_HANDLER *result_handler, void *ctx) { - return 1; + return true; } /* diff --git a/bacula/src/cats/mysql.c b/bacula/src/cats/mysql.c index c0068b1b1d..8a2832b0ba 100644 --- a/bacula/src/cats/mysql.c +++ b/bacula/src/cats/mysql.c @@ -305,7 +305,7 @@ db_escape_string(JCR *jcr, B_DB *mdb, char *snew, char *old, int len) * Submit a general SQL command (cmd), and for each row returned, * the sqlite_handler is called with the ctx. */ -int db_sql_query(B_DB *mdb, const char *query, DB_RESULT_HANDLER *result_handler, void *ctx) +bool db_sql_query(B_DB *mdb, const char *query, DB_RESULT_HANDLER *result_handler, void *ctx) { SQL_ROW row; bool send = true; @@ -314,7 +314,7 @@ int db_sql_query(B_DB *mdb, const char *query, DB_RESULT_HANDLER *result_handler if (sql_query(mdb, query) != 0) { Mmsg(mdb->errmsg, _("Query failed: %s: ERR=%s\n"), query, sql_strerror(mdb)); db_unlock(mdb); - return 0; + return false; } if (result_handler != NULL) { if ((mdb->result = sql_use_result(mdb)) != NULL) { @@ -337,7 +337,7 @@ int db_sql_query(B_DB *mdb, const char *query, DB_RESULT_HANDLER *result_handler } } db_unlock(mdb); - return 1; + return true; } diff --git a/bacula/src/cats/postgresql.c b/bacula/src/cats/postgresql.c index 733074e279..74b0c65f19 100644 --- a/bacula/src/cats/postgresql.c +++ b/bacula/src/cats/postgresql.c @@ -307,7 +307,7 @@ db_escape_string(JCR *jcr, B_DB *mdb, char *snew, char *old, int len) * Submit a general SQL command (cmd), and for each row returned, * the sqlite_handler is called with the ctx. */ -int db_sql_query(B_DB *mdb, const char *query, DB_RESULT_HANDLER *result_handler, void *ctx) +bool db_sql_query(B_DB *mdb, const char *query, DB_RESULT_HANDLER *result_handler, void *ctx) { SQL_ROW row; @@ -318,7 +318,7 @@ int db_sql_query(B_DB *mdb, const char *query, DB_RESULT_HANDLER *result_handler Mmsg(mdb->errmsg, _("Query failed: %s: ERR=%s\n"), query, sql_strerror(mdb)); db_unlock(mdb); Dmsg0(500, "db_sql_query failed\n"); - return 0; + return false; } Dmsg0(500, "db_sql_query succeeded. checking handler\n"); @@ -342,7 +342,7 @@ int db_sql_query(B_DB *mdb, const char *query, DB_RESULT_HANDLER *result_handler Dmsg0(500, "db_sql_query finished\n"); - return 1; + return true; } diff --git a/bacula/src/cats/protos.h b/bacula/src/cats/protos.h index 43f1d98427..30527d59a6 100644 --- a/bacula/src/cats/protos.h +++ b/bacula/src/cats/protos.h @@ -49,7 +49,7 @@ void db_close_database(JCR *jcr, B_DB *db); void db_escape_string(JCR *jcr, B_DB *db, char *snew, char *old, int len); char *db_strerror(B_DB *mdb); int db_next_index(JCR *jcr, B_DB *mdb, char *table, char *index); -int db_sql_query(B_DB *mdb, const char *cmd, DB_RESULT_HANDLER *result_handler, void *ctx); +bool db_sql_query(B_DB *mdb, const char *cmd, DB_RESULT_HANDLER *result_handler, void *ctx); void db_start_transaction(JCR *jcr, B_DB *mdb); void db_end_transaction(JCR *jcr, B_DB *mdb); int db_int64_handler(void *ctx, int num_fields, char **row); diff --git a/bacula/src/cats/sql_create.c b/bacula/src/cats/sql_create.c index 8ffba95043..3b781bb4ee 100644 --- a/bacula/src/cats/sql_create.c +++ b/bacula/src/cats/sql_create.c @@ -768,7 +768,7 @@ bool db_write_batch_file_records(JCR *jcr) jcr->JobStatus = JS_AttrInserting; if (!sql_batch_end(jcr, jcr->db_batch, NULL)) { - Jmsg(jcr, M_FATAL, 0, "Bad batch end %s\n", jcr->db_batch->errmsg); + Jmsg1(jcr, M_FATAL, 0, "Batch end %s\n", jcr->db_batch->errmsg); return false; } if (job_canceled(jcr)) { @@ -778,35 +778,35 @@ bool db_write_batch_file_records(JCR *jcr) /* we have to lock tables */ if (!db_sql_query(jcr->db_batch, sql_batch_lock_path_query, NULL, NULL)) { - Jmsg(jcr, M_FATAL, 0, "Can't lock Path table %s\n", jcr->db_batch->errmsg); + Jmsg1(jcr, M_FATAL, 0, "Lock Path table %s\n", jcr->db_batch->errmsg); return false; } if (!db_sql_query(jcr->db_batch, sql_batch_fill_path_query, NULL, NULL)) { - Jmsg(jcr, M_FATAL, 0, "Can't fill Path table %s\n",jcr->db_batch->errmsg); + Jmsg1(jcr, M_FATAL, 0, "Fill Path table %s\n",jcr->db_batch->errmsg); db_sql_query(jcr->db_batch, sql_batch_unlock_tables_query, NULL, NULL); return false; } if (!db_sql_query(jcr->db_batch, sql_batch_unlock_tables_query,NULL,NULL)) { - Jmsg(jcr, M_FATAL, 0, "Can't unlock Path table %s\n", jcr->db_batch->errmsg); + Jmsg1(jcr, M_FATAL, 0, "Unlock Path table %s\n", jcr->db_batch->errmsg); return false; } /* we have to lock tables */ if (!db_sql_query(jcr->db_batch,sql_batch_lock_filename_query,NULL, NULL)) { - Jmsg(jcr, M_FATAL, 0, "Can't lock Filename table %s\n", jcr->db_batch->errmsg); + Jmsg1(jcr, M_FATAL, 0, "Lock Filename table %s\n", jcr->db_batch->errmsg); return false; } if (!db_sql_query(jcr->db_batch,sql_batch_fill_filename_query, NULL,NULL)) { - Jmsg(jcr,M_FATAL,0,"Can't fill Filename table %s\n",jcr->db_batch->errmsg); + Jmsg1(jcr,M_FATAL,0,"Fill Filename table %s\n",jcr->db_batch->errmsg); db_sql_query(jcr->db_batch, sql_batch_unlock_tables_query, NULL, NULL); return false; } if (!db_sql_query(jcr->db_batch, sql_batch_unlock_tables_query,NULL,NULL)) { - Jmsg(jcr, M_FATAL, 0, "Can't unlock Filename table %s\n", jcr->db_batch->errmsg); + Jmsg1(jcr, M_FATAL, 0, "Unlock Filename table %s\n", jcr->db_batch->errmsg); return false; } @@ -819,7 +819,7 @@ bool db_write_batch_file_records(JCR *jcr) "JOIN Filename ON (batch.Name = Filename.Name)", NULL,NULL)) { - Jmsg(jcr, M_FATAL, 0, "Can't fill File table %s\n", jcr->db_batch->errmsg); + Jmsg1(jcr, M_FATAL, 0, "Fill File table %s\n", jcr->db_batch->errmsg); return false; } diff --git a/bacula/src/cats/sqlite.c b/bacula/src/cats/sqlite.c index b4331dd815..a03691fed1 100644 --- a/bacula/src/cats/sqlite.c +++ b/bacula/src/cats/sqlite.c @@ -338,7 +338,7 @@ static int sqlite_result(void *arh_data, int num_fields, char **rows, char **col * Submit a general SQL command (cmd), and for each row returned, * the sqlite_handler is called with the ctx. */ -int db_sql_query(B_DB *mdb, const char *query, DB_RESULT_HANDLER *result_handler, void *ctx) +bool db_sql_query(B_DB *mdb, const char *query, DB_RESULT_HANDLER *result_handler, void *ctx) { struct rh_data rh_data; int stat; @@ -358,10 +358,10 @@ int db_sql_query(B_DB *mdb, const char *query, DB_RESULT_HANDLER *result_handler if (stat != 0) { Mmsg(mdb->errmsg, _("Query failed: %s: ERR=%s\n"), query, sql_strerror(mdb)); db_unlock(mdb); - return 0; + return false; } db_unlock(mdb); - return 1; + return true; } /* diff --git a/bacula/src/console/console.c b/bacula/src/console/console.c index 0874558b4a..0f57d173c4 100644 --- a/bacula/src/console/console.c +++ b/bacula/src/console/console.c @@ -114,7 +114,8 @@ PROG_COPYRIGHT "\nVersion: " VERSION " (" BDATE ") %s %s %s\n\n" "Usage: bconsole [-s] [-c config_file] [-d debug_level]\n" " -c set configuration file to file\n" -" -dnn set debug level to nn\n" +" -d set debug level to \n" +" -dt print timestamp in debug output\n" " -n no conio\n" " -s no signals\n" " -t test - read configuration and exit\n" @@ -532,9 +533,13 @@ int main(int argc, char *argv[]) break; case 'd': - debug_level = atoi(optarg); - if (debug_level <= 0) { - debug_level = 1; + if (*optarg == 't') { + dbg_timestamp = true; + } else { + debug_level = atoi(optarg); + if (debug_level <= 0) { + debug_level = 1; + } } break; diff --git a/bacula/src/dird/dird.c b/bacula/src/dird/dird.c index 45ae5a6818..c4dc63b69d 100644 --- a/bacula/src/dird/dird.c +++ b/bacula/src/dird/dird.c @@ -94,7 +94,8 @@ PROG_COPYRIGHT "\nVersion: %s (%s)\n\n" "Usage: dird [-f -s] [-c config_file] [-d debug_level] [config_file]\n" " -c set configuration file to file\n" -" -dnn set debug level to nn\n" +" -d set debug level to \n" +" -dt print timestamp in debug output\n" " -f run in foreground (for debugging)\n" " -g groupid\n" " -r run now\n" @@ -149,9 +150,13 @@ int main (int argc, char *argv[]) break; case 'd': /* set debug level */ - debug_level = atoi(optarg); - if (debug_level <= 0) { - debug_level = 1; + if (*optarg == 't') { + dbg_timestamp = true; + } else { + debug_level = atoi(optarg); + if (debug_level <= 0) { + debug_level = 1; + } } Dmsg1(10, "Debug level = %d\n", debug_level); break; diff --git a/bacula/src/dird/getmsg.c b/bacula/src/dird/getmsg.c index 16e88291c4..dae8f098fd 100644 --- a/bacula/src/dird/getmsg.c +++ b/bacula/src/dird/getmsg.c @@ -107,7 +107,7 @@ int bget_dirmsg(BSOCK *bs) for (;;) { n = bs->recv(); - Dmsg2(100, "bget_dirmsg %d: %s", n, bs->msg); + Dmsg2(100, "bget_dirmsg %d: %s\n", n, bs->msg); if (is_bnet_stop(bs)) { return n; /* error or terminate */ diff --git a/bacula/src/dird/ua_run.c b/bacula/src/dird/ua_run.c index e90bfda084..5d2de5c677 100644 --- a/bacula/src/dird/ua_run.c +++ b/bacula/src/dird/ua_run.c @@ -449,8 +449,11 @@ try_again: Dmsg1(800, "Calling run_job job=%x\n", jcr->job); start_job: - Dmsg1(100, "Using pool %s\n", jcr->pool->name()); + Dmsg3(000, "JobId=%u using pool %s priority=%d\n", (int)jcr->JobId, + jcr->pool->name(), jcr->JobPriority); JobId = run_job(jcr); + Dmsg4(000, "JobId=%u NewJobId=%d using pool %s priority=%d\n", (int)jcr->JobId, + JobId, jcr->pool->name(), jcr->JobPriority); free_jcr(jcr); /* release jcr */ if (JobId == 0) { ua->error_msg(_("Job failed.\n")); diff --git a/bacula/src/filed/filed.c b/bacula/src/filed/filed.c index 277e32d994..5bbd1bb01a 100644 --- a/bacula/src/filed/filed.c +++ b/bacula/src/filed/filed.c @@ -65,7 +65,8 @@ PROG_COPYRIGHT "\nVersion: %s (%s)\n\n" "Usage: bacula-fd [-f -s] [-c config_file] [-d debug_level]\n" " -c use as configuration file\n" -" -dnn set debug level to nn\n" +" -d set debug level to \n" +" -dt print timestamp in debug output\n" " -f run in foreground (for debugging)\n" " -g groupid\n" " -s no signals (for debugging)\n" @@ -114,9 +115,13 @@ int main (int argc, char *argv[]) break; case 'd': /* debug level */ - debug_level = atoi(optarg); - if (debug_level <= 0) { - debug_level = 1; + if (*optarg == 't') { + dbg_timestamp = true; + } else { + debug_level = atoi(optarg); + if (debug_level <= 0) { + debug_level = 1; + } } break; diff --git a/bacula/src/lib/message.c b/bacula/src/lib/message.c index 8f0bf18a03..7546caf202 100644 --- a/bacula/src/lib/message.c +++ b/bacula/src/lib/message.c @@ -50,6 +50,7 @@ sql_escape p_sql_escape = NULL; const char *working_directory = NULL; /* working directory path stored here */ int verbose = 0; /* increase User messages */ int debug_level = 1; /* debug level */ +bool dbg_timestamp = false; /* print timestamp in debug output */ time_t daemon_start_time = 0; /* Daemon start time */ const char *version = VERSION " (" BDATE ")"; char my_name[30]; /* daemon name is stored here */ @@ -843,6 +844,7 @@ d_msg(const char *file, int line, int level, const char *fmt,...) int len; va_list arg_ptr; bool details = true; + time_t mtime; if (level < 0) { details = false; @@ -850,6 +852,15 @@ d_msg(const char *file, int line, int level, const char *fmt,...) } if (level <= debug_level) { + if (dbg_timestamp) { + mtime = time(NULL); + bstrftimes(buf, sizeof(buf), mtime); + len = strlen(buf); + buf[len++] = ' '; + buf[len] = 0; + fputs(buf, stdout); + } + #ifdef FULL_LOCATION if (details) { len = bsnprintf(buf, sizeof(buf), "%s: %s:%d-%u ", @@ -1335,7 +1346,7 @@ void Qmsg(JCR *jcr, int type, time_t mtime, const char *fmt,...) jcr = get_jcr_from_tsd(); } /* If no jcr or dequeuing send to daemon to avoid recursion */ - if (!jcr || jcr->dequeuing) { + if ((jcr && !jcr->msg_queue) || !jcr || jcr->dequeuing) { /* jcr==NULL => daemon message, safe to send now */ Jmsg(jcr, item->type, item->mtime, "%s", item->msg); free(item); diff --git a/bacula/src/lib/message.h b/bacula/src/lib/message.h index 476d3611a9..4c00f229b9 100644 --- a/bacula/src/lib/message.h +++ b/bacula/src/lib/message.h @@ -154,6 +154,7 @@ extern DLL_IMP_EXP sql_query p_sql_query; extern DLL_IMP_EXP sql_escape p_sql_escape; extern DLL_IMP_EXP int debug_level; +extern DLL_IMP_EXP bool dbg_timestamp; /* print timestamp in debug output */ extern DLL_IMP_EXP int verbose; extern DLL_IMP_EXP char my_name[]; extern DLL_IMP_EXP const char * working_directory; diff --git a/bacula/src/stored/bcopy.c b/bacula/src/stored/bcopy.c index 76c5cde892..73416afbe4 100644 --- a/bacula/src/stored/bcopy.c +++ b/bacula/src/stored/bcopy.c @@ -73,7 +73,8 @@ PROG_COPYRIGHT "Usage: bcopy [-d debug_level] \n" " -b bootstrap specify a bootstrap file\n" " -c specify configuration file\n" -" -d set debug level to nn\n" +" -d set debug level to \n" +" -dt print timestamp in debug output\n" " -i specify input Volume names (separated by |)\n" " -o specify output Volume names (separated by |)\n" " -p proceed inspite of errors\n" @@ -112,9 +113,14 @@ int main (int argc, char *argv[]) break; case 'd': /* debug level */ - debug_level = atoi(optarg); - if (debug_level <= 0) - debug_level = 1; + if (*optarg == 't') { + dbg_timestamp = true; + } else { + debug_level = atoi(optarg); + if (debug_level <= 0) { + debug_level = 1; + } + } break; case 'i': /* input Volume name */ diff --git a/bacula/src/stored/bextract.c b/bacula/src/stored/bextract.c index 53f40d9738..cfa5b5b8bf 100644 --- a/bacula/src/stored/bextract.c +++ b/bacula/src/stored/bextract.c @@ -79,7 +79,8 @@ PROG_COPYRIGHT "Usage: bextract \n" " -b specify a bootstrap file\n" " -c specify a configuration file\n" -" -d set debug level to nn\n" +" -d set debug level to \n" +" -dt print timestamp in debug output\n" " -e exclude list\n" " -i include list\n" " -p proceed inspite of I/O errors\n" @@ -126,9 +127,14 @@ int main (int argc, char *argv[]) break; case 'd': /* debug level */ - debug_level = atoi(optarg); - if (debug_level <= 0) - debug_level = 1; + if (*optarg == 't') { + dbg_timestamp = true; + } else { + debug_level = atoi(optarg); + if (debug_level <= 0) { + debug_level = 1; + } + } break; case 'e': /* exclude list */ diff --git a/bacula/src/stored/bls.c b/bacula/src/stored/bls.c index 92d6fbcc95..218db4e64e 100644 --- a/bacula/src/stored/bls.c +++ b/bacula/src/stored/bls.c @@ -79,7 +79,8 @@ PROG_COPYRIGHT "Usage: bls [options] \n" " -b specify a bootstrap file\n" " -c specify a config file\n" -" -d specify debug level\n" +" -d set debug level to \n" +" -dt print timestamp in debug output\n" " -e exclude list\n" " -i include list\n" " -j list jobs\n" @@ -130,9 +131,14 @@ int main (int argc, char *argv[]) break; case 'd': /* debug level */ - debug_level = atoi(optarg); - if (debug_level <= 0) - debug_level = 1; + if (*optarg == 't') { + dbg_timestamp = true; + } else { + debug_level = atoi(optarg); + if (debug_level <= 0) { + debug_level = 1; + } + } break; case 'e': /* exclude list */ diff --git a/bacula/src/stored/bscan.c b/bacula/src/stored/bscan.c index 71254e5bbf..fd0924c340 100644 --- a/bacula/src/stored/bscan.c +++ b/bacula/src/stored/bscan.c @@ -116,7 +116,8 @@ PROG_COPYRIGHT "Usage: bscan [ options ] \n" " -b bootstrap specify a bootstrap file\n" " -c specify configuration file\n" -" -d set debug level to nn\n" +" -d set debug level to \n" +" -dt print timestamp in debug output\n" " -m update media info in database\n" " -n specify the database name (default bacula)\n" " -u specify database user name (default bacula)\n" @@ -166,9 +167,14 @@ int main (int argc, char *argv[]) break; case 'd': /* debug level */ - debug_level = atoi(optarg); - if (debug_level <= 0) - debug_level = 1; + if (*optarg == 't') { + dbg_timestamp = true; + } else { + debug_level = atoi(optarg); + if (debug_level <= 0) { + debug_level = 1; + } + } break; case 'h': diff --git a/bacula/src/stored/btape.c b/bacula/src/stored/btape.c index a951ba804b..f63f3403a7 100644 --- a/bacula/src/stored/btape.c +++ b/bacula/src/stored/btape.c @@ -220,9 +220,13 @@ int main(int margc, char *margv[]) break; case 'd': /* set debug level */ - debug_level = atoi(optarg); - if (debug_level <= 0) { - debug_level = 1; + if (*optarg == 't') { + dbg_timestamp = true; + } else { + debug_level = atoi(optarg); + if (debug_level <= 0) { + debug_level = 1; + } } break; @@ -2598,7 +2602,8 @@ PROG_COPYRIGHT "Usage: btape \n" " -b specify bootstrap file\n" " -c set configuration file to file\n" -" -d set debug level to nn\n" +" -d set debug level to \n" +" -dt print timestamp in debug output\n" " -p proceed inspite of I/O errors\n" " -s turn off signals\n" " -v be verbose\n" diff --git a/bacula/src/stored/stored.c b/bacula/src/stored/stored.c index 74c69e08c1..f7d7605c1e 100644 --- a/bacula/src/stored/stored.c +++ b/bacula/src/stored/stored.c @@ -82,7 +82,8 @@ PROG_COPYRIGHT "\nVersion: %s (%s)\n\n" "Usage: stored [options] [-c config_file] [config_file]\n" " -c use as configuration file\n" -" -dnn set debug level to nn\n" +" -d set debug level to \n" +" -dt print timestamp in debug output\n" " -f run in foreground (for debugging)\n" " -g set groupid to group\n" " -p proceed despite I/O errors\n" @@ -142,9 +143,13 @@ int main (int argc, char *argv[]) break; case 'd': /* debug level */ - debug_level = atoi(optarg); - if (debug_level <= 0) { - debug_level = 1; + if (*optarg == 't') { + dbg_timestamp = true; + } else { + debug_level = atoi(optarg); + if (debug_level <= 0) { + debug_level = 1; + } } break; diff --git a/bacula/src/tools/bbatch.c b/bacula/src/tools/bbatch.c index b42ce0c8f3..aa3a328bd7 100644 --- a/bacula/src/tools/bbatch.c +++ b/bacula/src/tools/bbatch.c @@ -80,7 +80,8 @@ PROG_COPYRIGHT " will start 3 thread and load dat1, dat and datx in your catalog\n" "See bbatch.c to generate datafile\n\n" "Usage: bbatch [ options ] -w working/dir -f datafile\n" -" -d set debug level to nn\n" +" -d set debug level to \n" +" -dt print timestamp in debug output\n" " -n specify the database name (default bacula)\n" " -u specify database user name (default bacula)\n" " -P set debug level to \n" +" -dt print timestamp in debug output\n" " -? print this message.\n" "\n\n"); @@ -93,9 +95,13 @@ int main(int argc, char *const *argv) while ((ch = getopt(argc, argv, "d:f:n?")) != -1) { switch (ch) { case 'd': /* set debug level */ - debug_level = atoi(optarg); - if (debug_level <= 0) { - debug_level = 1; + if (*optarg == 't') { + dbg_timestamp = true; + } else { + debug_level = atoi(optarg); + if (debug_level <= 0) { + debug_level = 1; + } } break; diff --git a/bacula/src/tools/bregtest.c b/bacula/src/tools/bregtest.c index 2c40e08195..326d6f654b 100644 --- a/bacula/src/tools/bregtest.c +++ b/bacula/src/tools/bregtest.c @@ -54,6 +54,8 @@ static void usage() " -f specify file of data to be matched\n" " -e specify expression\n" " -s sed output\n" +" -d set debug level to \n" +" -dt print timestamp in debug output\n" " -? print this message.\n" "\n"); @@ -77,9 +79,13 @@ int main(int argc, char *const *argv) while ((ch = getopt(argc, argv, "sd:f:e:")) != -1) { switch (ch) { case 'd': /* set debug level */ - debug_level = atoi(optarg); - if (debug_level <= 0) { - debug_level = 1; + if (*optarg == 't') { + dbg_timestamp = true; + } else { + debug_level = atoi(optarg); + if (debug_level <= 0) { + debug_level = 1; + } } break; diff --git a/bacula/src/tools/bsmtp.c b/bacula/src/tools/bsmtp.c index c1a3e22110..11b4904aad 100644 --- a/bacula/src/tools/bsmtp.c +++ b/bacula/src/tools/bsmtp.c @@ -187,7 +187,8 @@ _("\n" "Usage: %s [-f from] [-h mailhost] [-s subject] [-c copy] [recipient ...]\n" " -8 set charset utf-8\n" " -c set the Cc: field\n" -" -dnn set debug level to nn\n" +" -d set debug level to \n" +" -dt print timestamp in debug output\n" " -f set the From: field\n" " -h use mailhost:port as the SMTP server\n" " -s set the Subject: field\n" @@ -286,9 +287,13 @@ int main (int argc, char *argv[]) break; case 'd': /* set debug level */ - debug_level = atoi(optarg); - if (debug_level <= 0) { - debug_level = 1; + if (*optarg == 't') { + dbg_timestamp = true; + } else { + debug_level = atoi(optarg); + if (debug_level <= 0) { + debug_level = 1; + } } Dmsg1(20, "Debug level = %d\n", debug_level); break; diff --git a/bacula/src/tools/dbcheck.c b/bacula/src/tools/dbcheck.c index dafff136af..07a501e4f7 100644 --- a/bacula/src/tools/dbcheck.c +++ b/bacula/src/tools/dbcheck.c @@ -105,7 +105,8 @@ static void usage() " -b batch mode\n" " -C catalog name in the director conf file\n" " -c director conf filename\n" -" -dnn set debug level to nn\n" +" -d set debug level to \n" +" -dt print timestamp in debug output\n" " -f fix inconsistencies\n" " -v verbose\n" " -? print this message\n\n"); @@ -145,9 +146,14 @@ int main (int argc, char *argv[]) break; case 'd': /* debug level */ - debug_level = atoi(optarg); - if (debug_level <= 0) - debug_level = 1; + if (*optarg == 't') { + dbg_timestamp = true; + } else { + debug_level = atoi(optarg); + if (debug_level <= 0) { + debug_level = 1; + } + } break; case 'f': /* fix inconsistencies */ diff --git a/bacula/src/tools/testfind.c b/bacula/src/tools/testfind.c index 184580604b..2c3d5d0f34 100644 --- a/bacula/src/tools/testfind.c +++ b/bacula/src/tools/testfind.c @@ -66,7 +66,8 @@ static void usage() "\n" "Usage: testfind [-d debug_level] [-] [pattern1 ...]\n" " -a print extended attributes (Win32 debug)\n" -" -dnn set debug level to nn\n" +" -d set debug level to \n" +" -dt print timestamp in debug output\n" " -c specify config file containing FileSet resources\n" " -f specify which FileSet to use\n" " -? print this message.\n" @@ -108,10 +109,14 @@ main (int argc, char *const *argv) break; case 'd': /* set debug level */ + if (*optarg == 't') { + dbg_timestamp = true; + } else { debug_level = atoi(optarg); if (debug_level <= 0) { debug_level = 1; } + } break; case 'f': /* exclude patterns */ diff --git a/bacula/src/tools/testls.c b/bacula/src/tools/testls.c index 02ab05788f..c28b4c4007 100644 --- a/bacula/src/tools/testls.c +++ b/bacula/src/tools/testls.c @@ -55,7 +55,8 @@ static void usage() "\n" "Usage: testls [-d debug_level] [-] [pattern1 ...]\n" " -a print extended attributes (Win32 debug)\n" -" -dnn set debug level to nn\n" +" -d set debug level to \n" +" -dt print timestamp in debug output\n" " -e specify file of exclude patterns\n" " -i specify file of include patterns\n" " - read pattern(s) from stdin\n" @@ -94,9 +95,13 @@ main (int argc, char *const *argv) break; case 'd': /* set debug level */ - debug_level = atoi(optarg); - if (debug_level <= 0) { - debug_level = 1; + if (*optarg == 't') { + dbg_timestamp = true; + } else { + debug_level = atoi(optarg); + if (debug_level <= 0) { + debug_level = 1; + } } break; diff --git a/bacula/src/tray-monitor/eggmarshalers.list b/bacula/src/tray-monitor/eggmarshalers.list deleted file mode 100644 index d443ca7cd7..0000000000 --- a/bacula/src/tray-monitor/eggmarshalers.list +++ /dev/null @@ -1,17 +0,0 @@ -VOID:OBJECT,OBJECT -VOID:OBJECT,STRING,LONG,LONG -VOID:OBJECT,LONG -VOID:OBJECT,STRING,STRING -VOID:UINT,UINT -BOOLEAN:INT -BOOLEAN:ENUM -BOOLEAN:VOID -OBJECT:VOID -VOID:VOID -VOID:INT,INT -VOID:UINT,UINT -VOID:BOOLEAN -VOID:OBJECT,ENUM,BOXED -VOID:BOXED -BOOLEAN:BOOLEAN -BOOLEAN:OBJECT,STRING,STRING diff --git a/bacula/src/tray-monitor/tray-monitor.c b/bacula/src/tray-monitor/tray-monitor.c index 195bfd5b94..df2b46f09d 100644 --- a/bacula/src/tray-monitor/tray-monitor.c +++ b/bacula/src/tray-monitor/tray-monitor.c @@ -112,7 +112,8 @@ PROG_COPYRIGHT "\nVersion: %s (%s) %s %s %s\n\n" "Usage: tray-monitor [-c config_file] [-d debug_level]\n" " -c set configuration file to file\n" -" -dnn set debug level to nn\n" +" -d set debug level to \n" +" -dt print timestamp in debug output\n" " -t test - read configuration and exit\n" " -? print this message.\n" "\n"), 2004, VERSION, BDATE, HOST_OS, DISTNAME, DISTVER); @@ -219,9 +220,13 @@ int main(int argc, char *argv[]) break; case 'd': - debug_level = atoi(optarg); - if (debug_level <= 0) { - debug_level = 1; + if (*optarg == 't') { + dbg_timestamp = true; + } else { + debug_level = atoi(optarg); + if (debug_level <= 0) { + debug_level = 1; + } } break; diff --git a/bacula/src/version.h b/bacula/src/version.h index 59ef1f2ca1..e2db23da2f 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -4,8 +4,8 @@ #undef VERSION #define VERSION "2.3.6" -#define BDATE "16 October 2007" -#define LSMDATE "16Oct07" +#define BDATE "19 October 2007" +#define LSMDATE "19Oct07" #define PROG_COPYRIGHT "Copyright (C) %d-2007 Free Software Foundation Europe e.V.\n" #define BYEAR "2007" /* year for copyright messages in progs */ diff --git a/bacula/technotes-2.3 b/bacula/technotes-2.3 index 71277ab32a..a399c21ca0 100644 --- a/bacula/technotes-2.3 +++ b/bacula/technotes-2.3 @@ -1,10 +1,19 @@ Technical notes on version 2.3 General: +19Oct07 +kes Make explicit exception to GPL in LICENSE to permit linking + the Win32 FD with Microsoft VSS code. +kes Apply the Solaris package patch from + Masopust, Christian +kes Apply the patch to optionally add a timestamp in the debug output + submitted by Mariusz Czulada . 18Oct07 ebl Use PQerrorMessage instead of PQresultErrorMessage in postgresql - backend (sql_strerror). Fixe bug #989 + backend (sql_strerror). Fixes bug #989 16Oct07 +kes Apply Michael Short's Win32 regress patch. + It applied with no problems. kes Add PATH command to SunOS part of mtx-changer.in so that sed and awk are on the path. kes Redirect stderror to stdin on mt status command in mtx-changer.in @@ -167,10 +176,10 @@ kes Note, you need GTK >= 2.10 to be able to link the Tray Monitor program. kes Move patches into patches directory. 11Sep07 -ebl Fix bug #946 about "bacula-dir -t" which doesn't works +ebl Fix bug #946 about 'bacula-dir -t' which doesn't works as expected. 09Sep07 -ebl Using "m" in bconsole will show messages like before, +ebl Using 'm' in bconsole will show messages like before, and not memory usage. kes Fix bug #935, and probably also bug #903 where files were not restored. MediaId was not properly set in JobMedia record after -- 2.39.5