From ff7621d5287984bda45a062a8e892d5e25999b97 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Tue, 16 Oct 2007 19:10:47 +0000 Subject: [PATCH] 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 since the status is returned on stderr on Solaris. kes Activate Close button on tray-monitor window. This fixes bug #986. kes Check for NULL item in parse_conf.c before calling it. In the case of Device, there is no item and this caused a seg fault when Device appears in the conf file. kes Add a #define __CONFIG_H when including config.h in bacula.h. This avoids pulling in config.h multiple times in some new code. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@5753 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/LICENSE | 2 +- bacula/patches/2.2.5-nextvol.patch | 29 +++++++++++++++++++ bacula/patches/2.2.5-tray-monitor.patch | 25 ++++++++++++++++ bacula/scripts/mtx-changer.in | 4 ++- bacula/src/bacula.h | 1 + bacula/src/bc_types.h | 38 ++++++++++++------------- bacula/src/dird/newvol.c | 2 +- bacula/src/lib/parse_conf.c | 8 ++++-- bacula/src/lib/res.c | 18 ++++++------ bacula/src/stored/scan.c | 20 ++++++------- bacula/technotes-2.3 | 15 ++++++++++ 11 files changed, 119 insertions(+), 43 deletions(-) create mode 100644 bacula/patches/2.2.5-nextvol.patch create mode 100644 bacula/patches/2.2.5-tray-monitor.patch diff --git a/bacula/LICENSE b/bacula/LICENSE index 83f25f9a71..d9b5fd4fb3 100644 --- a/bacula/LICENSE +++ b/bacula/LICENSE @@ -36,7 +36,7 @@ with the OpenSSL license, and so with the exception that we have made to the GPLv2 above, Bacula can be freely linked and distributed with the OpenSSL libraries. -IP rights: +Intellectual Property rights: Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe diff --git a/bacula/patches/2.2.5-nextvol.patch b/bacula/patches/2.2.5-nextvol.patch new file mode 100644 index 0000000000..27bf0d5641 --- /dev/null +++ b/bacula/patches/2.2.5-nextvol.patch @@ -0,0 +1,29 @@ + + This bug fixes the warning message that prints each time an automatic + Volume name is created. This fixes bug #979 + + This patch applies to Bacula version 2.2.5 (not to previous versions), + and can be applied with the following: + + cd + patch -p0 <2.2.5-newvol.patch + ./configure (your options) + make + ... + make install + + + +Index: src/dird/newvol.c +=================================================================== +--- src/dird/newvol.c (revision 5717) ++++ src/dird/newvol.c (working copy) +@@ -124,7 +124,7 @@ + mr->VolumeName[0] = 0; + bstrncpy(name, pr->LabelFormat, sizeof(name)); + ctx.value = 0; +- Mmsg(query, "SELECT MAX(MediaId) FROM Media,POOL WHERE Pool.PoolId=%s", ++ Mmsg(query, "SELECT MAX(MediaId) FROM Media,Pool WHERE Pool.PoolId=%s", + edit_int64(pr->PoolId, ed1)); + if (!db_sql_query(jcr->db, query.c_str(), db_int64_handler, (void *)&ctx)) { + Jmsg(jcr, M_WARNING, 0, _("SQL failed, but ignored. ERR=%s\n"), db_strerror(jcr->db)); diff --git a/bacula/patches/2.2.5-tray-monitor.patch b/bacula/patches/2.2.5-tray-monitor.patch new file mode 100644 index 0000000000..542aea74d0 --- /dev/null +++ b/bacula/patches/2.2.5-tray-monitor.patch @@ -0,0 +1,25 @@ + + This patch activates the Close button in the tray monitor window. + It fixes bug #986. + + Apply it to Bacula version 2.2.5 with: + + cd + patch -p0 <2.2.5-tray-monitor.patch + make + ... + make install + +Index: src/tray-monitor/tray-monitor.c +=================================================================== +--- src/tray-monitor/tray-monitor.c (revision 5717) ++++ src/tray-monitor/tray-monitor.c (working copy) +@@ -478,7 +478,7 @@ + gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, FALSE, 0); + + button = new_image_button("gtk-close", _("Close")); +-// g_signal_connect_swapped(G_OBJECT(button), "clicked", G_CALLBACK(gtk_widget_hide), G_OBJECT(window)); ++ g_signal_connect_swapped(G_OBJECT(button), "clicked", G_CALLBACK(gtk_widget_hide), G_OBJECT(window)); + gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, FALSE, 0); + + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); diff --git a/bacula/scripts/mtx-changer.in b/bacula/scripts/mtx-changer.in index 0b475a672d..60630a5531 100644 --- a/bacula/scripts/mtx-changer.in +++ b/bacula/scripts/mtx-changer.in @@ -57,6 +57,8 @@ OS=`uname` case ${OS} in SunOS) ready="No Additional Sense" + # Sun sed/awk etc are not sufficient, working versions are in /usr/xpg4/bin + export PATH="/usr/local/sbin:/usr/local/bin:/usr/sfw/bin:/usr/xpg4/bin:/usr/bin" ;; FreeBSD) ready="Current Driver State: at rest." @@ -108,7 +110,7 @@ make_temp_file() { wait_for_drive() { i=0 while [ $i -le 300 ]; do # Wait max 300 seconds - if mt -f $1 status | grep "${ready}" >/dev/null 2>&1; then + if mt -f $1 status 2>&1 | grep "${ready}" >/dev/null 2>&1; then break fi debug "Device $1 - not ready, retrying..." diff --git a/bacula/src/bacula.h b/bacula/src/bacula.h index fe95239896..07b1af6cea 100644 --- a/bacula/src/bacula.h +++ b/bacula/src/bacula.h @@ -48,6 +48,7 @@ #else #include "config.h" #endif +#define __CONFIG_H #define _REENTRANT 1 diff --git a/bacula/src/bc_types.h b/bacula/src/bc_types.h index 7829b6d107..cb289f2319 100644 --- a/bacula/src/bc_types.h +++ b/bacula/src/bc_types.h @@ -1,25 +1,7 @@ -/* - Define integer types for Bacula -- Kern Sibbald - - Integer types. These types should be be used in all - contexts in which the length of an integer stored on - removable media must be known regardless of the - architecture of the platform. - - Bacula types are: - - int8_t, int16_t, int32_t, int64_t - uint8_t, uint16_t, uint32_t, uint64_t - - Also, we define types such as file address lengths. - - Version $Id$ - - */ /* Bacula® - The Network Backup Solution - Copyright (C) 2000-2006 Free Software Foundation Europe e.V. + Copyright (C) 2000-2007 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. @@ -43,6 +25,24 @@ (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, Switzerland, email:ftf@fsfeurope.org. */ +/* + Define integer types for Bacula -- Kern Sibbald + + Integer types. These types should be be used in all + contexts in which the length of an integer stored on + removable media must be known regardless of the + architecture of the platform. + + Bacula types are: + + int8_t, int16_t, int32_t, int64_t + uint8_t, uint16_t, uint32_t, uint64_t + + Also, we define types such as file address lengths. + + Version $Id$ + + */ #ifndef __bc_types_INCLUDED diff --git a/bacula/src/dird/newvol.c b/bacula/src/dird/newvol.c index c66b813325..b15ade839d 100644 --- a/bacula/src/dird/newvol.c +++ b/bacula/src/dird/newvol.c @@ -124,7 +124,7 @@ static bool create_simple_name(JCR *jcr, MEDIA_DBR *mr, POOL_DBR *pr) mr->VolumeName[0] = 0; bstrncpy(name, pr->LabelFormat, sizeof(name)); ctx.value = 0; - Mmsg(query, "SELECT MAX(MediaId) FROM Media,POOL WHERE Pool.PoolId=%s", + Mmsg(query, "SELECT MAX(MediaId) FROM Media,Pool WHERE Pool.PoolId=%s", edit_int64(pr->PoolId, ed1)); if (!db_sql_query(jcr->db, query.c_str(), db_int64_handler, (void *)&ctx)) { Jmsg(jcr, M_WARNING, 0, _("SQL failed, but ignored. ERR=%s\n"), db_strerror(jcr->db)); diff --git a/bacula/src/lib/parse_conf.c b/bacula/src/lib/parse_conf.c index 8968853cb2..ac7536b173 100644 --- a/bacula/src/lib/parse_conf.c +++ b/bacula/src/lib/parse_conf.c @@ -823,7 +823,8 @@ parse_config(const char *cf, LEX_ERROR_HANDLER *scan_error, int err_type) } lex_set_error_handler_error_type(lc, err_type) ; while ((token=lex_get_token(lc, T_ALL)) != T_EOF) { - Dmsg1(900, "parse got token=%s\n", lex_tok_to_str(token)); + Dmsg3(900, "parse state=%d pass=%d got token=%s\n", state, pass, + lex_tok_to_str(token)); switch (state) { case p_none: if (token == T_EOL) { @@ -841,8 +842,11 @@ parse_config(const char *cf, LEX_ERROR_HANDLER *scan_error, int err_type) } for (i=0; resources[i].name; i++) { if (strcasecmp(resources[i].name, lc->str) == 0) { - state = p_resource; items = resources[i].items; + if (!items) { + break; + } + state = p_resource; res_type = resources[i].rcode; init_resource(res_type, items, pass); break; diff --git a/bacula/src/lib/res.c b/bacula/src/lib/res.c index 886f1a220b..728cafb3f5 100644 --- a/bacula/src/lib/res.c +++ b/bacula/src/lib/res.c @@ -1,15 +1,7 @@ -/* - * This file handles locking and seaching resources - * - * Kern Sibbald, January MM - * Split from parse_conf.c April MMV - * - * Version $Id$ - */ /* Bacula® - The Network Backup Solution - Copyright (C) 2000-2006 Free Software Foundation Europe e.V. + Copyright (C) 2000-2007 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. @@ -33,6 +25,14 @@ (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, Switzerland, email:ftf@fsfeurope.org. */ +/* + * This file handles locking and seaching resources + * + * Kern Sibbald, January MM + * Split from parse_conf.c April MMV + * + * Version $Id$ + */ #include "bacula.h" diff --git a/bacula/src/stored/scan.c b/bacula/src/stored/scan.c index e69dd94bdb..c1d033cf07 100644 --- a/bacula/src/stored/scan.c +++ b/bacula/src/stored/scan.c @@ -1,16 +1,7 @@ -/* - * - * scan.c scan a directory (on a removable file) for a valid - * Volume name. If found, open the file for append. - * - * Kern Sibbald, MMVI - * - * Version $Id$ - */ /* Bacula® - The Network Backup Solution - Copyright (C) 2006-2006 Free Software Foundation Europe e.V. + Copyright (C) 2006-2007 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. @@ -34,6 +25,15 @@ (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, Switzerland, email:ftf@fsfeurope.org. */ +/* + * + * scan.c scan a directory (on a removable file) for a valid + * Volume name. If found, open the file for append. + * + * Kern Sibbald, MMVI + * + * Version $Id$ + */ #include "bacula.h" #include "stored.h" diff --git a/bacula/technotes-2.3 b/bacula/technotes-2.3 index 184da7bed4..200d24e750 100644 --- a/bacula/technotes-2.3 +++ b/bacula/technotes-2.3 @@ -1,6 +1,21 @@ Technical notes on version 2.3 General: +16Oct07 +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 + since the status is returned on stderr on Solaris. +kes Activate Close button on tray-monitor window. This fixes + bug #986. +kes Check for NULL item in parse_conf.c before calling it. In the + case of Device, there is no item and this caused a seg fault when + Device appears in the conf file. +kes Add a #define __CONFIG_H when including config.h in bacula.h. This + avoids pulling in config.h multiple times in some new code. +12Oct07 +kes Fix spurious warning message printed when creating a volume with + a LabelFormat. This fixes bug #976. 07Oct07 kes Make maxvol-test and new more strict maxvol2-test work. kes Print JobId in all Jmsg() job output. -- 2.39.5