From c092a33beb9e751831b204b76862f810ca8b5b97 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Sun, 20 Jul 2008 12:31:45 +0000 Subject: [PATCH] kes Tweak separator command in console to start disabled and allow defining no separator character. Also make code a bit more fault tolerant. kes Make btraceback write the traceback to the working directory before attempting to mail it. kes Add a RFC to Projects. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@7404 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/projects | 28 ++++++++++++++++++++++++++++ bacula/scripts/btraceback.in | 9 ++++++--- bacula/src/console/console.c | 32 +++++++++++++++++++++++--------- bacula/technotes-2.5 | 9 +++++++++ 4 files changed, 66 insertions(+), 12 deletions(-) diff --git a/bacula/projects b/bacula/projects index c007947ba0..e5b7e2c35e 100644 --- a/bacula/projects +++ b/bacula/projects @@ -1296,6 +1296,34 @@ Item 1: Backup and Restore of Windows Encrypted Files through raw encryption fun necessary, in larger data sets (ie, tens or hundreds of gigabytes) it can easily produce multi-megabyte report emails! + Item n?: Expand the Verify Job capability to verify Jobs older than the + last one. For VolumeToCatalog Jobs + Date: 17 Januar 2008 + Origin: portrix.net Hamburg, Germany. + Contact: Christian Sabelmann + Status: 70% of the required Code is part of the Verify function since v. 2.x + + What: + The ability to tell Bacula which Job should verify instead of + automatically verify just the last one. + + Why: + It is sad that such a powerfull feature like Verify Jobs + (VolumeToCatalog) is restricted to be used only with the last backup Job + of a client. Actual users who have to do daily Backups are forced to + also do daily Verify Jobs in order to take advantage of this useful + feature. This Daily Verify after Backup conduct is not always desired + and Verify Jobs have to be sometimes scheduled. (Not necessarily + scheduled in Bacula). With this feature Admins can verify Jobs once a + Week or less per month, selecting the Jobs they want to verify. This + feature is also not to difficult to implement taking in account older + bug reports about this feature and the selection of the Job to be verified. + + Notes: For the verify Job, the user could select the Job to be verified + from a List of the latest Jobs of a client. It would also be possible to + verify a certain volume. All of these would naturaly apply only for + Jobs whose file information are still in the catalog. + ========== Already implemented ================================ Item n: make changing "spooldata=yes|no" possible for diff --git a/bacula/scripts/btraceback.in b/bacula/scripts/btraceback.in index db70e68ec4..42ffa93809 100755 --- a/bacula/scripts/btraceback.in +++ b/bacula/scripts/btraceback.in @@ -10,11 +10,14 @@ # PNAME=`basename $1` PNAME="${PNAME} on `hostname`" +WD="@working_dir@" if test `uname -s` = SunOS ; then - gcore -o @working_dir@/${PNAME} $2 - dbx $1 $2 <@scriptdir@/btraceback.dbx 2>&1 \ + gcore -o ${WD}/${PNAME} $2 + dbx $1 $2 <@scriptdir@/btraceback.dbx 2>&1 >${WD}/bacula.$$.traceback + cat ${WD}/bacula.$$.traceback \ | @sbindir@/bsmtp -h @smtp_host@ -f @dump_email@ -s "Bacula DBX traceback of ${PNAME}" @dump_email@ else - gdb -quiet -batch -x @scriptdir@/btraceback.gdb $1 $2 2>&1 \ + gdb -quiet -batch -x @scriptdir@/btraceback.gdb $1 $2 2>&1 >${WD}/bacula.$$.traceback + cat ${WD}/bacula.$$.traceback \ | @sbindir@/bsmtp -h @smtp_host@ -f @dump_email@ -s "Bacula GDB traceback of ${PNAME}" @dump_email@ fi diff --git a/bacula/src/console/console.c b/bacula/src/console/console.c index c81252fe1f..0efadb8fe5 100644 --- a/bacula/src/console/console.c +++ b/bacula/src/console/console.c @@ -348,14 +348,17 @@ static int tls_pem_callback(char *buf, int size, const void *userdata) #include "readline.h" #include "history.h" -static char eol = ';'; +static char eol = '\0'; static int eolcmd(FILE *input, BSOCK *UA_sock) { if ((argc > 1) && (strchr("!$%&'()*+,-/:;<>?[]^`{|}~", argk[1][0]) != NULL)) { eol = argk[1][0]; return 1; + } else if (argc == 1) { + eol = '\0'; } - sendit(_("Missing or illegal separator character.\n")); + + sendit(_("Illegal separator character.\n")); return 1; } @@ -371,20 +374,31 @@ get_cmd(FILE *input, const char *prompt, BSOCK *sock, int sec) do_history = 0; rl_catch_signals = 0; /* do it ourselves */ line = readline((char *)prompt); /* cast needed for old readlines */ - if (!line) { exit(1); } strip_trailing_junk(line); command = line; - } else { - *next = eol; + } else if (next) { command = next + 1; + } else { + sendit(_("Command logic problem\n")); + sock->msglen = 0; + sock->msg[0] = 0; + return 0; } - next = strchr(command, eol); - if (next != NULL) { - *next = '\0'; + /* + * Split "line" into multiple commands separated by the eol character. + * Each part is pointed to by "next" until finally it becomes null. + */ + if (eol == '\0') { + next = NULL; + } else { + next = strchr(command, eol); + if (next) { + *next = '\0'; + } } if (command != line && isatty(fileno(input))) { senditf("%s%s\n", prompt, command); @@ -395,7 +409,7 @@ get_cmd(FILE *input, const char *prompt, BSOCK *sock, int sec) do_history++; } - if (next == NULL) { + if (!next) { if (do_history) { add_history(line); } diff --git a/bacula/technotes-2.5 b/bacula/technotes-2.5 index 8dd27b83ee..5243827b55 100644 --- a/bacula/technotes-2.5 +++ b/bacula/technotes-2.5 @@ -27,9 +27,18 @@ Spooling/despooling status Implement ftruncate for NFS devices Add long term statistics job table vtape driver +Ignore Dir +separator in console (!$%&'()*+,-/:;<>?[]^`{|}~) General: +20Jul08 +kes Tweak separator command in console to start disabled and + allow defining no separator character. Also make code a + bit more fault tolerant. +kes Make btraceback write the traceback to the working directory + before attempting to mail it. +kes Add a RFC to Projects. 18Jul08 kes Attempt to implement a kludge to make Qt work with bat on Win32. -- 2.39.5