From ccc6c893d38802a042091e5c0ec6317ead19179f Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Tue, 3 Feb 2004 13:40:24 +0000 Subject: [PATCH] Fix setip crash + missing unlocks()+cleanups git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1028 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/ChangeLog | 75 ++- bacula/ReleaseNotes | 1 - bacula/autoconf/configure.in | 3 +- bacula/configure | 3 +- bacula/kernstodo | 12 +- bacula/platforms/redhat/bacula.spec.in | 70 ++- bacula/platforms/suse/bacula-dir.in | 8 +- bacula/platforms/suse/bacula-fd.in | 8 +- bacula/platforms/suse/bacula-sd.in | 8 +- bacula/platforms/suse/bacula.spec.in | 601 +++++++++++++++++++++++++ bacula/src/dird/job.c | 8 +- bacula/src/dird/jobq.c | 13 +- bacula/src/dird/ua_cmds.c | 2 +- bacula/src/dird/ua_dotcmds.c | 13 +- bacula/src/dird/ua_output.c | 4 +- bacula/src/dird/ua_restore.c | 8 +- bacula/src/dird/ua_status.c | 13 +- bacula/src/lib/jcr.c | 38 +- bacula/src/lib/mem_pool.c | 9 +- bacula/src/lib/parse_conf.c | 6 +- bacula/src/version.h | 4 +- 21 files changed, 814 insertions(+), 93 deletions(-) create mode 100644 bacula/platforms/suse/bacula.spec.in diff --git a/bacula/ChangeLog b/bacula/ChangeLog index 943389bad1..42f8e45ae1 100644 --- a/bacula/ChangeLog +++ b/bacula/ChangeLog @@ -1,6 +1,77 @@ - +03Feb04 +- Correct problems with jobs scheduled at a later time by hand. + Missing unlock(), backward test on pthread_create status. +- Fix setip crash reported by Alan Brown. +- Create bacula.spec.in in SuSE directory from Scott. +- Fix missing unlock() in ua_status on access denial. +- Lots of little cleanups, improving jcr use_count debug printing. +- Add EMSG to mem_pool utilization statistics. +01Feb04 +- New bacula.spec.in file from Scott +- Add Scott's spec file to the platforms/suse directory +- Modify configure.in to make platforms/suse/bacula.spec +- Do not allow a resource name to be specified twice. + +2004-01-30 Version 1.33-30Jan04 Release +30Jan04 +- Apply Jess Guardiani's second fix to list autochanger volumes without + opening the drive (necessary on FreeBSD if no tape is in the drive). +- Added Postgresql configure search libraries recommended by Alan Brown. +29Jan04 +- Reworked the command line handler in restore to walk through the + arguments one at a time. This makes the file= entries work correctly. + Also reworked the code that takes the MediaType and finds a + storage device. +26Jan04 +- I've noticed that the backups of Rufus, my development machine, can be + "stuck" for about 12 hours, then suddenly they run. In running the + debugger, I see that it was stuck on the select() statement waiting + for the Hello. Why this happens I am not sure. I re-organized the code + a bit because it didn't seem to be as robust as it could, but I cannot + explain the problem. +- As a consequence of the above, I have implemented a new bsock timer that + can be started and stopped. This is based on Nic Bellamy's new watchdog + code. The timer is set with start_bsock_timer(bsock, timeout); If the + timeout expires, the bsock will be marked as timed_out and interrupted + with a pthread_kill() on the current thread. +- Added 5 minute bsock timers to all the opening Hello/authentication + exchanges between the various daemons. +24Jan04 +- New spec file from Scott. +- New patch file from Scott for create_sqlite_database +- Fix crash in run command if invalid pool specified on the command line + and then the user cancels the Pool prompt. +- Separate Console and ConsoleFont resources in gnome2 conf files. +- Remove possibly bad ASSERTs from bnet.c +- Remove open() of device in dircmd.c, which fails on FreeBSD with + an autoloader -- thanks to Jesse Guardiani for this fix. +20Jan04 +- Remove all "hostname -s" from configure except for RedHat. Use uname -n instead. +- Implement SetIP command. +- Implement Close On Poll in Device resource on SD. +- Implement Full, Inc, and Diff Pools. +- Implement Access control lists for Consoles. +18Jan04 +- Define default working_dir as /var/bacula/working. +- Implement setip console command to set new IP address for a Client. +17Jan04 +- Implement maximum network buffer size directives. +- Good first cut at access control lists for the console. +- Optimize restore to select only latest Differential backup after + the Full, and then all following Incremental backups. Previously + everything after Full was selected. +16Jan04 +- Organize kernstodo a bit (more to be done). +- Add client IP address to BSOCK structure. +- Use bit fields where appropriate in BSOCK structure. +- Pass UAContext to ua authenticate in Director, and make it + set the appropriate console (or NULL for none). +- Tweak restore "run" argument handling and add "files" keyword. +- Add device name or Volume name to some SD messages. +15Jan04 +- First cut multiple consoles. 14Jan04 - Update kernstodo - Add quit command to restore tree handler. @@ -46,6 +117,8 @@ - Call pthread_cancel on SD msgchan only if the threadid is non-zero. 07Jan04 - Change RH autostart scripts to start in Dan's order. + +2004-01-06 Version 1.33-06Jan04 Release 06Jan04 - Correct calculation of week of month in scheduler and in scheduled listing. diff --git a/bacula/ReleaseNotes b/bacula/ReleaseNotes index 185f50dfb6..dd83a03d06 100644 --- a/bacula/ReleaseNotes +++ b/bacula/ReleaseNotes @@ -7,7 +7,6 @@ New directives: - "Close on Poll = yes/no" in SD Device resource. - "Volume Poll Interval = time-interval" in SD Device resource. - "Two EOF = yes/no" in SD Device resource. -- "Close on Poll = yes/no" in SD Device resource. - "Maximum Network Buffer Size = size" in SD Device resource. - "Maximum Network Buffer Size = size" in FD FileDaemon (or Client) resource. - "Console" new resource in Director conf file. diff --git a/bacula/autoconf/configure.in b/bacula/autoconf/configure.in index b937190b92..a2362513cc 100644 --- a/bacula/autoconf/configure.in +++ b/bacula/autoconf/configure.in @@ -1466,7 +1466,8 @@ suse) platforms/suse/Makefile \ platforms/suse/bacula-fd \ platforms/suse/bacula-sd \ - platforms/suse/bacula-dir" + platforms/suse/bacula-dir \ + platforms/suse/bacula.spec" ;; suse5) DISTNAME=suse diff --git a/bacula/configure b/bacula/configure index 578d570623..4536fa24b2 100755 --- a/bacula/configure +++ b/bacula/configure @@ -17980,7 +17980,8 @@ suse) platforms/suse/Makefile \ platforms/suse/bacula-fd \ platforms/suse/bacula-sd \ - platforms/suse/bacula-dir" + platforms/suse/bacula-dir \ + platforms/suse/bacula.spec" ;; suse5) DISTNAME=suse diff --git a/bacula/kernstodo b/bacula/kernstodo index 15452a495c..e83f1d281c 100644 --- a/bacula/kernstodo +++ b/bacula/kernstodo @@ -70,6 +70,13 @@ For 1.33 Testing/Documentation: http://howtos.linux.com/guides/nag2/x-087-2-nfs.mountd.shtml For 1.33 +- Allow "delete job jobid=xx jobid=xxx". +- Allow "delete job jobid=xxx,yyy,aaa-bbb" i.e. list + ranges. +- Implement multiple Volume in "purge jobs volume=". +- Implement a JobSet, which groups any number of jobs. If the + JobSet is started, all the jobs are started together. + Allow Pool, Level, and Schedule overrides. +- Enhance cancel to timout BSOCK packets after a specific delay. - When I restore to Windows the Created, Accessed and Modifiedtimes are those of the time of the restore, not those of the originalfile. The dates you will find in your restore log seem to be the original @@ -78,8 +85,8 @@ For 1.33 - Write a Qmsg() to be used in bnet.c to prevent recursion. Queue the message. If dequeueing toss the messages. Lock while dequeuing so that it cannot be called recursively and set dequeuing flag. -- Look at ASSERT() at 384 src/lib/bnet.c -- Add all pools in Dir conf to DB. +- Add all pools in Dir conf to DB also update them to catch changed + LabelFormats and such. - Symbolic link a directory to another one, then backup the symbolic link. - Build console in client-only build. @@ -1221,3 +1228,4 @@ Done: (see kernsdone for more)   Incremental Backup Pool = yyy   Differential Backup Pool = zzz } +- Look at ASSERT() at 384 src/lib/bnet.c diff --git a/bacula/platforms/redhat/bacula.spec.in b/bacula/platforms/redhat/bacula.spec.in index 8160b3f5be..e3f864ea63 100644 --- a/bacula/platforms/redhat/bacula.spec.in +++ b/bacula/platforms/redhat/bacula.spec.in @@ -19,6 +19,9 @@ # Whitebox Enterprise build %define wb3 0 %{?build_wb3:%define wb3 1} +# SuSE 9.0 build +%define su9 0 +%{?build_su9:%define su9 1} # database defines # set mysql for MySQL support, leave unset for sqlite support @@ -40,15 +43,29 @@ Vendor: The Bacula Team Distribution: The Bacula Team Packager: D. Scott Barninger BuildRequires: readline-devel, atk-devel, ncurses-devel, pango-devel -BuildRequires: libstdc++-devel, libtermcap-devel, libxml2-devel, zlib-devel +BuildRequires: libstdc++-devel, libxml2-devel, zlib-devel %if %{rh7} +BuildRequires: libtermcap-devel BuildRequires: gtk+-devel >= 1.2 BuildRequires: gnome-libs-devel >= 1.4 BuildRequires: glibc-devel >= 2.2 BuildRequires: ORBit-devel BuildRequires: bonobo-devel BuildRequires: GConf-devel +%else if %{su9} +BuildRequires: termcap +BuildRequires: gtk2-devel >= 2.0 +BuildRequires: libgnomeui-devel >= 2.0 +BuildRequires: glibc-devel >= 2.3 +BuildRequires: ORBit2-devel +BuildRequires: libart_lgpl-devel >= 2.0 +BuildRequires: libbonobo-devel >= 2.0 +BuildRequires: libbonoboui-devel >= 2.0 +BuildRequires: bonobo-activation-devel +BuildRequires: gconf2-devel +BuildRequires: linc-devel %else +BuildRequires: libtermcap-devel BuildRequires: gtk2-devel >= 2.0 BuildRequires: libgnomeui-devel >= 2.0 BuildRequires: glibc-devel >= 2.3 @@ -86,7 +103,7 @@ Summary: Bacula - The Network Backup Solution Group: System Environment/Daemons Provides: bacula-dir, bacula-sd, bacula-fd Requires: readline, perl, atk, ncurses, pango, libstdc++ -Requires: libtermcap, libxml2, zlib +Requires: libxml2, zlib %if %{rh7} Requires: gtk+ >= 1.2 Requires: gnome-libs >= 1.4 @@ -94,6 +111,19 @@ Requires: glibc >= 2.2 Requires: ORBit Requires: bonobo Requires: GConf +Requires: libtermcap +%else if %{su9} +Requires: gtk2 >= 2.0 +Requires: libgnomeui >= 2.0 +Requires: glibc >= 2.3 +Requires: ORBit2 +Requires: libart_lgpl >= 2.0 +Requires: libbonobo >= 2.0 +Requires: libbonoboui >= 2.0 +Requires: bonobo-activation +Requires: gconf2 +Requires: linc +Requires: termcap %else Requires: gtk2 >= 2.0 Requires: libgnomeui >= 2.0 @@ -105,6 +135,7 @@ Requires: libbonoboui >= 2.0 Requires: bonobo-activation Requires: GConf2 Requires: linc +Requires: libtermcap %endif %if %{mysql} Requires: mysql >= 3.23 @@ -193,6 +224,10 @@ your platform installed and configured before installing this package. %build +%if %{su9} +export LDFLAGS="-L/usr/lib/termcap" +%endif + cwd=${PWD} cd %{depkgs} %if ! %{mysql} @@ -235,7 +270,7 @@ cd ../../ %install cwd=${PWD} -mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d +mkdir -p $RPM_BUILD_ROOT/etc/init.d mkdir -p $RPM_BUILD_ROOT/etc/logrotate.d mkdir -p $RPM_BUILD_ROOT/usr/share/pixmaps mkdir -p $RPM_BUILD_ROOT/usr/share/gnome/apps/System @@ -273,9 +308,15 @@ rm -f $RPM_BUILD_ROOT/etc/bacula/grant_mysql_privileges %endif # install the init scripts -cp platforms/redhat/bacula-dir $RPM_BUILD_ROOT/etc/rc.d/init.d/bacula-dir -cp platforms/redhat/bacula-fd $RPM_BUILD_ROOT/etc/rc.d/init.d/bacula-fd -cp platforms/redhat/bacula-sd $RPM_BUILD_ROOT/etc/rc.d/init.d/bacula-sd +%if %{su9} +cp platforms/suse/bacula-dir $RPM_BUILD_ROOT/etc/init.d/bacula-dir +cp platforms/suse/bacula-fd $RPM_BUILD_ROOT/etc/init.d/bacula-fd +cp platforms/suse/bacula-sd $RPM_BUILD_ROOT/etc/init.d/bacula-sd +%else +cp platforms/redhat/bacula-dir $RPM_BUILD_ROOT/etc/init.d/bacula-dir +cp platforms/redhat/bacula-fd $RPM_BUILD_ROOT/etc/init.d/bacula-fd +cp platforms/redhat/bacula-sd $RPM_BUILD_ROOT/etc/init.d/bacula-sd +%endif # install the menu stuff cp scripts/bacula.png $RPM_BUILD_ROOT/usr/share/pixmaps/bacula.png @@ -333,9 +374,9 @@ cp ../%{tomsrtbt}/* $RPM_BUILD_ROOT/etc/bacula/rescue/tomsrtbt/ %attr(0754,root,root) /etc/bacula/startmysql %attr(0754,root,root) /etc/bacula/stopmysql %attr(0754,root,root) /etc/bacula/mtx-changer -%attr(0754,root,root) /etc/rc.d/init.d/bacula-dir -%attr(0754,root,root) /etc/rc.d/init.d/bacula-fd -%attr(0754,root,root) /etc/rc.d/init.d/bacula-sd +%attr(0754,root,root) /etc/init.d/bacula-dir +%attr(0754,root,root) /etc/init.d/bacula-fd +%attr(0754,root,root) /etc/init.d/bacula-sd %attr(0644,root,root) %doc COPYING ChangeLog INSTALL README ReleaseNotes doc/* %attr(0644,root,root) /usr/man/man1/* @@ -398,9 +439,9 @@ echo "Creating bacula tables..." %attr(0754,root,root) /etc/bacula/make_catalog_backup %attr(0754,root,root) /etc/bacula/make_sqlite_tables %attr(0754,root,root) /etc/bacula/mtx-changer -%attr(0754,root,root) /etc/rc.d/init.d/bacula-dir -%attr(0754,root,root) /etc/rc.d/init.d/bacula-fd -%attr(0754,root,root) /etc/rc.d/init.d/bacula-sd +%attr(0754,root,root) /etc/init.d/bacula-dir +%attr(0754,root,root) /etc/init.d/bacula-fd +%attr(0754,root,root) /etc/init.d/bacula-sd %attr(0644,root,root) %doc COPYING ChangeLog INSTALL README ReleaseNotes doc/* %attr(0644,root,root) /usr/man/man1/* @@ -452,7 +493,7 @@ echo "Creating the SQLite tables..." %defattr(-,root,root) %attr(0754,root,root) /etc/bacula/fd -%attr(0754,root,root) /etc/rc.d/init.d/bacula-fd +%attr(0754,root,root) /etc/init.d/bacula-fd %attr(0644,root,root) %doc COPYING ChangeLog INSTALL README ReleaseNotes doc/* %attr(0644,root,root) /etc/logrotate.d/bacula @@ -524,6 +565,9 @@ rm -f /etc/bacula/rescue/sfdisk rm -rf /etc/bacula/rescue/diskinfo/* %changelog +* Sat Jan 31 2004 D. Scott Barninger +- added build configuration for SuSE. +- Thanks to Matt Vollmar for his input * Sat Jan 24 2004 D. Scott Barninger - added patch for create_sqlite_database to fix the installed bindir - added execute of create_sqlite_database to post of sqlite package diff --git a/bacula/platforms/suse/bacula-dir.in b/bacula/platforms/suse/bacula-dir.in index 05fec1b712..d7a2ea7956 100755 --- a/bacula/platforms/suse/bacula-dir.in +++ b/bacula/platforms/suse/bacula-dir.in @@ -9,21 +9,19 @@ # For Bacula release @VERSION@ (@DATE@) -- @DISTNAME@ # -# Source function library -. /etc/rc.d/init.d/functions RETVAL=0 case "$1" in start) echo -n "Starting the Bacula Director: " - daemon @sbindir@/bacula-dir $2 -c @sysconfdir@/bacula-dir.conf + /sbin/startproc @sbindir@/bacula-dir $2 -c @sysconfdir@/bacula-dir.conf RETVAL=$? echo [ $RETVAL -eq 0 ] && touch @subsysdir@/bacula-dir ;; stop) echo -n "Stopping the Director daemon: " - killproc @sbindir@/bacula-dir + /sbin/killproc @sbindir@/bacula-dir RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f @subsysdir@/bacula-dir @@ -34,7 +32,7 @@ case "$1" in $0 start ;; status) - status @sbindir@/bacula-dir + /sbin/checkproc @sbindir@/bacula-dir ;; *) echo "Usage: $0 {start|stop|restart|status}" diff --git a/bacula/platforms/suse/bacula-fd.in b/bacula/platforms/suse/bacula-fd.in index 8b725bc722..72b0cecca6 100755 --- a/bacula/platforms/suse/bacula-fd.in +++ b/bacula/platforms/suse/bacula-fd.in @@ -9,20 +9,18 @@ # For Bacula release @VERSION@ (@DATE@) -- @DISTNAME@ # -# Source function library -. /etc/rc.d/init.d/functions case "$1" in start) echo -n "Starting the Bacula File daemon: " - daemon @sbindir@/bacula-fd $2 -c @sysconfdir@/bacula-fd.conf + /sbin/startproc @sbindir@/bacula-fd $2 -c @sysconfdir@/bacula-fd.conf RETVAL=$? echo [ $RETVAL -eq 0 ] && touch @subsysdir@/bacula-fd ;; stop) echo -n "Stopping the Bacula File daemon: " - killproc @sbindir@/bacula-fd + /sbin/killproc @sbindir@/bacula-fd RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f @subsysdir@/bacula-fd @@ -33,7 +31,7 @@ case "$1" in $0 start ;; status) - status @sbindir@/bacula-fd + /sbin/checkproc @sbindir@/bacula-fd ;; *) echo "Usage: $0 {start|stop|restart|status}" diff --git a/bacula/platforms/suse/bacula-sd.in b/bacula/platforms/suse/bacula-sd.in index e58287625d..d79d9e7a5e 100755 --- a/bacula/platforms/suse/bacula-sd.in +++ b/bacula/platforms/suse/bacula-sd.in @@ -9,20 +9,18 @@ # For Bacula release @VERSION@ (@DATE@) -- @DISTNAME@ # -# Source function library -. /etc/rc.d/init.d/functions case "$1" in start) echo -n "Starting the Bacula Storage daemon: " - daemon @sbindir@/bacula-sd $2 -c @sysconfdir@/bacula-sd.conf + /sbin/startproc @sbindir@/bacula-sd $2 -c @sysconfdir@/bacula-sd.conf RETVAL=$? echo [ $RETVAL -eq 0 ] && touch @subsysdir@/bacula-sd ;; stop) echo -n "Stopping the Bacula Storage daemon: " - killproc @sbindir@/bacula-sd + /sbin/killproc @sbindir@/bacula-sd RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f @subsysdir@/bacula-sd @@ -33,7 +31,7 @@ case "$1" in $0 start ;; status) - status @sbindir@/bacula-sd + /sbin/checkproc @sbindir@/bacula-sd ;; *) echo "Usage: $0 {start|stop|restart|status}" diff --git a/bacula/platforms/suse/bacula.spec.in b/bacula/platforms/suse/bacula.spec.in new file mode 100644 index 0000000000..e3f864ea63 --- /dev/null +++ b/bacula/platforms/suse/bacula.spec.in @@ -0,0 +1,601 @@ +# Platform Build Configuration + +# basic defines for every build +%define depkgs ../depkgs +%define depkgs_version 24Jul03 +%define tomsrtbt tomsrtbt-2.0.103 + +# platform defines - set one below or define the build_xxx on the command line +# RedHat builds +%define rh7 0 +%{?build_rh7:%define rh7 1} +%define rh8 0 +%{?build_rh8:%define rh8 1} +%define rh9 0 +%{?build_rh9:%define rh9 1} +# Fedora Core 1 build +%define fc1 0 +%{?build_fc1:%define fc1 1} +# Whitebox Enterprise build +%define wb3 0 +%{?build_wb3:%define wb3 1} +# SuSE 9.0 build +%define su9 0 +%{?build_su9:%define su9 1} + +# database defines +# set mysql for MySQL support, leave unset for sqlite support +%define mysql 0 +%{?build_mysql:%define mysql 1} + +Summary: Bacula - The Network Backup Solution +Name: bacula +Version: @VERSION@ +Release: 1 +Group: System Environment/Daemons +Copyright: GPL v2 +Source0:http://www.prdownloads.sourceforge.net/bacula/%{name}-%{version}.tar.gz +Source1:http://www.prdownloads.sourceforge.net/bacula/depkgs-%{depkgs_version}.tar.gz +Source2:http://www.tux.org/pub/distributions/tinylinux/tomsrtbt/%{tomsrtbt}.tar.gz +BuildRoot: %{_tmppath}/%{name}-root +URL: http://www.bacula.org/ +Vendor: The Bacula Team +Distribution: The Bacula Team +Packager: D. Scott Barninger +BuildRequires: readline-devel, atk-devel, ncurses-devel, pango-devel +BuildRequires: libstdc++-devel, libxml2-devel, zlib-devel +%if %{rh7} +BuildRequires: libtermcap-devel +BuildRequires: gtk+-devel >= 1.2 +BuildRequires: gnome-libs-devel >= 1.4 +BuildRequires: glibc-devel >= 2.2 +BuildRequires: ORBit-devel +BuildRequires: bonobo-devel +BuildRequires: GConf-devel +%else if %{su9} +BuildRequires: termcap +BuildRequires: gtk2-devel >= 2.0 +BuildRequires: libgnomeui-devel >= 2.0 +BuildRequires: glibc-devel >= 2.3 +BuildRequires: ORBit2-devel +BuildRequires: libart_lgpl-devel >= 2.0 +BuildRequires: libbonobo-devel >= 2.0 +BuildRequires: libbonoboui-devel >= 2.0 +BuildRequires: bonobo-activation-devel +BuildRequires: gconf2-devel +BuildRequires: linc-devel +%else +BuildRequires: libtermcap-devel +BuildRequires: gtk2-devel >= 2.0 +BuildRequires: libgnomeui-devel >= 2.0 +BuildRequires: glibc-devel >= 2.3 +BuildRequires: ORBit2-devel +BuildRequires: libart_lgpl-devel >= 2.0 +BuildRequires: libbonobo-devel >= 2.0 +BuildRequires: libbonoboui-devel >= 2.0 +BuildRequires: bonobo-activation-devel +BuildRequires: GConf2-devel +BuildRequires: linc-devel +%endif + +%if %{mysql} +BuildRequires: mysql-devel >= 3.23 +%endif + +%description +Bacula - It comes by night and sucks the vital essence from your computers. + +Bacula is a set of computer programs that permit you (or the system +administrator) to manage backup, recovery, and verification of computer +data across a network of computers of different kinds. In technical terms, +it is a network client/server based backup program. Bacula is relatively +easy to use and efficient, while offering many advanced storage management +features that make it easy to find and recover lost or damaged files. +Bacula source code has been released under the GPL version 2 license. + +%if %{mysql} +%package mysql +%else +%package sqlite +%endif + +Summary: Bacula - The Network Backup Solution +Group: System Environment/Daemons +Provides: bacula-dir, bacula-sd, bacula-fd +Requires: readline, perl, atk, ncurses, pango, libstdc++ +Requires: libxml2, zlib +%if %{rh7} +Requires: gtk+ >= 1.2 +Requires: gnome-libs >= 1.4 +Requires: glibc >= 2.2 +Requires: ORBit +Requires: bonobo +Requires: GConf +Requires: libtermcap +%else if %{su9} +Requires: gtk2 >= 2.0 +Requires: libgnomeui >= 2.0 +Requires: glibc >= 2.3 +Requires: ORBit2 +Requires: libart_lgpl >= 2.0 +Requires: libbonobo >= 2.0 +Requires: libbonoboui >= 2.0 +Requires: bonobo-activation +Requires: gconf2 +Requires: linc +Requires: termcap +%else +Requires: gtk2 >= 2.0 +Requires: libgnomeui >= 2.0 +Requires: glibc >= 2.3 +Requires: ORBit2 +Requires: libart_lgpl >= 2.0 +Requires: libbonobo >= 2.0 +Requires: libbonoboui >= 2.0 +Requires: bonobo-activation +Requires: GConf2 +Requires: linc +Requires: libtermcap +%endif +%if %{mysql} +Requires: mysql >= 3.23 +Requires: mysql-server >= 3.23 +%endif + +%if %{mysql} +%description mysql +%else +%description sqlite +%endif + +Bacula - It comes by night and sucks the vital essence from your computers. + +Bacula is a set of computer programs that permit you (or the system +administrator) to manage backup, recovery, and verification of computer +data across a network of computers of different kinds. In technical terms, +it is a network client/server based backup program. Bacula is relatively +easy to use and efficient, while offering many advanced storage management +features that make it easy to find and recover lost or damaged files. +Bacula source code has been released under the GPL version 2 license. + +%if %{mysql} +This build requires MySQL to be installed separately as the catalog database. +%else +This build incorporates sqlite as the catalog database, statically compiled. +%endif + +%package client +Summary: Bacula - The Network Backup Solution +Group: System Environment/Daemons +Provides: bacula-fd +Requires: readline, perl, libstdc++, zlib +%if %{rh7} +Requires: gtk+ >= 1.2 +Requires: gnome-libs >= 1.4 +Requires: glibc >= 2.2 +%else +Requires: gtk2 >= 2.0 +Requires: libgnomeui >= 2.0 +Requires: glibc >= 2.3 +%endif + +%description client +Bacula - It comes by night and sucks the vital essence from your computers. + +Bacula is a set of computer programs that permit you (or the system +administrator) to manage backup, recovery, and verification of computer +data across a network of computers of different kinds. In technical terms, +it is a network client/server based backup program. Bacula is relatively +easy to use and efficient, while offering many advanced storage management +features that make it easy to find and recover lost or damaged files. +Bacula source code has been released under the GPL version 2 license. + +This is the File daemon (Client) only package. + +%package rescue + +Summary: Bacula - The Network Backup Solution +Group: System Environment/Daemons +Requires: coreutils, util-linux, libc5, bacula-fd + +%description rescue +Bacula - It comes by night and sucks the vital essence from your computers. + +Bacula is a set of computer programs that permit you (or the system +administrator) to manage backup, recovery, and verification of computer +data across a network of computers of different kinds. In technical terms, +it is a network client/server based backup program. Bacula is relatively +easy to use and efficient, while offering many advanced storage management +features that make it easy to find and recover lost or damaged files. +Bacula source code has been released under the GPL version 2 license. + +This package installs scripts for disaster recovery and builds rescue +floppy disks for bare metal recovery. This package includes tomsrtbt +(http://www.toms.net/rb/, by Tom Oehser, Tom@Toms.NET) to provide a tool +to build a boot floppy disk. + +You need to have the bacula-sqlite, bacula-mysql or bacula-client package for +your platform installed and configured before installing this package. + +%prep + +%setup -b 1 +%setup -b 2 + +%build + +%if %{su9} +export LDFLAGS="-L/usr/lib/termcap" +%endif + +cwd=${PWD} +cd %{depkgs} +%if ! %{mysql} +make sqlite +%endif +make mtx +cd ${cwd} + +# patch the make_sqlite_tables script for installation bindir +patch src/cats/make_sqlite_tables.in src/cats/make_sqlite_tables.in.patch + +# patch the create_sqlite_database script for installation bindir +patch src/cats/create_sqlite_database.in src/cats/create_sqlite_database.in.patch + +# patch the make_catalog_backup script for installation bindir +patch src/cats/make_catalog_backup.in src/cats/make_catalog_backup.in.patch + +%configure \ + --prefix=/usr \ + --sbindir=/usr/sbin \ + --sysconfdir=/etc/bacula \ + --with-scriptdir=/etc/bacula \ + --enable-smartalloc \ + --enable-gnome \ + --enable-static-fd \ +%if %{mysql} + --with-mysql \ +%else + --with-sqlite=${cwd}/../depkgs/sqlite \ +%endif + --with-working-dir=/var/bacula \ + --with-pid-dir=/var/run \ + --with-subsys-dir=/var/lock/subsys +make + +cd src/filed +strip static-bacula-fd +cd ../../ + +%install + +cwd=${PWD} +mkdir -p $RPM_BUILD_ROOT/etc/init.d +mkdir -p $RPM_BUILD_ROOT/etc/logrotate.d +mkdir -p $RPM_BUILD_ROOT/usr/share/pixmaps +mkdir -p $RPM_BUILD_ROOT/usr/share/gnome/apps/System +mkdir -p $RPM_BUILD_ROOT/usr/share/applications +mkdir -p $RPM_BUILD_ROOT/etc/bacula/rescue +mkdir -p $RPM_BUILD_ROOT/etc/bacula/rescue/tomsrtbt + +%if ! %{mysql} +mkdir -p $RPM_BUILD_ROOT/usr/lib/sqlite +%endif + +make \ + prefix=$RPM_BUILD_ROOT/usr \ + sbindir=$RPM_BUILD_ROOT/usr/sbin \ + sysconfdir=$RPM_BUILD_ROOT/etc/bacula \ + scriptdir=$RPM_BUILD_ROOT/etc/bacula \ + working_dir=$RPM_BUILD_ROOT/var/bacula \ + install + +cd %{depkgs} +make \ + prefix=$RPM_BUILD_ROOT/usr \ + sbindir=$RPM_BUILD_ROOT/usr/sbin \ + sysconfdir=$RPM_BUILD_ROOT/etc/bacula \ + working_dir=$RPM_BUILD_ROOT/var/bacula \ + mandir=$RPM_BUILD_ROOT/usr/man \ + mtx-install +cd ${cwd} + +%if ! %{mysql} +# fixme - make installs the mysql scripts for sqlite build +rm -f $RPM_BUILD_ROOT/etc/bacula/startmysql +rm -f $RPM_BUILD_ROOT/etc/bacula/stopmysql +rm -f $RPM_BUILD_ROOT/etc/bacula/grant_mysql_privileges +%endif + +# install the init scripts +%if %{su9} +cp platforms/suse/bacula-dir $RPM_BUILD_ROOT/etc/init.d/bacula-dir +cp platforms/suse/bacula-fd $RPM_BUILD_ROOT/etc/init.d/bacula-fd +cp platforms/suse/bacula-sd $RPM_BUILD_ROOT/etc/init.d/bacula-sd +%else +cp platforms/redhat/bacula-dir $RPM_BUILD_ROOT/etc/init.d/bacula-dir +cp platforms/redhat/bacula-fd $RPM_BUILD_ROOT/etc/init.d/bacula-fd +cp platforms/redhat/bacula-sd $RPM_BUILD_ROOT/etc/init.d/bacula-sd +%endif + +# install the menu stuff +cp scripts/bacula.png $RPM_BUILD_ROOT/usr/share/pixmaps/bacula.png +cp scripts/bacula.desktop.gnome1 $RPM_BUILD_ROOT/usr/share/gnome/apps/System/bacula.desktop +cp scripts/bacula.desktop.gnome2 $RPM_BUILD_ROOT/usr/share/applications/bacula.desktop + +# install sqlite +%if ! %{mysql} +cp ../depkgs/sqlite/sqlite $RPM_BUILD_ROOT/usr/lib/sqlite/sqlite +cp ../depkgs/sqlite/sqlite.h $RPM_BUILD_ROOT/usr/lib/sqlite/sqlite.h +cp ../depkgs/sqlite/libsqlite.a $RPM_BUILD_ROOT/usr/lib/sqlite/libsqlite.a +%endif + +# install the logrotate file +cp scripts/logrotate $RPM_BUILD_ROOT/etc/logrotate.d/bacula + +# install the rescue stuff +# these are the rescue scripts +cp rescue/linux/backup.etc.list $RPM_BUILD_ROOT/etc/bacula/rescue/ +cp rescue/linux/format_floppy $RPM_BUILD_ROOT/etc/bacula/rescue/ +cp rescue/linux/getdiskinfo $RPM_BUILD_ROOT/etc/bacula/rescue/ +cp rescue/linux/make_rescue_disk $RPM_BUILD_ROOT/etc/bacula/rescue/ +cp rescue/linux/restore_bacula $RPM_BUILD_ROOT/etc/bacula/rescue/ +cp rescue/linux/restore_etc $RPM_BUILD_ROOT/etc/bacula/rescue/ +cp rescue/linux/run_grub $RPM_BUILD_ROOT/etc/bacula/rescue/ +cp rescue/linux/run_lilo $RPM_BUILD_ROOT/etc/bacula/rescue/ +cp rescue/linux/sfdisk.bz2 $RPM_BUILD_ROOT/etc/bacula/rescue/ + +# this is the static file daemon +cp src/filed/static-bacula-fd $RPM_BUILD_ROOT/etc/bacula/rescue/bacula-fd + +# this is the tom's root boot disk +cp ../%{tomsrtbt}/* $RPM_BUILD_ROOT/etc/bacula/rescue/tomsrtbt/ + +%clean +[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "$RPM_BUILD_ROOT" + +%if %{mysql} + +%files mysql +%defattr(-,root,root) + +%attr(0754,root,root) /etc/bacula/bacula +%attr(0754,root,root) /etc/bacula/console +%attr(0754,root,root) /etc/bacula/fd +%attr(0754,root,root) /etc/bacula/gconsole +%attr(0754,root,root) /etc/bacula/create_mysql_database +%attr(0754,root,root) /etc/bacula/delete_catalog_backup +%attr(0754,root,root) /etc/bacula/drop_bacula_tables +%attr(0754,root,root) /etc/bacula/drop_mysql_tables +%attr(0754,root,root) /etc/bacula/make_bacula_tables +%attr(0754,root,root) /etc/bacula/make_catalog_backup +%attr(0754,root,root) /etc/bacula/make_mysql_tables +%attr(0754,root,root) /etc/bacula/grant_mysql_privileges +%attr(0754,root,root) /etc/bacula/startmysql +%attr(0754,root,root) /etc/bacula/stopmysql +%attr(0754,root,root) /etc/bacula/mtx-changer +%attr(0754,root,root) /etc/init.d/bacula-dir +%attr(0754,root,root) /etc/init.d/bacula-fd +%attr(0754,root,root) /etc/init.d/bacula-sd + +%attr(0644,root,root) %doc COPYING ChangeLog INSTALL README ReleaseNotes doc/* +%attr(0644,root,root) /usr/man/man1/* +%attr(0644,root,root) /usr/share/pixmaps/bacula.png +%attr(0644,root,root) /usr/share/gnome/apps/System/bacula.desktop +%attr(0644,root,root) /usr/share/applications/bacula.desktop +%attr(0644,root,root) %config(noreplace) /etc/bacula/gnome-console.conf +%attr(0644,root,root) /etc/logrotate.d/bacula + +%attr(0640,root,root) %config(noreplace) /etc/bacula/bacula-dir.conf +%attr(0640,root,root) %config(noreplace) /etc/bacula/bacula-fd.conf +%attr(0640,root,root) %config(noreplace) /etc/bacula/bacula-sd.conf +%attr(0640,root,root) %config(noreplace) /etc/bacula/console.conf +%attr(0640,root,root) /etc/bacula/query.sql +%attr(0640,root,root) %dir /var/bacula + +%attr(0750,root,root) /usr/sbin/* + +%post mysql +# delete then add our links +/sbin/chkconfig --del bacula-dir +/sbin/chkconfig --del bacula-fd +/sbin/chkconfig --del bacula-sd +/sbin/chkconfig --add bacula-dir +/sbin/chkconfig --add bacula-fd +/sbin/chkconfig --add bacula-sd + +# add execute permissions for console +chmod 0755 /usr/sbin/gnome-console + +# grant privileges and create tables +# this will error out harmlessly if tables already exist +echo "Granting privileges for MySQL user bacula..." +/etc/bacula/grant_mysql_privileges +echo "Creating MySQL bacula database..." +/etc/bacula/create_mysql_database +echo "Creating bacula tables..." +/etc/bacula/make_mysql_tables + +%preun mysql +# delete our links +/sbin/chkconfig --del bacula-dir +/sbin/chkconfig --del bacula-fd +/sbin/chkconfig --del bacula-sd + +%else + +%files sqlite +%defattr(-,root,root) + +%attr(0754,root,root) /etc/bacula/bacula +%attr(0754,root,root) /etc/bacula/console +%attr(0754,root,root) /etc/bacula/fd +%attr(0754,root,root) /etc/bacula/gconsole +%attr(0754,root,root) /etc/bacula/create_sqlite_database +%attr(0754,root,root) /etc/bacula/delete_catalog_backup +%attr(0754,root,root) /etc/bacula/drop_bacula_tables +%attr(0754,root,root) /etc/bacula/drop_sqlite_tables +%attr(0754,root,root) /etc/bacula/make_bacula_tables +%attr(0754,root,root) /etc/bacula/make_catalog_backup +%attr(0754,root,root) /etc/bacula/make_sqlite_tables +%attr(0754,root,root) /etc/bacula/mtx-changer +%attr(0754,root,root) /etc/init.d/bacula-dir +%attr(0754,root,root) /etc/init.d/bacula-fd +%attr(0754,root,root) /etc/init.d/bacula-sd + +%attr(0644,root,root) %doc COPYING ChangeLog INSTALL README ReleaseNotes doc/* +%attr(0644,root,root) /usr/man/man1/* +%attr(0644,root,root) /usr/share/pixmaps/bacula.png +%attr(0644,root,root) /usr/share/gnome/apps/System/bacula.desktop +%attr(0644,root,root) /usr/share/applications/bacula.desktop +%attr(0644,root,root) %config(noreplace) /etc/bacula/gnome-console.conf +%attr(0644,root,root) /etc/logrotate.d/bacula + +%attr(0640,root,root) %config(noreplace) /etc/bacula/bacula-dir.conf +%attr(0640,root,root) %config(noreplace) /etc/bacula/bacula-fd.conf +%attr(0640,root,root) %config(noreplace) /etc/bacula/bacula-sd.conf +%attr(0640,root,root) %config(noreplace) /etc/bacula/console.conf +%attr(0640,root,root) /etc/bacula/query.sql +%attr(0640,root,root) /usr/lib/sqlite/libsqlite.a +%attr(0640,root,root) /usr/lib/sqlite/sqlite.h +%attr(0640,root,root) %dir /var/bacula + +%attr(0750,root,root) /usr/sbin/* +%attr(0750,root,root) /usr/lib/sqlite/sqlite + +%post sqlite +# delete then add our links +/sbin/chkconfig --del bacula-dir +/sbin/chkconfig --del bacula-fd +/sbin/chkconfig --del bacula-sd +/sbin/chkconfig --add bacula-dir +/sbin/chkconfig --add bacula-fd +/sbin/chkconfig --add bacula-sd + +# add execute permission for console +chmod 0755 /usr/sbin/gnome-console + +# create the database and tables +echo "Creating SQLite database..." +/etc/bacula/create_sqlite_database +echo "Creating the SQLite tables..." +/etc/bacula/make_sqlite_tables + +%preun sqlite +# delete our links +/sbin/chkconfig --del bacula-dir +/sbin/chkconfig --del bacula-fd +/sbin/chkconfig --del bacula-sd + +%endif + +%files client +%defattr(-,root,root) + +%attr(0754,root,root) /etc/bacula/fd +%attr(0754,root,root) /etc/init.d/bacula-fd + +%attr(0644,root,root) %doc COPYING ChangeLog INSTALL README ReleaseNotes doc/* +%attr(0644,root,root) /etc/logrotate.d/bacula + +%attr(0640,root,root) %config(noreplace) /etc/bacula/bacula-fd.conf +%attr(0640,root,root) %dir /var/bacula + +%attr(0750,root,root) /usr/sbin/bacula-fd +%attr(0750,root,root) /usr/sbin/btraceback +%attr(0750,root,root) /usr/sbin/btraceback.gdb +%attr(0750,root,root) /usr/sbin/smtp + + +%post client +# delete then add our links +/sbin/chkconfig --del bacula-fd +/sbin/chkconfig --add bacula-fd + +%preun client +# delete our links +/sbin/chkconfig --del bacula-fd + +%files rescue +%defattr(-,root,root) +%attr(0644,root,root) /etc/bacula/rescue/backup.etc.list +%attr(0754,root,root) /etc/bacula/rescue/format_floppy +%attr(0754,root,root) /etc/bacula/rescue/getdiskinfo +%attr(0754,root,root) /etc/bacula/rescue/make_rescue_disk +%attr(0754,root,root) /etc/bacula/rescue/restore_bacula +%attr(0754,root,root) /etc/bacula/rescue/restore_etc +%attr(0754,root,root) /etc/bacula/rescue/run_grub +%attr(0754,root,root) /etc/bacula/rescue/run_lilo +%attr(0644,root,root) /etc/bacula/rescue/sfdisk.bz2 +%attr(0754,root,root) /etc/bacula/rescue/bacula-fd +/etc/bacula/rescue/tomsrtbt/* + +%post rescue +# link our current installed conf file to the rescue directory +ln -s /etc/bacula-fd.conf /etc/bacula/rescue/bacula-fd.conf + +echo +echo "Ready to create the rescue files for this system." +echo "Press to continue..." +read A +echo + +# run getdiskinfo +echo "Running getdiskinfo..." +cd /etc/bacula/rescue +./getdiskinfo + +echo +echo "Finished." +echo "To create a boot disk run \"./install.s\" from the /etc/bacula/rescue/tomsrtbt/" +echo "directory. To make the bacula rescue disk run" +echo "\"./make_rescue_disk --copy-static-bacula --copy-etc-files\" " +echo "from the /etc/bacula/rescue directory. To recreate the rescue" +echo "information for this system run ./getdiskinfo again." +echo + +%preun rescue +# remove the files created after the initial rpm installation +rm -f /etc/bacula/rescue/bacula-fd.conf +rm -f /etc/bacula/rescue/partition.* +rm -f /etc/bacula/rescue/format.* +rm -f /etc/bacula/rescue/mount_drives +rm -f /etc/bacula/rescue/start_network +rm -f /etc/bacula/rescue/sfdisk +rm -rf /etc/bacula/rescue/diskinfo/* + +%changelog +* Sat Jan 31 2004 D. Scott Barninger +- added build configuration for SuSE. +- Thanks to Matt Vollmar for his input +* Sat Jan 24 2004 D. Scott Barninger +- added patch for create_sqlite_database to fix the installed bindir +- added execute of create_sqlite_database to post of sqlite package +* Sat Jan 10 2004 D. Scott Barninger +- added virtual package Provides bacula-dir, bacula-sd, bacula-fd +- added bacula-fd as Requires for rescue package +- added build tag for Fedora Core 1 +- cleaned up dependancies for all builds +* Thu Jan 1 2004 D. Scott Barninger +- removed rh_version from package names +- added platform build configuration section to beginning of file +* Tue Nov 25 2003 D. Scott Barninger +- removed make_static_bacula script from rescue package install +* Sun Nov 23 2003 D. Scott Barninger +- Added define at top of file for depkgs version +- Added rescue sub-package +- Moved requires statements into proper sub-package locations +* Mon Oct 27 2003 D. Scott Barninger +- Corrected Requires for Gnome 1.4/2.0 builds +* Fri Oct 24 2003 D. Scott Barninger +- Added separate Source declaration for depkgs +- added patch for make_catalog_backup script +* Mon May 11 2003 D. Scott Barninger +- Misc changes to mysql/sqlite build and rh7/8 menu differences +- Added rh_version to sub-package names +- Added installed but missing file /etc/bacula/gconsole +- rm'd /etc/bacula/grant_mysql_privileges on sqlite builds +* Thu May 08 2003 Kern Sibbald +- Update spec for version 1.31 and combine client +* Sun Mar 30 2003 D. Scott Barninger +- Initial spec file diff --git a/bacula/src/dird/job.c b/bacula/src/dird/job.c index 2518daf0a3..b0f5467f6c 100644 --- a/bacula/src/dird/job.c +++ b/bacula/src/dird/job.c @@ -85,7 +85,7 @@ static void job_monitor_watchdog(watchdog_t *self) control_jcr = (JCR *) self->data; - Dmsg1(200, "job_monitor_watchdog %p called\n", self); + Dmsg1(400, "job_monitor_watchdog %p called\n", self); lock_jcr_chain(); @@ -93,7 +93,7 @@ static void job_monitor_watchdog(watchdog_t *self) bool cancel; if (jcr->JobId == 0) { - Dmsg2(200, "Skipping JCR %p (%s) with JobId 0\n", + Dmsg2(400, "Skipping JCR %p (%s) with JobId 0\n", jcr, jcr->Job); /* Keep reference counts correct */ free_locked_jcr(jcr); @@ -291,7 +291,6 @@ void run_job(JCR *jcr) goto bail_out; } jcr->JobId = jcr->jr.JobId; - ASSERT(jcr->jr.JobId > 0); Dmsg4(50, "Created job record JobId=%d Name=%s Type=%c Level=%c\n", jcr->JobId, jcr->Job, jcr->jr.Type, jcr->jr.Level); @@ -299,7 +298,8 @@ void run_job(JCR *jcr) /* Queue the job to be run */ if ((stat = jobq_add(&job_queue, jcr)) != 0) { - Emsg1(M_ABORT, 0, _("Could not add job queue: ERR=%s\n"), strerror(stat)); + Jmsg(jcr, M_FATAL, 0, _("Could not add job queue: ERR=%s\n"), strerror(stat)); + goto bail_out; } Dmsg0(100, "Done run_job()\n"); diff --git a/bacula/src/dird/jobq.c b/bacula/src/dird/jobq.c index 1d98d95535..c283871b8f 100755 --- a/bacula/src/dird/jobq.c +++ b/bacula/src/dird/jobq.c @@ -197,20 +197,20 @@ int jobq_add(jobq_t *jq, JCR *jcr) wait_pkt *sched_pkt; - Dmsg1(100, "jobq_add jobid=%d\n", jcr->JobId); if (jq->valid != JOBQ_VALID) { return EINVAL; } jcr->use_count++; /* mark jcr in use by us */ + Dmsg3(100, "jobq_add jobid=%d jcr=0x%x use_count=%d\n", jcr->JobId, jcr, jcr->use_count); if (!job_canceled(jcr) && wtime > 0) { set_thread_concurrency(jq->max_workers + 2); sched_pkt = (wait_pkt *)malloc(sizeof(wait_pkt)); sched_pkt->jcr = jcr; sched_pkt->jq = jq; stat = pthread_create(&id, &jq->attr, sched_wait, (void *)sched_pkt); - if (!stat) { /* thread not created */ + if (stat != 0) { /* thread not created */ jcr->use_count--; /* release jcr */ } return stat; @@ -233,7 +233,7 @@ int jobq_add(jobq_t *jq, JCR *jcr) Dmsg1(100, "Prepended job=%d to ready queue\n", jcr->JobId); } else { /* Add this job to the wait queue in priority sorted order */ - foreach_dlist (li, jq->waiting_jobs) { + foreach_dlist(li, jq->waiting_jobs) { Dmsg2(100, "waiting item jobid=%d priority=%d\n", li->jcr->JobId, li->jcr->JobPriority); if (li->jcr->JobPriority > jcr->JobPriority) { @@ -274,7 +274,7 @@ int jobq_remove(jobq_t *jq, JCR *jcr) bool found = false; jobq_item_t *item; - Dmsg1(100, "jobq_remove jobid=%d\n", jcr->JobId); + Dmsg2(100, "jobq_remove jobid=%d jcr=0x%x\n", jcr->JobId, jcr); if (jq->valid != JOBQ_VALID) { return EINVAL; } @@ -283,19 +283,22 @@ int jobq_remove(jobq_t *jq, JCR *jcr) return stat; } - foreach_dlist (item, jq->waiting_jobs) { + foreach_dlist(item, jq->waiting_jobs) { if (jcr == item->jcr) { found = true; break; } } if (!found) { + pthread_mutex_unlock(&jq->mutex); + Dmsg2(100, "jobq_remove jobid=%d jcr=0x%x not in wait queue\n", jcr->JobId, jcr); return EINVAL; } /* Move item to be the first on the list */ jq->waiting_jobs->remove(item); jq->ready_jobs->prepend(item); + Dmsg2(100, "jobq_remove jobid=%d jcr=0x%x moved to ready queue\n", jcr->JobId, jcr); stat = start_server(jq); diff --git a/bacula/src/dird/ua_cmds.c b/bacula/src/dird/ua_cmds.c index 350631b88d..954ac237f6 100644 --- a/bacula/src/dird/ua_cmds.c +++ b/bacula/src/dird/ua_cmds.c @@ -554,7 +554,7 @@ static int create_cmd(UAContext *ua, char *cmd) static int setip_cmd(UAContext *ua, char *cmd) { CLIENT *client; - if (!ua->cons && acl_access_ok(ua, Client_ACL, ua->cons->hdr.name)) { + if (!ua->cons || !acl_access_ok(ua, Client_ACL, ua->cons->hdr.name)) { bsendmsg(ua, _("Illegal command from this console.\n")); return 1; } diff --git a/bacula/src/dird/ua_dotcmds.c b/bacula/src/dird/ua_dotcmds.c index 698ec67f0a..96fc81cf99 100644 --- a/bacula/src/dird/ua_dotcmds.c +++ b/bacula/src/dird/ua_dotcmds.c @@ -79,14 +79,13 @@ static struct cmdstruct commands[] = { */ int do_a_dot_command(UAContext *ua, char *cmd) { - unsigned int i; + int i; int len, stat; - int found; + bool found = false; - found = 0; stat = 1; - Dmsg1(200, "Dot command: %s\n", ua->UA_sock->msg); + Dmsg1(400, "Dot command: %s\n", ua->UA_sock->msg); if (ua->argc == 0) { return 1; } @@ -95,15 +94,15 @@ int do_a_dot_command(UAContext *ua, char *cmd) if (len == 1) { return 1; /* no op */ } - for (i=0; iargk[0], _(commands[i].key), len) == 0) { stat = (*commands[i].func)(ua, cmd); /* go execute command */ - found = 1; + found = true; break; } } if (!found) { - strcat(ua->UA_sock->msg, _(": is an illegal command\n")); + pm_strcat(&ua->UA_sock->msg, _(": is an illegal command\n")); ua->UA_sock->msglen = strlen(ua->UA_sock->msg); bnet_send(ua->UA_sock); } diff --git a/bacula/src/dird/ua_output.c b/bacula/src/dird/ua_output.c index d20a42fdc4..55d81ebb9c 100644 --- a/bacula/src/dird/ua_output.c +++ b/bacula/src/dird/ua_output.c @@ -441,8 +441,6 @@ RUN *find_next_run(RUN *run, JOB *job, time_t &runtime) int woy, twoy; int tod, tom; - Dmsg0(200, "enter find_runs()\n"); - sched = job->schedule; if (sched == NULL) { /* scheduled? */ return NULL; /* no nothing to report */ @@ -517,7 +515,7 @@ RUN *find_next_run(RUN *run, JOB *job, time_t &runtime) tm.tm_min = run->minute; tm.tm_sec = 0; runtime = mktime(&tm); - Dmsg2(200, "truntime=%d now=%d\n", runtime, now); +// Dmsg2(200, "truntime=%d now=%d\n", runtime, now); if (runtime < tomorrow) { return run; /* found it, return run resource */ } diff --git a/bacula/src/dird/ua_restore.c b/bacula/src/dird/ua_restore.c index 6027674d0f..14764bbbfa 100644 --- a/bacula/src/dird/ua_restore.c +++ b/bacula/src/dird/ua_restore.c @@ -74,11 +74,11 @@ struct RESTORE_CTX { uint32_t selected_files; char *where; RBSR *bsr; - POOLMEM *fname; - POOLMEM *path; + POOLMEM *fname; /* filename only */ + POOLMEM *path; /* path only */ POOLMEM *query; - int fnl; - int pnl; + int fnl; /* filename length */ + int pnl; /* path length */ bool found; NAME_LIST name_list; }; diff --git a/bacula/src/dird/ua_status.c b/bacula/src/dird/ua_status.c index 796f9fc506..754b0199f8 100644 --- a/bacula/src/dird/ua_status.c +++ b/bacula/src/dird/ua_status.c @@ -349,7 +349,7 @@ static void list_scheduled_jobs(UAContext *ua) int level, num_jobs = 0; bool hdr_printed = false; - Dmsg0(200, "enter find_runs()\n"); + Dmsg0(200, "enter list_sched_jobs()\n"); /* Loop through all jobs */ LockRes(); @@ -377,7 +377,7 @@ static void list_scheduled_jobs(UAContext *ua) } else { bsendmsg(ua, "\n"); } - Dmsg0(200, "Leave find_runs()\n"); + Dmsg0(200, "Leave list_sched_jobs_runs()\n"); } static void list_running_jobs(UAContext *ua) @@ -389,6 +389,7 @@ static void list_running_jobs(UAContext *ua) char level[10]; bool pool_mem = false; + Dmsg0(200, "enter list_run_jobs()\n"); lock_jcr_chain(); for (jcr=NULL; (jcr=get_next_jcr(jcr)); njobs++) { if (jcr->JobId == 0) { /* this is us */ @@ -406,6 +407,7 @@ static void list_running_jobs(UAContext *ua) if (njobs == 0) { unlock_jcr_chain(); bsendmsg(ua, _("No Running Jobs.\n")); + Dmsg0(200, "leave list_run_jobs()\n"); return; } njobs = 0; @@ -413,10 +415,7 @@ static void list_running_jobs(UAContext *ua) bsendmsg(ua, _("Level JobId Job Status\n")); bsendmsg(ua, _("====================================================================\n")); for (jcr=NULL; (jcr=get_next_jcr(jcr)); njobs++) { - if (!acl_access_ok(ua, Job_ACL, jcr->job->hdr.name)) { - continue; - } - if (jcr->JobId == 0) { /* this is us */ + if (jcr->JobId == 0 || !acl_access_ok(ua, Job_ACL, jcr->job->hdr.name)) { njobs--; free_locked_jcr(jcr); continue; @@ -535,8 +534,8 @@ static void list_running_jobs(UAContext *ua) free_locked_jcr(jcr); } unlock_jcr_chain(); - bsendmsg(ua, "\n"); + Dmsg0(200, "leave list_run_jobs()\n"); } static void list_terminated_jobs(UAContext *ua) diff --git a/bacula/src/lib/jcr.c b/bacula/src/lib/jcr.c index 27b94c8736..f3710da003 100755 --- a/bacula/src/lib/jcr.c +++ b/bacula/src/lib/jcr.c @@ -234,10 +234,10 @@ void free_jcr(JCR *jcr) P(jcr_chain_mutex); jcr->use_count--; /* decrement use count */ - Dmsg3(200, "Dec jcr 0x%x use_count=%d jobid=%d\n", jcr, jcr->use_count, jcr->JobId); + Dmsg3(200, "Dec free_jcr 0x%x use_count=%d jobid=%d\n", jcr, jcr->use_count, jcr->JobId); if (jcr->use_count > 0) { /* if in use */ V(jcr_chain_mutex); - Dmsg2(200, "jcr 0x%x use_count=%d\n", jcr, jcr->use_count); + Dmsg2(200, "free_jcr 0x%x use_count=%d\n", jcr, jcr->use_count); return; } remove_jcr(jcr); @@ -275,7 +275,7 @@ void free_jcr(JCR *jcr) void free_locked_jcr(JCR *jcr) { jcr->use_count--; /* decrement use count */ - Dmsg2(200, "Dec jcr 0x%x use_count=%d\n", jcr, jcr->use_count); + Dmsg2(200, "Dec free_locked_jcr 0x%x use_count=%d\n", jcr, jcr->use_count); if (jcr->use_count > 0) { /* if in use */ return; } @@ -302,7 +302,7 @@ JCR *get_jcr_by_id(uint32_t JobId) P(jcr->mutex); jcr->use_count++; V(jcr->mutex); - Dmsg2(200, "Inc jcr 0x%x use_count=%d\n", jcr, jcr->use_count); + Dmsg2(200, "Inc get_jcr 0x%x use_count=%d\n", jcr, jcr->use_count); break; } } @@ -326,7 +326,7 @@ JCR *get_jcr_by_session(uint32_t SessionId, uint32_t SessionTime) P(jcr->mutex); jcr->use_count++; V(jcr->mutex); - Dmsg2(200, "Inc jcr 0x%x use_count=%d\n", jcr, jcr->use_count); + Dmsg2(200, "Inc get_jcr 0x%x use_count=%d\n", jcr, jcr->use_count); break; } } @@ -357,7 +357,7 @@ JCR *get_jcr_by_partial_name(char *Job) P(jcr->mutex); jcr->use_count++; V(jcr->mutex); - Dmsg2(200, "Inc jcr 0x%x use_count=%d\n", jcr, jcr->use_count); + Dmsg2(200, "Inc get_jcr 0x%x use_count=%d\n", jcr, jcr->use_count); break; } } @@ -385,7 +385,7 @@ JCR *get_jcr_by_full_name(char *Job) P(jcr->mutex); jcr->use_count++; V(jcr->mutex); - Dmsg2(200, "Inc jcr 0x%x use_count=%d\n", jcr, jcr->use_count); + Dmsg2(200, "Inc get_jcr 0x%x use_count=%d\n", jcr, jcr->use_count); break; } } @@ -428,22 +428,22 @@ void unlock_jcr_chain() } -JCR *get_next_jcr(JCR *jcr) +JCR *get_next_jcr(JCR *prev_jcr) { - JCR *rjcr; + JCR *jcr; - if (jcr == NULL) { - rjcr = jobs; + if (prev_jcr == NULL) { + jcr = jobs; } else { - rjcr = jcr->next; + jcr = prev_jcr->next; } - if (rjcr) { - P(rjcr->mutex); - rjcr->use_count++; - V(rjcr->mutex); - Dmsg1(200, "Inc jcr use_count=%d\n", rjcr->use_count); + if (jcr) { + P(jcr->mutex); + jcr->use_count++; + V(jcr->mutex); + Dmsg2(200, "Inc get_next_jcr 0x%x use_count=%d\n", jcr, jcr->use_count); } - return rjcr; + return jcr; } bool init_jcr_subsystem(void) @@ -466,7 +466,7 @@ static void jcr_timeout_check(watchdog_t *self) BSOCK *fd; time_t timer_start; - Dmsg0(200, "Start JCR timeout checks\n"); + Dmsg0(400, "Start JCR timeout checks\n"); /* Walk through all JCRs checking if any one is * blocked for more than specified max time. diff --git a/bacula/src/lib/mem_pool.c b/bacula/src/lib/mem_pool.c index b1f849fef9..ff8b048092 100644 --- a/bacula/src/lib/mem_pool.c +++ b/bacula/src/lib/mem_pool.c @@ -359,11 +359,10 @@ void free_pool_memory(POOLMEM *obuf) void close_memory_pool() { struct abufhead *buf, *next; - int i; sm_check(__FILE__, __LINE__, False); P(mutex); - for (i=1; i<=PM_MAX; i++) { + for (int i=1; i<=PM_MAX; i++) { buf = pool_ctl[i].free_buf; while (buf) { next = buf->next; @@ -379,7 +378,7 @@ void close_memory_pool() static char *pool_name(int pool) { - static char *name[] = {"NoPool", "FNAME ", "MSG ", "EMSG "}; + static char *name[] = {"NoPool", "NAME ", "FNAME ", "MSG ", "EMSG "}; static char buf[30]; if (pool >= 0 && pool <= PM_MAX) { @@ -393,10 +392,8 @@ static char *pool_name(int pool) */ void print_memory_pool_stats() { - int i; - Dmsg0(-1, "Pool Maxsize Maxused Inuse\n"); - for (i=0; i<=PM_MAX; i++) + for (int i=0; i<=PM_MAX; i++) Dmsg4(-1, "%5s %7d %7d %5d\n", pool_name(i), pool_ctl[i].max_size, pool_ctl[i].max_used, pool_ctl[i].in_use); diff --git a/bacula/src/lib/parse_conf.c b/bacula/src/lib/parse_conf.c index b403d8294a..4e6ee8da82 100755 --- a/bacula/src/lib/parse_conf.c +++ b/bacula/src/lib/parse_conf.c @@ -291,7 +291,7 @@ static void scan_types(LEX *lc, MSGS *msg, int dest_code, char *where, char *cmd } } if (!found) { - scan_err1(lc, "message type: %s not found", str); + scan_err1(lc, _("message type: %s not found"), str); /* NOT REACHED */ } @@ -329,6 +329,10 @@ void store_name(LEX *lc, struct res_items *item, int index, int pass) } free_pool_memory(msg); /* Store the name both pass 1 and pass 2 */ + if (*(item->value)) { + scan_err2(lc, _("Attempt to redefine name \"%s\" to \"%s\"."), + *(item->value), lc->str); + } *(item->value) = bstrdup(lc->str); scan_to_eol(lc); set_bit(index, res_all.hdr.item_present); diff --git a/bacula/src/version.h b/bacula/src/version.h index e4847d96a1..cb4afae638 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -2,8 +2,8 @@ #undef VERSION #define VERSION "1.33" #define VSTRING "1" -#define BDATE "30 Jan 2004" -#define LSMDATE "30Jan04" +#define BDATE "03 Feb 2004" +#define LSMDATE "03Feb04" /* Debug flags */ #undef DEBUG -- 2.39.2