]> git.sur5r.net Git - bacula/bacula/blob - bacula/patches/2.4.x/2.4.3-prune.patch
kes Fix a text sizing problem in the tray-monitor reported in
[bacula/bacula] / bacula / patches / 2.4.x / 2.4.3-prune.patch
1
2  This patch should fix the bug reported on the bacula-users list where
3  a retention period of 100 years does immediate prunning.
4  Apply it to 2.4.3 (or earlier versions) with:
5
6  cd <bacula-source>
7  patch -p0 <2.4.3-prune.patch
8  ./configure <your-options>
9  make
10  ...
11  make install
12
13 Index: src/dird/ua_prune.c
14 ===================================================================
15 --- src/dird/ua_prune.c (revision 7757)
16 +++ src/dird/ua_prune.c (working copy)
17 @@ -202,7 +202,7 @@
18     now = (utime_t)time(NULL);
19  
20     /* Select Jobs -- for counting */
21 -   Mmsg(query, count_select_job, edit_uint64(now - period, ed1), 
22 +   Mmsg(query, count_select_job, edit_int64(now - period, ed1), 
23          edit_int64(cr.ClientId, ed2));
24     Dmsg3(050, "select now=%u period=%u sql=%s\n", (uint32_t)now, 
25                 (uint32_t)period, query.c_str());
26 @@ -230,7 +230,7 @@
27     del.JobId = (JobId_t *)malloc(sizeof(JobId_t) * del.max_ids);
28  
29     /* Now process same set but making a delete list */
30 -   Mmsg(query, select_job, edit_uint64(now - period, ed1), 
31 +   Mmsg(query, select_job, edit_int64(now - period, ed1), 
32          edit_int64(cr.ClientId, ed2));
33     db_sql_query(ua->db, query.c_str(), file_delete_handler, (void *)&del);
34  
35 @@ -318,7 +318,7 @@
36      * Select all files that are older than the JobRetention period
37      *  and stuff them into the "DeletionCandidates" table.
38      */
39 -   edit_uint64(now - period, ed1);
40 +   edit_int64(now - period, ed1);
41     Mmsg(query, insert_delcand, (char)JobType, ed1, 
42          edit_int64(cr.ClientId, ed2));
43     if (!db_sql_query(ua->db, query.c_str(), NULL, (void *)NULL)) {
44 @@ -443,10 +443,10 @@
45     edit_int64(mr->MediaId, ed1); 
46     period = mr->VolRetention;
47     now = (utime_t)time(NULL);
48 -   edit_uint64(now-period, ed2);
49 +   edit_int64(now-period, ed2);
50     Mmsg(query, sel_JobMedia, ed1, ed2);
51 -   Dmsg3(250, "Now=%d period=%d now-period=%d\n", (int)now, (int)period,
52 -      (int)(now-period));
53 +   Dmsg3(250, "Now=%d period=%d now-period=%s\n", (int)now, (int)period,
54 +      ed2);
55  
56     Dmsg1(050, "Query=%s\n", query.c_str());
57     if (!db_sql_query(ua->db, query.c_str(), file_delete_handler, (void *)del)) {