From 1e697d5ab31e74951ba59a5d90c77b4d3b38acb1 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Tue, 15 Aug 2006 13:51:22 +0000 Subject: [PATCH] kes Eliminate some compile warnings in dird_conf.c kes Format the bytes field in the terminated jobs part of the status command for the three daemons with suffixes to reduce print size of backup bytes. Suggested by a user. kes When not descending into a directory, print the File= name that triggered it -- makes why not descending a bit clearer. kes Do not unload autochanger when doing a list command -- basic code from Eric Bollengier. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@3285 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/kernstodo | 5 +++++ bacula/src/dird/dird_conf.c | 14 +++++++------- bacula/src/dird/ua_status.c | 8 ++++---- bacula/src/filed/backup.c | 12 ++++++------ bacula/src/filed/status.c | 6 +++--- bacula/src/findlib/find.c | 4 ++-- bacula/src/findlib/find.h | 1 + bacula/src/lib/bsock.h | 3 +-- bacula/src/stored/autochanger.c | 4 ---- bacula/src/stored/dircmd.c | 5 +++-- bacula/src/stored/status.c | 9 +++++---- bacula/src/version.h | 4 ++-- bacula/technotes-1.39 | 11 ++++++++++- 13 files changed, 49 insertions(+), 37 deletions(-) diff --git a/bacula/kernstodo b/bacula/kernstodo index 2603a3b290..6258919c07 100644 --- a/bacula/kernstodo +++ b/bacula/kernstodo @@ -27,10 +27,15 @@ Document: - Document JobStatus and Termination codes. - Fix the error with the "DVI file can't be opened" while building the French PDF. +- Document more DVD stuff -- particularly that recycling doesn't work, + and all the other things too. Priority: For 1.39: +- Change dbcheck to tell users to use native tools for fixing + broken databases, and to ensure they have the proper indexes. +- add udev rules for Bacula devices. - Add manpages to the list of directories for make install. - If a job terminates, the DIR connection can close before the Volume info is updated, leaving the File count wrong. diff --git a/bacula/src/dird/dird_conf.c b/bacula/src/dird/dird_conf.c index 325831dba4..8cbf3e3feb 100644 --- a/bacula/src/dird/dird_conf.c +++ b/bacula/src/dird/dird_conf.c @@ -1680,13 +1680,13 @@ static void store_short_runscript(LEX *lc, RES_ITEM *item, int index, int pass) * name handler value code flags default_value */ static RES_ITEM runscript_items[] = { - {"command", store_runscript_cmd, (char **)&res_runscript, 0, ITEM_REQUIRED, 0}, - {"target", store_runscript_target, (char **)&res_runscript, 0, 0, 0}, - {"runsonsuccess", store_bool, (char **)&res_runscript.on_success, 0, 0, 0}, - {"runsonfailure", store_bool, (char **)&res_runscript.on_failure, 0, 0, 0}, - {"abortjobonerror", store_bool, (char **)&res_runscript.abort_on_error, 0, 0, 0}, - {"runswhen", store_runscript_when, (char **)&res_runscript.when, 0, 0, 0}, - {"runsonclient", store_runscript_target, (char **)&res_runscript, 0, 0, 0}, /* TODO */ + {"command", store_runscript_cmd, {(char **)&res_runscript}, 0, ITEM_REQUIRED, 0}, + {"target", store_runscript_target, {(char **)&res_runscript}, 0, 0, 0}, + {"runsonsuccess", store_bool, {(char **)&res_runscript.on_success}, 0, 0, 0}, + {"runsonfailure", store_bool, {(char **)&res_runscript.on_failure}, 0, 0, 0}, + {"abortjobonerror", store_bool, {(char **)&res_runscript.abort_on_error}, 0, 0, 0}, + {"runswhen", store_runscript_when, {(char **)&res_runscript.when}, 0, 0, 0}, + {"runsonclient", store_runscript_target, {(char **)&res_runscript}, 0, 0, 0}, /* TODO */ {NULL, NULL, {0}, 0, 0, 0} }; diff --git a/bacula/src/dird/ua_status.c b/bacula/src/dird/ua_status.c index 6ea1e34de7..596d742659 100644 --- a/bacula/src/dird/ua_status.c +++ b/bacula/src/dird/ua_status.c @@ -677,8 +677,8 @@ static void list_terminated_jobs(UAContext *ua) lock_last_jobs_list(); struct s_last_job *je; bsendmsg(ua, _("\nTerminated Jobs:\n")); - bsendmsg(ua, _(" JobId Level Files Bytes Status Finished Name \n")); - bsendmsg(ua, _("========================================================================\n")); + bsendmsg(ua, _(" JobId Level Files Bytes Status Finished Name \n")); + bsendmsg(ua, _("====================================================================\n")); foreach_dlist(je, last_jobs) { char JobName[MAX_NAME_LENGTH]; const char *termstat; @@ -728,11 +728,11 @@ static void list_terminated_jobs(UAContext *ua) termstat = _("Other"); break; } - bsendmsg(ua, _("%6d %-6s %8s %14s %-7s %-8s %s\n"), + bsendmsg(ua, _("%6d %-6s %8s %10s %-7s %-8s %s\n"), je->JobId, level, edit_uint64_with_commas(je->JobFiles, b1), - edit_uint64_with_commas(je->JobBytes, b2), + edit_uint64_with_suffix(je->JobBytes, b2), termstat, dt, JobName); } diff --git a/bacula/src/filed/backup.c b/bacula/src/filed/backup.c index e39454c348..282e2296a7 100644 --- a/bacula/src/filed/backup.c +++ b/bacula/src/filed/backup.c @@ -233,21 +233,21 @@ static int save_file(FF_PKT *ff_pkt, void *vjcr, bool top_level) jcr->num_files_examined--; /* correct file count */ return 1; /* not used */ case FT_NORECURSE: - Jmsg(jcr, M_INFO, 1, _(" Recursion turned off. Will not descend into %s\n"), - ff_pkt->fname); + Jmsg(jcr, M_INFO, 1, _(" Recursion turned off. Will not descend from %s into %s\n"), + ff_pkt->top_fname, ff_pkt->fname); ff_pkt->type = FT_DIREND; /* Backup only the directory entry */ break; case FT_NOFSCHG: /* Suppress message for /dev filesystems */ if (strncmp(ff_pkt->fname, "/dev/", 5) != 0) { - Jmsg(jcr, M_INFO, 1, _(" Filesystem change prohibited. Will not descend into %s\n"), - ff_pkt->fname); + Jmsg(jcr, M_INFO, 1, _(" Filesystem change prohibited. Will not descend from %s into %s\n"), + ff_pkt->top_fname, ff_pkt->fname); } ff_pkt->type = FT_DIREND; /* Backup only the directory entry */ break; case FT_INVALIDFS: - Jmsg(jcr, M_INFO, 1, _(" Disallowed filesystem. Will not descend into %s\n"), - ff_pkt->fname); + Jmsg(jcr, M_INFO, 1, _(" Disallowed filesystem. Will not descend from %s into %s\n"), + ff_pkt->top_fname, ff_pkt->fname); ff_pkt->type = FT_DIREND; /* Backup only the directory entry */ break; case FT_INVALIDDT: diff --git a/bacula/src/filed/status.c b/bacula/src/filed/status.c index 302dd89567..829757dcef 100755 --- a/bacula/src/filed/status.c +++ b/bacula/src/filed/status.c @@ -208,7 +208,7 @@ static void list_terminated_jobs(void sendit(const char *msg, int len, void *sa sendit("\n", 1, arg); /* send separately */ msg = _("Terminated Jobs:\n"); sendit(msg, strlen(msg), arg); - msg = _(" JobId Level Files Bytes Status Finished Name \n"); + msg = _(" JobId Level Files Bytes Status Finished Name \n"); sendit(msg, strlen(msg), arg); msg = _("======================================================================\n"); sendit(msg, strlen(msg), arg); @@ -257,11 +257,11 @@ static void list_terminated_jobs(void sendit(const char *msg, int len, void *sa *p = 0; } } - bsnprintf(buf, sizeof(buf), _("%6d %-6s %8s %14s %-7s %-8s %s\n"), + bsnprintf(buf, sizeof(buf), _("%6d %-6s %8s %10s %-7s %-8s %s\n"), je->JobId, level, edit_uint64_with_commas(je->JobFiles, b1), - edit_uint64_with_commas(je->JobBytes, b2), + edit_uint64_with_suffix(je->JobBytes, b2), termstat, dt, JobName); sendit(buf, strlen(buf), arg); diff --git a/bacula/src/findlib/find.c b/bacula/src/findlib/find.c index c8e4e9aeed..95ee92e149 100644 --- a/bacula/src/findlib/find.c +++ b/bacula/src/findlib/find.c @@ -179,8 +179,8 @@ find_files(JCR *jcr, FF_PKT *ff, int callback(FF_PKT *ff_pkt, void *hpkt, bool t } for (j=0; jname_list.size(); j++) { Dmsg1(100, "F %s\n", (char *)incexe->name_list.get(j)); - char *fname = (char *)incexe->name_list.get(j); - if (find_one_file(jcr, ff, our_callback, his_pkt, fname, (dev_t)-1, true) == 0) { + ff->top_fname = (char *)incexe->name_list.get(j); + if (find_one_file(jcr, ff, our_callback, his_pkt, ff->top_fname, (dev_t)-1, true) == 0) { return 0; /* error return */ } } diff --git a/bacula/src/findlib/find.h b/bacula/src/findlib/find.h index 0217dfc988..e41fed6192 100755 --- a/bacula/src/findlib/find.h +++ b/bacula/src/findlib/find.h @@ -177,6 +177,7 @@ struct HFSPLUS_INFO { * first argument to the find_files callback subroutine. */ struct FF_PKT { + char *top_fname; /* full filename before descending */ char *fname; /* full filename */ char *link; /* link if file linked */ POOLMEM *sys_fname; /* system filename */ diff --git a/bacula/src/lib/bsock.h b/bacula/src/lib/bsock.h index b04af0ffaf..4ca9fcff7a 100644 --- a/bacula/src/lib/bsock.h +++ b/bacula/src/lib/bsock.h @@ -12,7 +12,7 @@ * Version $Id$ */ /* - Copyright (C) 2000-2005 Kern Sibbald + Copyright (C) 2000-2006 Kern Sibbald This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -87,4 +87,3 @@ enum { #define BNET_TLS_NONE 0 /* cannot do TLS */ #define BNET_TLS_OK 1 /* can do, but not required on my end */ #define BNET_TLS_REQUIRED 2 /* TLS is required */ - diff --git a/bacula/src/stored/autochanger.c b/bacula/src/stored/autochanger.c index af53989446..2db94094e4 100644 --- a/bacula/src/stored/autochanger.c +++ b/bacula/src/stored/autochanger.c @@ -460,10 +460,6 @@ bool autochanger_cmd(DCR *dcr, BSOCK *dir, const char *cmd) return false; } - /* List command? */ - if (strcmp(cmd, "list") == 0) { - unload_autochanger(dcr, -1); - } if (strcmp(cmd, "drives") == 0) { AUTOCHANGER *changer_res = dcr->device->changer_res; int drives = 1; diff --git a/bacula/src/stored/dircmd.c b/bacula/src/stored/dircmd.c index c2a429378e..1243e24eea 100644 --- a/bacula/src/stored/dircmd.c +++ b/bacula/src/stored/dircmd.c @@ -857,10 +857,11 @@ static bool changer_cmd(JCR *jcr) DCR *dcr; const char *cmd = NULL; bool ok = false; + bool dolist = false; if (sscanf(dir->msg, "autochanger list %127s", devname.c_str()) == 1) { cmd = "list"; - ok = true; + dolist = ok = true; } else if (sscanf(dir->msg, "autochanger slots %127s", devname.c_str()) == 1) { cmd = "slots"; ok = true; @@ -877,7 +878,7 @@ static bool changer_cmd(JCR *jcr) bnet_fsend(dir, _("3995 Device %s is not an autochanger.\n"), dev->print_name()); /* Under certain "safe" conditions, we can steal the lock */ - } else if (!dev->is_open() || dev->can_steal_lock()) { + } else if (dolist || !dev->is_open() || dev->can_steal_lock()) { autochanger_cmd(dcr, dir, cmd); } else if (dev->is_busy() || dev->is_blocked()) { send_dir_busy_message(dir, dev); diff --git a/bacula/src/stored/status.c b/bacula/src/stored/status.c index d483d41f45..b21d277911 100644 --- a/bacula/src/stored/status.c +++ b/bacula/src/stored/status.c @@ -207,6 +207,7 @@ static void send_blocked_status(DEVICE *dev, void sendit(const char *msg, int le if (!dev) { len = Mmsg(msg, _("No DEVICE structure.\n\n")); sendit(msg, len, arg); + free_pool_memory(msg); return; } switch (dev->dev_blocked) { @@ -452,9 +453,9 @@ static void list_terminated_jobs(void sendit(const char *msg, int len, void *sar lock_last_jobs_list(); msg = _("\nTerminated Jobs:\n"); sendit(msg, strlen(msg), arg); - msg = _(" JobId Level Files Bytes Status Finished Name \n"); + msg = _(" JobId Level Files Bytes Status Finished Name \n"); sendit(msg, strlen(msg), arg); - msg = _("======================================================================\n"); + msg = _("===================================================================\n"); sendit(msg, strlen(msg), arg); foreach_dlist(je, last_jobs) { char JobName[MAX_NAME_LENGTH]; @@ -501,11 +502,11 @@ static void list_terminated_jobs(void sendit(const char *msg, int len, void *sar *p = 0; } } - bsnprintf(buf, sizeof(buf), _("%6d %-6s %8s %14s %-7s %-8s %s\n"), + bsnprintf(buf, sizeof(buf), _("%6d %-6s %8s %10s %-7s %-8s %s\n"), je->JobId, level, edit_uint64_with_commas(je->JobFiles, b1), - edit_uint64_with_commas(je->JobBytes, b2), + edit_uint64_with_suffix(je->JobBytes, b2), termstat, dt, JobName); sendit(buf, strlen(buf), arg); diff --git a/bacula/src/version.h b/bacula/src/version.h index 1acb70209a..e29b19d39e 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -4,8 +4,8 @@ #undef VERSION #define VERSION "1.39.19" -#define BDATE "07 August 2006" -#define LSMDATE "07Aug06" +#define BDATE "15 August 2006" +#define LSMDATE "15Aug06" #define BYEAR "2006" /* year for copyright messages in progs */ /* Debug flags */ diff --git a/bacula/technotes-1.39 b/bacula/technotes-1.39 index 7d4021b3c9..a81bb4f30b 100644 --- a/bacula/technotes-1.39 +++ b/bacula/technotes-1.39 @@ -1,7 +1,16 @@ Technical notes on version 1.39 General: -07Aug06 +15Aug06 +kes Eliminate some compile warnings in dird_conf.c +kes Format the bytes field in the terminated jobs part of the status + command for the three daemons with suffixes to reduce print size + of backup bytes. Suggested by a user. +kes When not descending into a directory, print the File= name that + triggered it -- makes why not descending a bit clearer. +kes Do not unload autochanger when doing a list command -- basic code + from Eric Bollengier. +07Aug06 kes Fix bug #462 incorrect error message printed when client script called from File= was not found. kes Fix bug #558 (waiting for feedback) where Bacula needs too much time to -- 2.39.5