From 8a8d31a3ebef95e35986c9f5de81e0b095cdc5f6 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Fri, 3 Dec 2004 21:54:21 +0000 Subject: [PATCH] - Fix it so that the InChanger flag is only changed for Volumes in the same Pool. - Add PIDOF configuration path and apply to bacula.in git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1739 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/autoconf/configure.in | 3 +- bacula/configure | 44 ++++- .../patches/1.36.0/1.36.0-autochanger.patch | 41 +++++ .../patches/1.36.0/1.36.0-autochanger2.patch | 111 ++++++++++++ bacula/patches/1.36.0/1.36.0-cancel.patch | 25 +++ bacula/patches/1.36.0/1.36.0-jobdefs.patch | 51 ++++++ .../patches/1.36.0/1.36.0-jobid-restore.patch | 65 +++++++ bacula/patches/1.36.0/1.36.0-list.patch | 149 ++++++++++++++++ bacula/patches/1.36.0/1.36.0-sd-block.patch | 30 ++++ bacula/patches/1.36.0/1.36.0-tree.patch | 25 +++ bacula/patches/1.36.0/1.36.0-verify-2.patch | 47 ++++++ bacula/patches/1.36.0/1.36.0-verify.patch | 159 ++++++++++++++++++ bacula/patches/1.36.0/patches-1.36.0 | 47 ++++++ bacula/patches/1.36.1-slots.patch | 28 +++ bacula/patches/patches-1.36.1 | 9 + bacula/scripts/bacula.in | 10 +- bacula/src/cats/sql_update.c | 3 +- 17 files changed, 840 insertions(+), 7 deletions(-) create mode 100644 bacula/patches/1.36.0/1.36.0-autochanger.patch create mode 100644 bacula/patches/1.36.0/1.36.0-autochanger2.patch create mode 100644 bacula/patches/1.36.0/1.36.0-cancel.patch create mode 100644 bacula/patches/1.36.0/1.36.0-jobdefs.patch create mode 100644 bacula/patches/1.36.0/1.36.0-jobid-restore.patch create mode 100644 bacula/patches/1.36.0/1.36.0-list.patch create mode 100644 bacula/patches/1.36.0/1.36.0-sd-block.patch create mode 100644 bacula/patches/1.36.0/1.36.0-tree.patch create mode 100644 bacula/patches/1.36.0/1.36.0-verify-2.patch create mode 100644 bacula/patches/1.36.0/1.36.0-verify.patch create mode 100644 bacula/patches/1.36.0/patches-1.36.0 create mode 100644 bacula/patches/1.36.1-slots.patch create mode 100644 bacula/patches/patches-1.36.1 diff --git a/bacula/autoconf/configure.in b/bacula/autoconf/configure.in index d8003a5d4a..a087caa07b 100644 --- a/bacula/autoconf/configure.in +++ b/bacula/autoconf/configure.in @@ -64,7 +64,8 @@ AC_PATH_PROG(OPENSSL, openssl, none) AC_PATH_PROG(MTX, mtx, mtx) AC_PATH_PROG(PKGCONFIG, pkg-config, pkg-config) AC_PATH_PROG(WXCONFIG, wx-config, wx-config) -AC_PATH_PROG(CDRECORD, cdrecord) +AC_PATH_PROG(CDRECORD, cdrecord, cdrecord) +AC_PATH_PROG(PIDOF, pidof, pidof) test -n "$ARFLAG" || ARFLAGS="cr" AC_SUBST(ARFLAGS) diff --git a/bacula/configure b/bacula/configure index 829e3dc40d..302f99c5fd 100755 --- a/bacula/configure +++ b/bacula/configure @@ -308,7 +308,7 @@ ac_includes_default="\ # include #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS BUILD_DIR TRUEPRG FALSEPRG VERSION DATE LSMDATE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CXX CXXFLAGS ac_ct_CXX CPP EGREP INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA RANLIB ac_ct_RANLIB MV RM CP SED AWK ECHO CMP TBL AR OPENSSL MTX PKGCONFIG WXCONFIG CDRECORD ARFLAGS MAKE_SHELL LOCAL_LIBS LOCAL_CFLAGS LOCAL_LDFLAGS LOCAL_DEFS build build_cpu build_vendor build_os host host_cpu host_vendor host_os HAVE_SUN_OS_TRUE HAVE_SUN_OS_FALSE HAVE_OSF1_OS_TRUE HAVE_OSF1_OS_FALSE HAVE_AIX_OS_TRUE HAVE_AIX_OS_FALSE HAVE_HPUX_OS_TRUE HAVE_HPUX_OS_FALSE HAVE_LINUX_OS_TRUE HAVE_LINUX_OS_FALSE HAVE_FREEBSD_OS_TRUE HAVE_FREEBSD_OS_FALSE HAVE_NETBSD_OS_TRUE HAVE_NETBSD_OS_FALSE HAVE_OPENBSD_OS_TRUE HAVE_OPENBSD_OS_FALSE HAVE_BSDI_OS_TRUE HAVE_BSDI_OS_FALSE HAVE_SGI_OS_TRUE HAVE_SGI_OS_FALSE HAVE_IRIX_OS_TRUE HAVE_IRIX_OS_FALSE HAVE_DARWIN_OS_TRUE HAVE_DARWIN_OS_FALSE INSIDE_GNOME_COMMON_TRUE INSIDE_GNOME_COMMON_FALSE MSGFMT GNOME_INCLUDEDIR GNOMEUI_LIBS GNOME_LIBDIR GNOME_LIBS GNOMEGNORBA_LIBS GTKXMHTML_LIBS ZVT_LIBS GNOME_CONFIG ORBIT_CONFIG ORBIT_IDL HAVE_ORBIT_TRUE HAVE_ORBIT_FALSE ORBIT_CFLAGS ORBIT_LIBS HAVE_GNORBA_TRUE HAVE_GNORBA_FALSE GNORBA_CFLAGS GNORBA_LIBS GNOME_APPLETS_LIBS GNOME_DOCKLETS_LIBS GNOME_CAPPLET_LIBS GNOME_DIR WXCONS_CPPFLAGS WXCONS_LDFLAGS WX_DIR TRAY_MONITOR_CPPFLAGS TRAY_MONITOR_LDFLAGS TRAY_MONITOR_DIR TTOOL_LDFLAGS STATIC_FD STATIC_SD STATIC_DIR STATIC_CONS STATIC_GNOME_CONS STATIC_WX_CONS ALL_DIRS CONS_INC CONS_OBJ CONS_SRC CONS_LIBS CONS_LDFLAGS READLINE_SRC PYTHON_LIBS PYTHON_INCDIR CDSTL working_dir scriptdir dump_email job_email smtp_host piddir subsysdir baseport dir_port fd_port sd_port dir_password fd_password sd_password mon_dir_password mon_fd_password mon_sd_password bimagemgr_cgidir bimagemgr_docdir bimagemgr_binowner bimagemgr_bingroup bimagemgr_dataowner bimagemgr_datagroup dir_user dir_group sd_user sd_group fd_user fd_group SBINPERM SQL_LFLAGS SQL_INCLUDE SQL_BINDIR cats DB_NAME GETCONF ac_ct_GETCONF X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS LIBOBJS ALLOCA FDLIBS DEBUG DINCLUDE DLIB DB_LIBS WCFLAGS WLDFLAGS OBJLIST hostname TAPEDRIVE PSCMD WIN32 MACOSX DISTNAME DISTVER LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS BUILD_DIR TRUEPRG FALSEPRG VERSION DATE LSMDATE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CXX CXXFLAGS ac_ct_CXX CPP EGREP INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA RANLIB ac_ct_RANLIB MV RM CP SED AWK ECHO CMP TBL AR OPENSSL MTX PKGCONFIG WXCONFIG CDRECORD PIDOF ARFLAGS MAKE_SHELL LOCAL_LIBS LOCAL_CFLAGS LOCAL_LDFLAGS LOCAL_DEFS build build_cpu build_vendor build_os host host_cpu host_vendor host_os HAVE_SUN_OS_TRUE HAVE_SUN_OS_FALSE HAVE_OSF1_OS_TRUE HAVE_OSF1_OS_FALSE HAVE_AIX_OS_TRUE HAVE_AIX_OS_FALSE HAVE_HPUX_OS_TRUE HAVE_HPUX_OS_FALSE HAVE_LINUX_OS_TRUE HAVE_LINUX_OS_FALSE HAVE_FREEBSD_OS_TRUE HAVE_FREEBSD_OS_FALSE HAVE_NETBSD_OS_TRUE HAVE_NETBSD_OS_FALSE HAVE_OPENBSD_OS_TRUE HAVE_OPENBSD_OS_FALSE HAVE_BSDI_OS_TRUE HAVE_BSDI_OS_FALSE HAVE_SGI_OS_TRUE HAVE_SGI_OS_FALSE HAVE_IRIX_OS_TRUE HAVE_IRIX_OS_FALSE HAVE_DARWIN_OS_TRUE HAVE_DARWIN_OS_FALSE INSIDE_GNOME_COMMON_TRUE INSIDE_GNOME_COMMON_FALSE MSGFMT GNOME_INCLUDEDIR GNOMEUI_LIBS GNOME_LIBDIR GNOME_LIBS GNOMEGNORBA_LIBS GTKXMHTML_LIBS ZVT_LIBS GNOME_CONFIG ORBIT_CONFIG ORBIT_IDL HAVE_ORBIT_TRUE HAVE_ORBIT_FALSE ORBIT_CFLAGS ORBIT_LIBS HAVE_GNORBA_TRUE HAVE_GNORBA_FALSE GNORBA_CFLAGS GNORBA_LIBS GNOME_APPLETS_LIBS GNOME_DOCKLETS_LIBS GNOME_CAPPLET_LIBS GNOME_DIR WXCONS_CPPFLAGS WXCONS_LDFLAGS WX_DIR TRAY_MONITOR_CPPFLAGS TRAY_MONITOR_LDFLAGS TRAY_MONITOR_DIR TTOOL_LDFLAGS STATIC_FD STATIC_SD STATIC_DIR STATIC_CONS STATIC_GNOME_CONS STATIC_WX_CONS ALL_DIRS CONS_INC CONS_OBJ CONS_SRC CONS_LIBS CONS_LDFLAGS READLINE_SRC PYTHON_LIBS PYTHON_INCDIR CDSTL working_dir scriptdir dump_email job_email smtp_host piddir subsysdir baseport dir_port fd_port sd_port dir_password fd_password sd_password mon_dir_password mon_fd_password mon_sd_password bimagemgr_cgidir bimagemgr_docdir bimagemgr_binowner bimagemgr_bingroup bimagemgr_dataowner bimagemgr_datagroup dir_user dir_group sd_user sd_group fd_user fd_group SBINPERM SQL_LFLAGS SQL_INCLUDE SQL_BINDIR cats DB_NAME GETCONF ac_ct_GETCONF X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS LIBOBJS ALLOCA FDLIBS DEBUG DINCLUDE DLIB DB_LIBS WCFLAGS WLDFLAGS OBJLIST hostname TAPEDRIVE PSCMD WIN32 MACOSX DISTNAME DISTVER LTLIBOBJS' ac_subst_files='MCOMMON' # Initialize some variables set by options. @@ -3771,6 +3771,7 @@ do done done + test -z "$ac_cv_path_CDRECORD" && ac_cv_path_CDRECORD="cdrecord" ;; esac fi @@ -3784,6 +3785,46 @@ else echo "${ECHO_T}no" >&6 fi +# Extract the first word of "pidof", so it can be a program name with args. +set dummy pidof; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_PIDOF+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $PIDOF in + [\\/]* | ?:[\\/]*) + ac_cv_path_PIDOF="$PIDOF" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_PIDOF="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_path_PIDOF" && ac_cv_path_PIDOF="pidof" + ;; +esac +fi +PIDOF=$ac_cv_path_PIDOF + +if test -n "$PIDOF"; then + echo "$as_me:$LINENO: result: $PIDOF" >&5 +echo "${ECHO_T}$PIDOF" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + test -n "$ARFLAG" || ARFLAGS="cr" @@ -20111,6 +20152,7 @@ s,@MTX@,$MTX,;t t s,@PKGCONFIG@,$PKGCONFIG,;t t s,@WXCONFIG@,$WXCONFIG,;t t s,@CDRECORD@,$CDRECORD,;t t +s,@PIDOF@,$PIDOF,;t t s,@ARFLAGS@,$ARFLAGS,;t t s,@MAKE_SHELL@,$MAKE_SHELL,;t t s,@LOCAL_LIBS@,$LOCAL_LIBS,;t t diff --git a/bacula/patches/1.36.0/1.36.0-autochanger.patch b/bacula/patches/1.36.0/1.36.0-autochanger.patch new file mode 100644 index 0000000000..64e562810d --- /dev/null +++ b/bacula/patches/1.36.0/1.36.0-autochanger.patch @@ -0,0 +1,41 @@ + + This patch should fix a problem where the autochanger thinks + a Volume is in the current magazine and loops a few times then + gives up. + + Apply it to version 1.36.0 with the following: + + cd + patch -p0 <1.36.0-autochanger.patch + make + make install + +Index: src/stored/autochanger.c +=================================================================== +RCS file: /cvsroot/bacula/bacula/src/stored/autochanger.c,v +retrieving revision 1.23 +diff -u -r1.23 autochanger.c +--- src/stored/autochanger.c 19 Sep 2004 18:56:27 -0000 1.23 ++++ src/stored/autochanger.c 21 Nov 2004 22:23:26 -0000 +@@ -52,10 +52,11 @@ + { + JCR *jcr = dcr->jcr; + DEVICE *dev = dcr->dev; +- int slot = dcr->VolCatInfo.Slot; ++ int slot; + int drive = jcr->device->drive_index; + int rtn_stat = -1; /* error status */ + ++ slot = dcr->VolCatInfo.InChanger ? dcr->VolCatInfo.Slot : 0; + /* + * Handle autoloaders here. If we cannot autoload it, we + * will return FALSE to ask the sysop. +@@ -65,7 +66,7 @@ + return 0; /* For user, bail out right now */ + } + if (dir_find_next_appendable_volume(dcr)) { +- slot = dcr->VolCatInfo.Slot; ++ slot = dcr->VolCatInfo.InChanger ? dcr->VolCatInfo.Slot : 0; + } else { + slot = 0; + } diff --git a/bacula/patches/1.36.0/1.36.0-autochanger2.patch b/bacula/patches/1.36.0/1.36.0-autochanger2.patch new file mode 100644 index 0000000000..6a1d505411 --- /dev/null +++ b/bacula/patches/1.36.0/1.36.0-autochanger2.patch @@ -0,0 +1,111 @@ + + This patch fixes an autochanger problem where Bacula was trying + to access a Volume that was not in the autochanger. You *must* + also apply patch 1.36.0-autochanger.patch for this patch to work + correctly. This patch will probably also correct some problems + introduced with version 1.36 (dcrs) that make update slots + fail. + + Apply it to 1.36.0 with: + + cd + patch -p0 <1.36.0-autochanger2.patch + make + make install + ... + +Index: src/stored/dircmd.c +=================================================================== +RCS file: /cvsroot/bacula/bacula/src/stored/dircmd.c,v +retrieving revision 1.79 +diff -u -r1.79 dircmd.c +--- src/stored/dircmd.c 21 Nov 2004 13:10:16 -0000 1.79 ++++ src/stored/dircmd.c 24 Nov 2004 11:46:45 -0000 +@@ -78,6 +78,7 @@ + static void label_volume_if_ok(JCR *jcr, DEVICE *dev, char *oldname, + char *newname, char *poolname, + int Slot, int relabel); ++static bool try_autoload_device(JCR *jcr, int slot, const char *VolName); + + struct s_cmds { + const char *cmd; +@@ -373,21 +374,11 @@ + DCR *dcr = jcr->dcr; + int label_status; + ++ dcr->dev = dev; + steal_device_lock(dev, &hold, BST_WRITING_LABEL); + +- bstrncpy(dcr->VolumeName, newname, sizeof(dcr->VolumeName)); +- dcr->VolCatInfo.Slot = slot; +- if (autoload_device(dcr, 0, dir) < 0) { /* autoload if possible */ +- goto bail_out; +- } +- +- /* Ensure that the device is open -- autoload_device() closes it */ +- for ( ; !(dev->state & ST_OPENED); ) { +- if (open_dev(dev, dcr->VolumeName, OPEN_READ_WRITE) < 0) { +- bnet_fsend(dir, _("3910 Unable to open device %s. ERR=%s\n"), +- dev_name(dev), strerror_dev(dev)); +- goto bail_out; +- } ++ if (!try_autoload_device(jcr, slot, newname)) { ++ goto bail_out; /* error */ + } + + /* See what we have for a Volume */ +@@ -845,22 +836,12 @@ + BSOCK *dir = jcr->dir_bsock; + bsteal_lock_t hold; + DCR *dcr = jcr->dcr; +- ++ ++ dcr->dev = dev; + steal_device_lock(dev, &hold, BST_WRITING_LABEL); + +- dcr->VolumeName[0] = 0; +- dcr->VolCatInfo.Slot = Slot; +- if (autoload_device(dcr, 0, dir) < 0) { /* autoload if possible */ +- goto bail_out; +- } +- +- /* Ensure that the device is open -- autoload_device() closes it */ +- for ( ; !dev_state(dev, ST_OPENED); ) { +- if (open_dev(dev, dcr->VolumeName, OPEN_READ_WRITE) < 0) { +- bnet_fsend(dir, _("3910 Unable to open device \"%s\". ERR=%s\n"), +- dev_name(dev), strerror_dev(dev)); +- goto bail_out; +- } ++ if (!try_autoload_device(jcr, Slot, "")) { ++ goto bail_out; /* error */ + } + + dev->state &= ~ST_LABEL; /* force read of label */ +@@ -880,3 +861,27 @@ + give_back_device_lock(dev, &hold); + return; + } ++ ++static bool try_autoload_device(JCR *jcr, int slot, const char *VolName) ++{ ++ DCR *dcr = jcr->dcr; ++ BSOCK *dir = jcr->dir_bsock; ++ DEVICE *dev = dcr->dev; ++ ++ bstrncpy(dcr->VolumeName, VolName, sizeof(dcr->VolumeName)); ++ dcr->VolCatInfo.Slot = slot; ++ dcr->VolCatInfo.InChanger = slot > 0; ++ if (autoload_device(dcr, 0, dir) < 0) { /* autoload if possible */ ++ return false; ++ } ++ ++ /* Ensure that the device is open -- autoload_device() closes it */ ++ for ( ; !(dev->state & ST_OPENED); ) { ++ if (open_dev(dev, dcr->VolumeName, OPEN_READ_WRITE) < 0) { ++ bnet_fsend(dir, _("3910 Unable to open device %s. ERR=%s\n"), ++ dev_name(dev), strerror_dev(dev)); ++ return false; ++ } ++ } ++ return true; ++} diff --git a/bacula/patches/1.36.0/1.36.0-cancel.patch b/bacula/patches/1.36.0/1.36.0-cancel.patch new file mode 100644 index 0000000000..2b5cbc7343 --- /dev/null +++ b/bacula/patches/1.36.0/1.36.0-cancel.patch @@ -0,0 +1,25 @@ + + This patch fixes a bug in the FD when running with /lib/tls pthreads. + Apply it to version 1.36.0 with: + + cd + patch -p0 <1.36.0-cancel.patch + make + make install + ... + +Index: src/lib/jcr.c +=================================================================== +RCS file: /cvsroot/bacula/bacula/src/lib/jcr.c,v +retrieving revision 1.60 +diff -u -r1.60 jcr.c +--- src/lib/jcr.c 1 Sep 2004 19:44:29 -0000 1.60 ++++ src/lib/jcr.c 15 Nov 2004 11:32:46 -0000 +@@ -191,6 +191,7 @@ + Dmsg0(400, "Enter new_jcr\n"); + jcr = (JCR *)malloc(size); + memset(jcr, 0, size); ++ jcr->my_thread_id = pthread_self(); + jcr->msg_queue = New(dlist(item, &item->link)); + jcr->job_end_push.init(1, false); + jcr->sched_time = time(NULL); diff --git a/bacula/patches/1.36.0/1.36.0-jobdefs.patch b/bacula/patches/1.36.0/1.36.0-jobdefs.patch new file mode 100644 index 0000000000..0bb2f151e9 --- /dev/null +++ b/bacula/patches/1.36.0/1.36.0-jobdefs.patch @@ -0,0 +1,51 @@ + + This patch fixes JobDefs so that if a Storage resource is + specified in a Job, it is not overridden by the JobDefs. + Apply to 1.36.0 with: + + cd + patch -p0 <1.36.0-jobdefs.patch + make + make install + ... + + +Index: src/dird/backup.c +=================================================================== +RCS file: /cvsroot/bacula/bacula/src/dird/backup.c,v +retrieving revision 1.73 +diff -u -r1.73 backup.c +--- src/dird/backup.c 11 Nov 2004 07:55:05 -0000 1.73 ++++ src/dird/backup.c 11 Nov 2004 17:21:19 -0000 +@@ -448,6 +448,7 @@ + Client: %s\n\ + FileSet: \"%s\" %s\n\ + Pool: \"%s\"\n\ ++Storage: \"%s\"\n\ + Start time: %s\n\ + End time: %s\n\ + FD Files Written: %s\n\ +@@ -472,6 +473,7 @@ + jcr->client->hdr.name, + jcr->fileset->hdr.name, fsr->cCreateTime, + jcr->pool->hdr.name, ++ jcr->store->hdr.name, + sdt, + edt, + edit_uint64_with_commas(jcr->jr.JobFiles, ec1), +Index: src/dird/dird.c +=================================================================== +RCS file: /cvsroot/bacula/bacula/src/dird/dird.c,v +retrieving revision 1.70 +diff -u -r1.70 dird.c +--- src/dird/dird.c 22 Sep 2004 19:51:05 -0000 1.70 ++++ src/dird/dird.c 11 Nov 2004 17:21:19 -0000 +@@ -495,7 +495,7 @@ + /* Handle Storage alists specifically */ + JOB *jobdefs = job->jobdefs; + for (i=0; i < MAX_STORE; i++) { +- if (jobdefs->storage[i]) { ++ if (jobdefs->storage[i] && !job->storage[i]) { + STORE *st; + job->storage[i] = New(alist(10, not_owned_by_alist)); + foreach_alist(st, jobdefs->storage[i]) { diff --git a/bacula/patches/1.36.0/1.36.0-jobid-restore.patch b/bacula/patches/1.36.0/1.36.0-jobid-restore.patch new file mode 100644 index 0000000000..d4d7b60bef --- /dev/null +++ b/bacula/patches/1.36.0/1.36.0-jobid-restore.patch @@ -0,0 +1,65 @@ + + This patch fixes a restore to permit specifying both a JobId and + a filename or list of files to be restored. Apply to 1.36.0 with: + + cd + patch -p0 <1.36.0-jobid-restore.patch + make + make install + ... + +Index: src/dird/sql_cmds.c +=================================================================== +RCS file: /cvsroot/bacula/bacula/src/dird/sql_cmds.c,v +retrieving revision 1.43 +diff -u -r1.43 sql_cmds.c +--- src/dird/sql_cmds.c 1 Sep 2004 19:44:28 -0000 1.43 ++++ src/dird/sql_cmds.c 10 Nov 2004 20:38:46 -0000 +@@ -340,4 +340,16 @@ + "AND Path.PathId=File.PathId " + "AND Filename.FilenameId=File.FilenameId " + "ORDER BY Job.StartTime DESC LIMIT 1"; +- ++ ++const char *uar_jobids_fileindex = ++ "SELECT Job.JobId, File.FileIndex FROM Job,File,Path,Filename,Client " ++ "WHERE Job.JobId IN (%s) " ++ "AND Job.JobId=File.JobId " ++ "AND Job.StartTime<'%s' " ++ "AND Path.Path='%s' " ++ "AND Filename.Name='%s' " ++ "AND Client.Name='%s' " ++ "AND Job.ClientId=Client.ClientId " ++ "AND Path.PathId=File.PathId " ++ "AND Filename.FilenameId=File.FilenameId " ++ "ORDER BY Job.StartTime DESC LIMIT 1"; +Index: src/dird/ua_restore.c +=================================================================== +RCS file: /cvsroot/bacula/bacula/src/dird/ua_restore.c,v +retrieving revision 1.84 +diff -u -r1.84 ua_restore.c +--- src/dird/ua_restore.c 15 Oct 2004 17:09:04 -0000 1.84 ++++ src/dird/ua_restore.c 10 Nov 2004 20:38:46 -0000 +@@ -48,7 +48,7 @@ + extern char *uar_inc, *uar_list_temp, *uar_sel_jobid_temp; + extern char *uar_sel_all_temp1, *uar_sel_fileset, *uar_mediatype; + extern char *uar_jobid_fileindex, *uar_dif, *uar_sel_all_temp; +-extern char *uar_count_files; ++extern char *uar_count_files, *uar_jobids_fileindex; + + + struct NAME_LIST { +@@ -632,7 +632,12 @@ + { + strip_trailing_junk(file); + split_path_and_filename(rx, file); +- Mmsg(rx->query, uar_jobid_fileindex, date, rx->path, rx->fname, rx->ClientName); ++ if (*rx->JobIds == 0) { ++ Mmsg(rx->query, uar_jobid_fileindex, date, rx->path, rx->fname, rx->ClientName); ++ } else { ++ Mmsg(rx->query, uar_jobids_fileindex, rx->JobIds, date, ++ rx->path, rx->fname, rx->ClientName); ++ } + rx->found = false; + /* Find and insert jobid and File Index */ + if (!db_sql_query(ua->db, rx->query, jobid_fileindex_handler, (void *)rx)) { diff --git a/bacula/patches/1.36.0/1.36.0-list.patch b/bacula/patches/1.36.0/1.36.0-list.patch new file mode 100644 index 0000000000..3afd69a024 --- /dev/null +++ b/bacula/patches/1.36.0/1.36.0-list.patch @@ -0,0 +1,149 @@ + + This patch corrects a Bacula crash after a "list nextvol" followed + by "list media". + It can be applied to 1.36.0 with: + + cd + patch -p0 <1.36.0-list.patch + make + make install + + +Index: src/dird/ua_output.c +=================================================================== +RCS file: /cvsroot/bacula/bacula/src/dird/ua_output.c,v +retrieving revision 1.47 +diff -u -r1.47 ua_output.c +--- src/dird/ua_output.c 19 Sep 2004 18:56:24 -0000 1.47 ++++ src/dird/ua_output.c 13 Nov 2004 10:26:08 -0000 +@@ -42,11 +42,11 @@ + extern FILE *con_fd; + extern brwlock_t con_lock; + +- + /* Imported functions */ + + /* Forward referenced functions */ + static int do_list_cmd(UAContext *ua, const char *cmd, e_list_type llist); ++static bool list_nextvol(UAContext *ua); + + /* + * Turn auto display of console messages on/off +@@ -401,58 +401,7 @@ + /* List next volume */ + } else if (strcasecmp(ua->argk[i], _("nextvol")) == 0 || + strcasecmp(ua->argk[i], _("nextvolume")) == 0) { +- JOB *job; +- JCR *jcr = ua->jcr; +- POOL *pool; +- RUN *run; +- time_t runtime; +- bool found = false; +- +- i = find_arg_with_value(ua, "job"); +- if (i <= 0) { +- if ((job = select_job_resource(ua)) == NULL) { +- return 1; +- } +- } else { +- job = (JOB *)GetResWithName(R_JOB, ua->argv[i]); +- if (!job) { +- Jmsg(jcr, M_ERROR, 0, _("%s is not a job name.\n"), ua->argv[i]); +- if ((job = select_job_resource(ua)) == NULL) { +- return 1; +- } +- } +- } +- for (run=NULL; (run = find_next_run(run, job, runtime)); ) { +- pool = run ? run->pool : NULL; +- if (!complete_jcr_for_job(jcr, job, pool)) { +- return 1; +- } +- +- if (!find_next_volume_for_append(jcr, &mr, 0)) { +- bsendmsg(ua, _("Could not find next Volume.\n")); +- if (jcr->db) { +- db_close_database(jcr, jcr->db); +- jcr->db = NULL; +- } +- return 1; +- } else { +- bsendmsg(ua, _("The next Volume to be used by Job \"%s\" will be %s\n"), +- job->hdr.name, mr.VolumeName); +- found = true; +- } +- if (jcr->db) { +- db_close_database(jcr, jcr->db); +- jcr->db = NULL; +- } +- } +- if (jcr->db) { +- db_close_database(jcr, jcr->db); +- jcr->db = NULL; +- } +- if (!found) { +- bsendmsg(ua, _("Could not find next Volume.\n")); +- } +- return 1; ++ list_nextvol(ua); + } else { + bsendmsg(ua, _("Unknown list keyword: %s\n"), NPRT(ua->argk[i])); + } +@@ -460,6 +409,57 @@ + return 1; + } + ++static bool list_nextvol(UAContext *ua) ++{ ++ JOB *job; ++ JCR *jcr = ua->jcr; ++ POOL *pool; ++ RUN *run; ++ time_t runtime; ++ bool found = false; ++ MEDIA_DBR mr; ++ ++ memset(&mr, 0, sizeof(mr)); ++ int i = find_arg_with_value(ua, "job"); ++ if (i <= 0) { ++ if ((job = select_job_resource(ua)) == NULL) { ++ return false; ++ } ++ } else { ++ job = (JOB *)GetResWithName(R_JOB, ua->argv[i]); ++ if (!job) { ++ Jmsg(jcr, M_ERROR, 0, _("%s is not a job name.\n"), ua->argv[i]); ++ if ((job = select_job_resource(ua)) == NULL) { ++ return false; ++ } ++ } ++ } ++ for (run=NULL; (run = find_next_run(run, job, runtime)); ) { ++ pool = run ? run->pool : NULL; ++ if (!complete_jcr_for_job(jcr, job, pool)) { ++ return false; ++ } ++ ++ if (!find_next_volume_for_append(jcr, &mr, 0)) { ++ bsendmsg(ua, _("Could not find next Volume.\n")); ++ } else { ++ bsendmsg(ua, _("The next Volume to be used by Job \"%s\" will be %s\n"), ++ job->hdr.name, mr.VolumeName); ++ found = true; ++ } ++ if (jcr->db && jcr->db != ua->db) { ++ db_close_database(jcr, jcr->db); ++ jcr->db = NULL; ++ } ++ } ++ if (!found) { ++ bsendmsg(ua, _("Could not find next Volume.\n")); ++ return false; ++ } ++ return true; ++} ++ ++ + /* + * For a given job, we examine all his run records + * to see if it is scheduled today or tomorrow. diff --git a/bacula/patches/1.36.0/1.36.0-sd-block.patch b/bacula/patches/1.36.0/1.36.0-sd-block.patch new file mode 100644 index 0000000000..c6a6757806 --- /dev/null +++ b/bacula/patches/1.36.0/1.36.0-sd-block.patch @@ -0,0 +1,30 @@ + + This patch will keep the SD from blocking simultaneous Jobs during + a tape mount. + + Apply it to 1.36.0 with: + + cd + patch -p0 <1.36.0-sd-block.patch + make + ... + +Index: src/stored/acquire.c +=================================================================== +RCS file: /cvsroot/bacula/bacula/src/stored/acquire.c,v +retrieving revision 1.74 +diff -u -r1.74 acquire.c +--- src/stored/acquire.c 16 Oct 2004 11:51:32 -0000 1.74 ++++ src/stored/acquire.c 25 Oct 2004 16:12:46 -0000 +@@ -339,7 +339,10 @@ + + if (do_mount || recycle) { + Dmsg0(190, "Do mount_next_write_vol\n"); +- if (!mount_next_write_volume(dcr, release)) { ++ V(mutex); /* don't lock everything during mount */ ++ bool mounted = mount_next_write_volume(dcr, release); ++ P(mutex); /* re-lock */ ++ if (!mounted) { + if (!job_canceled(jcr)) { + /* Reduce "noise" -- don't print if job canceled */ + Jmsg(jcr, M_FATAL, 0, _("Could not ready device \"%s\" for append.\n"), diff --git a/bacula/patches/1.36.0/1.36.0-tree.patch b/bacula/patches/1.36.0/1.36.0-tree.patch new file mode 100644 index 0000000000..070cfcef36 --- /dev/null +++ b/bacula/patches/1.36.0/1.36.0-tree.patch @@ -0,0 +1,25 @@ + + This patch fixes (hopefully) a segment fault in restore when an + empty path is found for a file. + Apply it to 1.36.0 with: + + cd + patch -p0 <1.36.0-tree.patch + make + make install + +Index: src/lib/tree.c +=================================================================== +RCS file: /cvsroot/bacula/bacula/src/lib/tree.c,v +retrieving revision 1.18 +diff -u -r1.18 tree.c +--- src/lib/tree.c 16 Jul 2004 07:23:40 -0000 1.18 ++++ src/lib/tree.c 21 Nov 2004 16:03:53 -0000 +@@ -87,6 +87,7 @@ + } + Dmsg2(400, "count=%d size=%d\n", count, size); + malloc_buf(root, size); ++ root->cached_path_len = -1; + root->cached_path = get_pool_memory(PM_FNAME); + root->type = TN_ROOT; + root->fname = ""; diff --git a/bacula/patches/1.36.0/1.36.0-verify-2.patch b/bacula/patches/1.36.0/1.36.0-verify-2.patch new file mode 100644 index 0000000000..6c5d342326 --- /dev/null +++ b/bacula/patches/1.36.0/1.36.0-verify-2.patch @@ -0,0 +1,47 @@ + + This patch fixes the calculation for the total number of files + to be restored or verified by not double counting files that are + split across a tape file or across tapes. + + To apply this patch, you must first have applied 1.36.0-verify.patch. + + Apply it with: + + cd + patch -p0 <1.36.0-verify-2.patch + make + make install + ... + +Index: src/dird/bsr.c +=================================================================== +RCS file: /cvsroot/bacula/bacula/src/dird/bsr.c,v +retrieving revision 1.16 +diff -u -r1.16 bsr.c +--- src/dird/bsr.c 29 Oct 2004 22:11:43 -0000 1.16 ++++ src/dird/bsr.c 4 Nov 2004 10:37:37 -0000 +@@ -238,6 +238,8 @@ + { + uint32_t count = 0; + uint32_t total_count = 0; ++ uint32_t LastIndex = 0; ++ bool first = true; + if (bsr) { + /* + * For a given volume, loop over all the JobMedia records. +@@ -273,6 +275,15 @@ + fprintf(fd, "Count=%u\n", count); + } + total_count += count; ++ /* If the same file is present on two tapes or in two files ++ * on a tape, it is a continuation, and should not be treated ++ * twice in the totals. ++ */ ++ if (!first && LastIndex == bsr->VolParams[i].FirstIndex) { ++ total_count--; ++ } ++ first = false; ++ LastIndex = bsr->VolParams[i].LastIndex; + } + write_bsr(ua, bsr->next, fd); + } diff --git a/bacula/patches/1.36.0/1.36.0-verify.patch b/bacula/patches/1.36.0/1.36.0-verify.patch new file mode 100644 index 0000000000..4a4c5442db --- /dev/null +++ b/bacula/patches/1.36.0/1.36.0-verify.patch @@ -0,0 +1,159 @@ + + This patch fixes, at least partially, a Verify error where + the count of files expected did not agree with the count + found. There are still some cases where the expected count + exceeds the found probably due to the same directory being + examined multiple times. + + Apply the patch to 1.36.0 with: + + cd + patch -p0 <1.36.0-verify.patch + make + make install + + +Index: src/dird/bsr.c +=================================================================== +RCS file: /cvsroot/bacula/bacula/src/dird/bsr.c,v +retrieving revision 1.15 +diff -u -r1.15 bsr.c +--- src/dird/bsr.c 24 Sep 2004 15:53:00 -0000 1.15 ++++ src/dird/bsr.c 29 Oct 2004 22:05:24 -0000 +@@ -34,7 +34,7 @@ + #include "dird.h" + + /* Forward referenced functions */ +-static int write_bsr(UAContext *ua, RBSR *bsr, FILE *fd); ++static uint32_t write_bsr(UAContext *ua, RBSR *bsr, FILE *fd); + void print_bsr(UAContext *ua, RBSR *bsr); + + +@@ -178,11 +178,11 @@ + /* + * Write the bootstrap records to file + */ +-int write_bsr_file(UAContext *ua, RBSR *bsr) ++uint32_t write_bsr_file(UAContext *ua, RBSR *bsr) + { + FILE *fd; + POOLMEM *fname = get_pool_memory(PM_MESSAGE); +- int count = 0;; ++ uint32_t count = 0;; + bool err; + + Mmsg(fname, "%s/restore.bsr", working_directory); +@@ -234,9 +234,10 @@ + return count; + } + +-static int write_bsr(UAContext *ua, RBSR *bsr, FILE *fd) ++static uint32_t write_bsr(UAContext *ua, RBSR *bsr, FILE *fd) + { + uint32_t count = 0; ++ uint32_t total_count = 0; + if (bsr) { + /* + * For a given volume, loop over all the JobMedia records. +@@ -271,10 +272,11 @@ + if (count) { + fprintf(fd, "Count=%u\n", count); + } ++ total_count += count; + } + write_bsr(ua, bsr->next, fd); + } +- return count; ++ return total_count; + } + + void print_bsr(UAContext *ua, RBSR *bsr) +Index: src/dird/protos.h +=================================================================== +RCS file: /cvsroot/bacula/bacula/src/dird/protos.h,v +retrieving revision 1.54 +diff -u -r1.54 protos.h +--- src/dird/protos.h 24 Sep 2004 12:30:14 -0000 1.54 ++++ src/dird/protos.h 29 Oct 2004 22:05:24 -0000 +@@ -44,7 +44,7 @@ + RBSR *new_bsr(); + void free_bsr(RBSR *bsr); + int complete_bsr(UAContext *ua, RBSR *bsr); +-int write_bsr_file(UAContext *ua, RBSR *bsr); ++uint32_t write_bsr_file(UAContext *ua, RBSR *bsr); + void add_findex(RBSR *bsr, uint32_t JobId, int32_t findex); + RBSR_FINDEX *new_findex(); + +@@ -62,7 +62,7 @@ + + /* fd_cmds.c */ + extern int connect_to_file_daemon(JCR *jcr, int retry_interval, +- int max_retry_time, int verbose); ++ int max_retry_time, int verbose); + extern int send_include_list(JCR *jcr); + extern int send_exclude_list(JCR *jcr); + extern int send_bootstrap_file(JCR *jcr); +@@ -70,7 +70,7 @@ + extern int get_attributes_and_put_in_catalog(JCR *jcr); + extern int get_attributes_and_compare_to_catalog(JCR *jcr, JobId_t JobId); + extern int put_file_into_catalog(JCR *jcr, long file_index, char *fname, +- char *link, char *attr, int stream); ++ char *link, char *attr, int stream); + extern void get_level_since_time(JCR *jcr, char *since, int since_len); + extern int send_run_before_and_after_commands(JCR *jcr); + +@@ -97,7 +97,7 @@ + + /* msgchan.c */ + extern bool connect_to_storage_daemon(JCR *jcr, int retry_interval, +- int max_retry_time, int verbose); ++ int max_retry_time, int verbose); + extern int start_storage_daemon_job(JCR *jcr); + extern int start_storage_daemon_message_thread(JCR *jcr); + extern int bget_dirmsg(BSOCK *bs); +@@ -149,28 +149,28 @@ + void free_ua_context(UAContext *ua); + + /* ua_select.c */ +-STORE *select_storage_resource(UAContext *ua); +-JOB *select_job_resource(UAContext *ua); +-JOB *select_restore_job_resource(UAContext *ua); +-CLIENT *select_client_resource(UAContext *ua); ++STORE *select_storage_resource(UAContext *ua); ++JOB *select_job_resource(UAContext *ua); ++JOB *select_restore_job_resource(UAContext *ua); ++CLIENT *select_client_resource(UAContext *ua); + FILESET *select_fileset_resource(UAContext *ua); +-int select_pool_and_media_dbr(UAContext *ua, POOL_DBR *pr, MEDIA_DBR *mr); +-int select_media_dbr(UAContext *ua, MEDIA_DBR *mr); +-bool select_pool_dbr(UAContext *ua, POOL_DBR *pr); +-int select_client_dbr(UAContext *ua, CLIENT_DBR *cr); +- +-void start_prompt(UAContext *ua, const char *msg); +-void add_prompt(UAContext *ua, const char *prompt); +-int do_prompt(UAContext *ua, const char *automsg, const char *msg, char *prompt, int max_prompt); +-CAT *get_catalog_resource(UAContext *ua); ++int select_pool_and_media_dbr(UAContext *ua, POOL_DBR *pr, MEDIA_DBR *mr); ++int select_media_dbr(UAContext *ua, MEDIA_DBR *mr); ++bool select_pool_dbr(UAContext *ua, POOL_DBR *pr); ++int select_client_dbr(UAContext *ua, CLIENT_DBR *cr); ++ ++void start_prompt(UAContext *ua, const char *msg); ++void add_prompt(UAContext *ua, const char *prompt); ++int do_prompt(UAContext *ua, const char *automsg, const char *msg, char *prompt, int max_prompt); ++CAT *get_catalog_resource(UAContext *ua); + STORE *get_storage_resource(UAContext *ua, int use_default); +-int get_media_type(UAContext *ua, char *MediaType, int max_media); +-bool get_pool_dbr(UAContext *ua, POOL_DBR *pr); +-int get_client_dbr(UAContext *ua, CLIENT_DBR *cr); ++int get_media_type(UAContext *ua, char *MediaType, int max_media); ++bool get_pool_dbr(UAContext *ua, POOL_DBR *pr); ++int get_client_dbr(UAContext *ua, CLIENT_DBR *cr); + POOL *get_pool_resource(UAContext *ua); + POOL *select_pool_resource(UAContext *ua); + CLIENT *get_client_resource(UAContext *ua); +-int get_job_dbr(UAContext *ua, JOB_DBR *jr); ++int get_job_dbr(UAContext *ua, JOB_DBR *jr); + + int find_arg_keyword(UAContext *ua, const char **list); + int find_arg(UAContext *ua, const char *keyword); diff --git a/bacula/patches/1.36.0/patches-1.36.0 b/bacula/patches/1.36.0/patches-1.36.0 new file mode 100644 index 0000000000..c1f190b0b3 --- /dev/null +++ b/bacula/patches/1.36.0/patches-1.36.0 @@ -0,0 +1,47 @@ + +25Oct04 1.36.0-sd-block.patch + This patch will keep the SD from blocking simultaneous Jobs during + a tape mount. + +30Oct04 1.36.0-verify.patch + This patch fixes, at least partially, a Verify error where + the count of files expected did not agree with the count + found. There are still some cases where the expected count + exceeds the found probably due to the same directory being + examined multiple times. + +04Nov04 1.36.0-verify-2.patch + This patch fixes the calculation for the total number of files + to be restored or verified by not double counting files that are + split across a tape file or across tapes. + To apply this patch, you must first have applied 1.36.0-verify.patch. + +10Nov04 1.36.0-jobid-restore.patch + This patch fixes a restore to permit specifying both a JobId and + a filename or list of files to be restored. Apply to 1.36.0 with: + +11Nov04 1.36.0-jobdefs.patch + This patch fixes JobDefs so that if a Storage resource is + specified in a Job, it is not overridden by the JobDefs. + +13Nov04 1.36.0-list.patch + This patch corrects a Bacula crash after a "list nextvol" followed + by "list media". + +21Nov04 1.36.0-tree.patch + This patch fixes (hopefully) a segment fault in restore when an + empty path is found for a file. + +21Nov04 1.36.0-autochanger.patch + This patch should fix a problem where the autochanger thinks + a Volume is in the current magazine and loops a few times then + gives up. + +24Nov04 1.36.0-autochanger2.patch + This patch fixes an autochanger problem where Bacula was trying + to access a Volume that was not in the autochanger. You *must* + also apply patch 1.36.0-autochanger.patch for this patch to work + correctly. This patch will probably also correct some problems + introduced with version 1.36 (dcrs) that make update slots + fail. + diff --git a/bacula/patches/1.36.1-slots.patch b/bacula/patches/1.36.1-slots.patch new file mode 100644 index 0000000000..7042082787 --- /dev/null +++ b/bacula/patches/1.36.1-slots.patch @@ -0,0 +1,28 @@ + + This patch should fix "update slots" with two different magazines + in different pools by checking the pool when zapping the InChanger. + Apply to 1.36.1 with: + + cd + patch -p0 <1.36.1-slots.patch + make + make install + + +Index: src/cats/sql_update.c +=================================================================== +RCS file: /cvsroot/bacula/bacula/src/cats/sql_update.c,v +retrieving revision 1.52 +diff -u -r1.52 sql_update.c +--- src/cats/sql_update.c 17 Nov 2004 22:48:21 -0000 1.52 ++++ src/cats/sql_update.c 3 Dec 2004 21:11:09 -0000 +@@ -389,7 +389,8 @@ + { + if (mr->InChanger != 0 && mr->Slot != 0) { + Mmsg(mdb->cmd, "UPDATE Media SET InChanger=0 WHERE " +- "Slot=%d AND MediaId!=%u", mr->Slot, mr->MediaId); ++ "Slot=%d AND PoolId=%u AND MediaId!=%u", ++ mr->Slot, mr->PoolId, mr->MediaId); + Dmsg1(400, "%s\n", mdb->cmd); + UPDATE_DB(jcr, mdb, mdb->cmd); + } diff --git a/bacula/patches/patches-1.36.1 b/bacula/patches/patches-1.36.1 new file mode 100644 index 0000000000..3d04705f7a --- /dev/null +++ b/bacula/patches/patches-1.36.1 @@ -0,0 +1,9 @@ + +03Dec04 1.36.1-pool.patch + This patch should hold jobs in the Director's start queue if + more than one simultaneous backup job wants to use the same + Storage device with two different Pools (i.e. 2 Volumes). + +03Dec04 1.16.1-slots.patch + This patch should fix "update slots" with two different magazines + in different pools by checking the pool when zapping the InChanger. diff --git a/bacula/scripts/bacula.in b/bacula/scripts/bacula.in index 3554e5ed65..0d7996703a 100755 --- a/bacula/scripts/bacula.in +++ b/bacula/scripts/bacula.in @@ -35,6 +35,8 @@ FD_GROUP=@fd_group@ SD_USER=@sd_user@ SD_GROUP=@sd_group@ +PIDOF=@PIDOF@ + # A function to stop a program. killproc() { RC=0 @@ -120,8 +122,8 @@ pidofproc() { fi # Next try "pidof" - if [ -x /sbin/pidof ] ; then - pid=`/sbin/pidof $1` + if [ -x ${PIDOF} ] ; then + pid=`${PIDOF} $1` fi if [ "$pid" != "" ] ; then echo $pid @@ -144,8 +146,8 @@ status() { base=`basename $1` # First try "pidof" - if [ -x /sbin/pidof ] ; then - pid=`/sbin/pidof $1` + if [ -x ${PIDOF} ] ; then + pid=`${PIDOF} $1` fi if [ "$pid" != "" ] ; then echo "$base (pid $pid) is running..." diff --git a/bacula/src/cats/sql_update.c b/bacula/src/cats/sql_update.c index 48dfb254ef..d2d73c998d 100644 --- a/bacula/src/cats/sql_update.c +++ b/bacula/src/cats/sql_update.c @@ -389,7 +389,8 @@ db_make_inchanger_unique(JCR *jcr, B_DB *mdb, MEDIA_DBR *mr) { if (mr->InChanger != 0 && mr->Slot != 0) { Mmsg(mdb->cmd, "UPDATE Media SET InChanger=0 WHERE " - "Slot=%d AND MediaId!=%u", mr->Slot, mr->MediaId); + "Slot=%d AND PoolId=%u AND MediaId!=%u", + mr->Slot, mr->PoolId, mr->MediaId); Dmsg1(400, "%s\n", mdb->cmd); UPDATE_DB(jcr, mdb, mdb->cmd); } -- 2.39.5