From: Kern Sibbald Date: Sat, 14 Mar 2009 16:51:26 +0000 (+0000) Subject: Fix problems with bug #1247 and 64 bit time_t OSes by not X-Git-Tag: Release-3.0.0~164 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=aa5a5bfd160e8b12bf256f46db18b2560f44e998;p=bacula%2Fbacula Fix problems with bug #1247 and 64 bit time_t OSes by not editing (printf) time_t values. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@8528 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/ReleaseNotes b/bacula/ReleaseNotes index 592405991d..d37fd90bf8 100644 --- a/bacula/ReleaseNotes +++ b/bacula/ReleaseNotes @@ -1,7 +1,7 @@ - Release Notes for Bacula 2.5.40 + Release Notes for Bacula 2.5.42 - Bacula code: Total files = 522 Total lines = 204,340 (*.h *.c *.in) + Bacula code: Total files = 521 Total lines = 204,881 (*.h *.c *.in) The diff between 2.4.4 and 2.5.x is 208,340 lines, so this release represents an enormous effort. @@ -9,8 +9,8 @@ represents an enormous effort. This Director and Storage daemon must be upgraded at the same time, but they should be compatible with all 2.4.x File daemons, unless you use some of the new features that affect the FD. In other words, you should -not have to upgrade all your File daemons when you upgrade. However, the next -BETA release (after version 2.5.40) will require a database upgrade. +not have to upgrade all your File daemons when you upgrade. However, any +release of version 2.5.40 or greater requires a database upgrade. ================== Warning !!!!!! ========================== @@ -22,7 +22,20 @@ scripts that permit to convert a 2.4.x (version 10) catalog to 2.5.x (version 11). If you are using already a 2.5 version, you can drop the JobHistory table before upgrading your catalog (if you are using the new "long term statistics" module, you can upgrade this table the same way we do with -the Job table, see the src/cats/update_bacula_table script). +the Job table, see the src/cats/update_bacula_tables script). + +The simplest way to: +1. Stop any current version of Bacula from running. +2. Save a copy of your existing database. +3. Configure, build, and install the 2.5.42 version of Bacula +4. cd +5. ./update_bacula_tables +6. If you have multiple catalogs, edit the update_bacula_tables + script and put the name of another database, and then + execute the script again. Repeat this until all Bacula + catalogs have been updated. +7. Start the new Bacula. If everything worked, it should + not print any error messages. The upgrade operation will convert the FileId index field of the File table from 32 bits to 64 bits. This operation will take TIME and will *temporarily* @@ -54,8 +67,8 @@ to explicitly specify the libraries directory on the ./configure line (--libdir=/full-path/dir), but this should not be necessary. If you have problems with libtool or you wish to use the old -way of building static libraries, you can do so by disabling -libtool on the configure command line with: +way of building libraries and linking them into Bacula, you +can do so by disabling libtool on the configure command line with: ./configure --disable-libtool ============================================================== diff --git a/bacula/src/dird/dir_plugins.c b/bacula/src/dird/dir_plugins.c index 7710b5b1f7..a794e5d803 100644 --- a/bacula/src/dird/dir_plugins.c +++ b/bacula/src/dird/dir_plugins.c @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2007-2008 Free Software Foundation Europe e.V. + Copyright (C) 2007-2009 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,7 +43,7 @@ static bRC baculaGetValue(bpContext *ctx, brVariable var, void *value); static bRC baculaSetValue(bpContext *ctx, bwVariable var, void *value); static bRC baculaRegisterEvents(bpContext *ctx, ...); static bRC baculaJobMsg(bpContext *ctx, const char *file, int line, - int type, time_t mtime, const char *msg); + int type, utime_t mtime, const char *msg); static bRC baculaDebugMsg(bpContext *ctx, const char *file, int line, int level, const char *msg); @@ -403,9 +403,9 @@ static bRC baculaRegisterEvents(bpContext *ctx, ...) } static bRC baculaJobMsg(bpContext *ctx, const char *file, int line, - int type, time_t mtime, const char *msg) + int type, utime_t mtime, const char *msg) { - Dmsg5(dbglvl, "Job message: %s:%d type=%d time=%ld msg=%s\n", + Dmsg5(dbglvl, "Job message: %s:%d type=%d time=%lld msg=%s\n", file, line, type, mtime, msg); return bRC_OK; } diff --git a/bacula/src/dird/dir_plugins.h b/bacula/src/dird/dir_plugins.h index 7116272db9..84c106dba2 100644 --- a/bacula/src/dird/dir_plugins.h +++ b/bacula/src/dird/dir_plugins.h @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2007-2008 Free Software Foundation Europe e.V. + Copyright (C) 2007-2009 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. @@ -134,7 +134,7 @@ typedef struct s_baculaFuncs { bRC (*getBaculaValue)(bpContext *ctx, brVariable var, void *value); bRC (*setBaculaValue)(bpContext *ctx, bwVariable var, void *value); bRC (*JobMessage)(bpContext *ctx, const char *file, int line, - int type, time_t mtime, const char *msg); + int type, utime_t mtime, const char *msg); bRC (*DebugMessage)(bpContext *ctx, const char *file, int line, int level, const char *msg); } bFuncs; diff --git a/bacula/src/dird/scheduler.c b/bacula/src/dird/scheduler.c index bf2f857b13..d10abbca64 100644 --- a/bacula/src/dird/scheduler.c +++ b/bacula/src/dird/scheduler.c @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2000-2007 Free Software Foundation Europe e.V. + Copyright (C) 2000-2009 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. @@ -383,19 +383,15 @@ static void add_job(JOB *job, RUN *run, time_t now, time_t runtime) */ if (((runtime - run->last_run) < 61) || ((runtime+59) < now)) { #ifdef SCHED_DEBUG - char dt[50], dt1[50], dt2[50]; - bstrftime_nc(dt, sizeof(dt), runtime); - bstrftime_nc(dt1, sizeof(dt1), run->last_run); - bstrftime_nc(dt2, sizeof(dt2), now); - Dmsg7(000, "Drop: Job=\"%s\" run=%s(%x). last_run=%s(%x). now=%s(%x)\n", job->hdr.name, - dt, runtime, dt1, run->last_run, dt2, now); + Dmsg4(000, "Drop: Job=\"%s\" run=%lld. last_run=%lld. now=%lld\n", job->hdr.name, + (utime_t)runtime, (utime_t)run->last_run, (utime_t)now); fflush(stdout); #endif return; } #ifdef SCHED_DEBUG - Dmsg4(000, "Add: Job=\"%s\" run=%x last_run=%x now=%x\n", job->hdr.name, - runtime, run->last_run, now); + Dmsg4(000, "Add: Job=\"%s\" run=%lld last_run=%lld now=%lld\n", job->hdr.name, + (utime_t)runtime, (utime_t)run->last_run, (utime_t)now); #endif /* accept to run this job */ job_item *je = (job_item *)malloc(sizeof(job_item)); diff --git a/bacula/src/dird/ua_update.c b/bacula/src/dird/ua_update.c index e61f813954..ff0f94ad32 100644 --- a/bacula/src/dird/ua_update.c +++ b/bacula/src/dird/ua_update.c @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2000-2008 Free Software Foundation Europe e.V. + Copyright (C) 2000-2009 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. @@ -921,8 +921,8 @@ static bool update_job(UAContext *ua) return false; } delta_start = StartTime - jr.StartTime; - Dmsg3(200, "ST=%d jr.ST=%d delta=%d\n", (time_t)StartTime, - (time_t)jr.StartTime, (time_t)delta_start); + Dmsg3(200, "ST=%lld jr.ST=%lld delta=%lld\n", StartTime, + (utime_t)jr.StartTime, delta_start); jr.StartTime = (time_t)StartTime; jr.SchedTime += (time_t)delta_start; jr.EndTime += (time_t)delta_start; diff --git a/bacula/src/stored/append.c b/bacula/src/stored/append.c index 83a5929e56..9a00694638 100644 --- a/bacula/src/stored/append.c +++ b/bacula/src/stored/append.c @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2000-2008 Free Software Foundation Europe e.V. + Copyright (C) 2000-2009 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. @@ -253,8 +253,11 @@ bool do_append_data(JCR *jcr) ds->fsend(OK_append); do_fd_commands(jcr); /* finish dialog with FD */ - - time_t job_elapsed = time(NULL) - jcr->run_time; + /* + * Don't use time_t for job_elapsed as time_t can be 32 or 64 bits, + * and the subsequent Jmsg() editing will break + */ + int32_t job_elapsed = time(NULL) - jcr->run_time; if (job_elapsed <= 0) { job_elapsed = 1; diff --git a/bacula/src/stored/sd_plugins.c b/bacula/src/stored/sd_plugins.c index 93be186474..b007032a80 100644 --- a/bacula/src/stored/sd_plugins.c +++ b/bacula/src/stored/sd_plugins.c @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2007-2008 Free Software Foundation Europe e.V. + Copyright (C) 2007-2009 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. @@ -44,7 +44,7 @@ static bRC baculaGetValue(bpContext *ctx, brVariable var, void *value); static bRC baculaSetValue(bpContext *ctx, bwVariable var, void *value); static bRC baculaRegisterEvents(bpContext *ctx, ...); static bRC baculaJobMsg(bpContext *ctx, const char *file, int line, - int type, time_t mtime, const char *msg); + int type, utime_t mtime, const char *msg); static bRC baculaDebugMsg(bpContext *ctx, const char *file, int line, int level, const char *msg); @@ -219,9 +219,9 @@ static bRC baculaRegisterEvents(bpContext *ctx, ...) } static bRC baculaJobMsg(bpContext *ctx, const char *file, int line, - int type, time_t mtime, const char *msg) + int type, utime_t mtime, const char *msg) { - Dmsg5(dbglvl, "Job message: %s:%d type=%d time=%ld msg=%s\n", + Dmsg5(dbglvl, "Job message: %s:%d type=%d time=%lld msg=%s\n", file, line, type, mtime, msg); return bRC_OK; } diff --git a/bacula/src/stored/sd_plugins.h b/bacula/src/stored/sd_plugins.h index f581d17e38..53ec682c1d 100644 --- a/bacula/src/stored/sd_plugins.h +++ b/bacula/src/stored/sd_plugins.h @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2007-2008 Free Software Foundation Europe e.V. + Copyright (C) 2007-2009 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. @@ -124,7 +124,7 @@ typedef struct s_baculaFuncs { bRC (*getBaculaValue)(bpContext *ctx, brVariable var, void *value); bRC (*setBaculaValue)(bpContext *ctx, bwVariable var, void *value); bRC (*JobMessage)(bpContext *ctx, const char *file, int line, - int type, time_t mtime, const char *msg); + int type, utime_t mtime, const char *msg); bRC (*DebugMessage)(bpContext *ctx, const char *file, int line, int level, const char *msg); } bFuncs; diff --git a/bacula/src/stored/spool.c b/bacula/src/stored/spool.c index 9d6300ae6d..21212c53bf 100644 --- a/bacula/src/stored/spool.c +++ b/bacula/src/stored/spool.c @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2004-2008 Free Software Foundation Europe e.V. + Copyright (C) 2004-2009 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. @@ -276,7 +276,7 @@ static bool despool_data(DCR *dcr, bool commit) #endif /* Add run time, to get current wait time */ - time_t despool_start = time(NULL) - jcr->run_time; + int32_t despool_start = time(NULL) - jcr->run_time; set_new_file_parameters(dcr); @@ -309,8 +309,12 @@ static bool despool_data(DCR *dcr, bool commit) /* Set new file/block parameters for current dcr */ set_new_file_parameters(dcr); - /* Subtracting run_time give us elapsed time - wait_time since we started despooling */ - time_t despool_elapsed = time(NULL) - despool_start - jcr->run_time; + /* + * Subtracting run_time give us elapsed time - wait_time since + * we started despooling. Note, don't use time_t as it is 32 or 64 + * bits depending on the OS and doesn't edit with %d + */ + int32_t despool_elapsed = time(NULL) - despool_start - jcr->run_time; if (despool_elapsed <= 0) { despool_elapsed = 1; @@ -656,7 +660,7 @@ bool commit_attribute_spool(JCR *jcr) char tbuf[100]; Dmsg1(100, "Commit attributes at %s\n", bstrftimes(tbuf, sizeof(tbuf), - ( utime_t)time(NULL))); + (utime_t)time(NULL))); if (are_attributes_spooled(jcr)) { if (fseeko(jcr->dir_bsock->m_spool_fd, 0, SEEK_END) != 0) { berrno be; @@ -724,7 +728,7 @@ bool close_attr_spool_file(JCR *jcr, BSOCK *bs) char tbuf[100]; Dmsg1(100, "Close attr spool file at %s\n", bstrftimes(tbuf, sizeof(tbuf), - ( utime_t)time(NULL))); + (utime_t)time(NULL))); if (!bs->m_spool_fd) { return true; } diff --git a/bacula/src/stored/wait.c b/bacula/src/stored/wait.c index b22314a69a..ca44328955 100644 --- a/bacula/src/stored/wait.c +++ b/bacula/src/stored/wait.c @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2000-2008 Free Software Foundation Europe e.V. + Copyright (C) 2000-2009 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. diff --git a/bacula/src/version.h b/bacula/src/version.h index be691d4735..99bf5aa6f7 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -4,8 +4,8 @@ #undef VERSION #define VERSION "2.5.42" -#define BDATE "12 March 2009" -#define LSMDATE "12Mar09" +#define BDATE "14 March 2009" +#define LSMDATE "14Mar09" #define PROG_COPYRIGHT "Copyright (C) %d-2009 Free Software Foundation Europe e.V.\n" #define BYEAR "2009" /* year for copyright messages in progs */ diff --git a/bacula/technotes-2.5 b/bacula/technotes-2.5 index b16cb7be7f..fc70c0b06d 100644 --- a/bacula/technotes-2.5 +++ b/bacula/technotes-2.5 @@ -42,6 +42,9 @@ Code to be completed before 3.0.0 is released: General: +14Mar09 +kes Fix problems with bug #1247 and 64 bit time_t OSes by not + editing (printf) time_t values. 12Mar09 kes Install bacula (start/stop script) in sbindir in addition to scripts dir.