]> git.sur5r.net Git - bacula/bacula/blob - bacula/patches/1.36.0/1.36.0-verify.patch
ebl Add patch to cleanup orphaned jobs during startup
[bacula/bacula] / bacula / patches / 1.36.0 / 1.36.0-verify.patch
1
2  This patch fixes, at least partially, a Verify error where
3  the count of files expected did not agree with the count 
4  found. There are still some cases where the expected count
5  exceeds the found probably due to the same directory being
6  examined multiple times.
7
8  Apply the patch to 1.36.0 with:
9
10  cd <bacula-source>
11  patch -p0 <1.36.0-verify.patch
12  make
13  make install
14
15
16 Index: src/dird/bsr.c
17 ===================================================================
18 RCS file: /cvsroot/bacula/bacula/src/dird/bsr.c,v
19 retrieving revision 1.15
20 diff -u -r1.15 bsr.c
21 --- src/dird/bsr.c      24 Sep 2004 15:53:00 -0000      1.15
22 +++ src/dird/bsr.c      29 Oct 2004 22:05:24 -0000
23 @@ -34,7 +34,7 @@
24  #include "dird.h"
25  
26  /* Forward referenced functions */
27 -static int write_bsr(UAContext *ua, RBSR *bsr, FILE *fd);
28 +static uint32_t write_bsr(UAContext *ua, RBSR *bsr, FILE *fd);
29  void print_bsr(UAContext *ua, RBSR *bsr);
30  
31  
32 @@ -178,11 +178,11 @@
33  /*
34   * Write the bootstrap records to file
35   */
36 -int write_bsr_file(UAContext *ua, RBSR *bsr)
37 +uint32_t write_bsr_file(UAContext *ua, RBSR *bsr)
38  {
39     FILE *fd;
40     POOLMEM *fname = get_pool_memory(PM_MESSAGE);
41 -   int count = 0;;
42 +   uint32_t count = 0;;
43     bool err;
44  
45     Mmsg(fname, "%s/restore.bsr", working_directory);
46 @@ -234,9 +234,10 @@
47     return count;
48  }
49  
50 -static int write_bsr(UAContext *ua, RBSR *bsr, FILE *fd)
51 +static uint32_t write_bsr(UAContext *ua, RBSR *bsr, FILE *fd)
52  {
53     uint32_t count = 0;
54 +   uint32_t total_count = 0; 
55     if (bsr) {
56        /*
57         * For a given volume, loop over all the JobMedia records.
58 @@ -271,10 +272,11 @@
59          if (count) {
60              fprintf(fd, "Count=%u\n", count);
61          }
62 +        total_count += count;
63        }
64        write_bsr(ua, bsr->next, fd);
65     }
66 -   return count;
67 +   return total_count;
68  }
69  
70  void print_bsr(UAContext *ua, RBSR *bsr)
71 Index: src/dird/protos.h
72 ===================================================================
73 RCS file: /cvsroot/bacula/bacula/src/dird/protos.h,v
74 retrieving revision 1.54
75 diff -u -r1.54 protos.h
76 --- src/dird/protos.h   24 Sep 2004 12:30:14 -0000      1.54
77 +++ src/dird/protos.h   29 Oct 2004 22:05:24 -0000
78 @@ -44,7 +44,7 @@
79  RBSR *new_bsr();
80  void free_bsr(RBSR *bsr);
81  int complete_bsr(UAContext *ua, RBSR *bsr);
82 -int write_bsr_file(UAContext *ua, RBSR *bsr);
83 +uint32_t write_bsr_file(UAContext *ua, RBSR *bsr);
84  void add_findex(RBSR *bsr, uint32_t JobId, int32_t findex);
85  RBSR_FINDEX *new_findex();
86  
87 @@ -62,7 +62,7 @@
88  
89  /* fd_cmds.c */
90  extern int connect_to_file_daemon(JCR *jcr, int retry_interval,
91 -                                 int max_retry_time, int verbose);
92 +                                  int max_retry_time, int verbose);
93  extern int send_include_list(JCR *jcr);
94  extern int send_exclude_list(JCR *jcr);
95  extern int send_bootstrap_file(JCR *jcr);
96 @@ -70,7 +70,7 @@
97  extern int get_attributes_and_put_in_catalog(JCR *jcr);
98  extern int get_attributes_and_compare_to_catalog(JCR *jcr, JobId_t JobId);
99  extern int put_file_into_catalog(JCR *jcr, long file_index, char *fname, 
100 -                         char *link, char *attr, int stream);
101 +                          char *link, char *attr, int stream);
102  extern void get_level_since_time(JCR *jcr, char *since, int since_len);
103  extern int send_run_before_and_after_commands(JCR *jcr);
104  
105 @@ -97,7 +97,7 @@
106  
107  /* msgchan.c */
108  extern bool connect_to_storage_daemon(JCR *jcr, int retry_interval,    
109 -                             int max_retry_time, int verbose);
110 +                              int max_retry_time, int verbose);
111  extern int start_storage_daemon_job(JCR *jcr);
112  extern int start_storage_daemon_message_thread(JCR *jcr);
113  extern int bget_dirmsg(BSOCK *bs);
114 @@ -149,28 +149,28 @@
115  void free_ua_context(UAContext *ua);
116  
117  /* ua_select.c */
118 -STORE  *select_storage_resource(UAContext *ua);
119 -JOB    *select_job_resource(UAContext *ua);
120 -JOB    *select_restore_job_resource(UAContext *ua);
121 -CLIENT *select_client_resource(UAContext *ua);
122 +STORE   *select_storage_resource(UAContext *ua);
123 +JOB     *select_job_resource(UAContext *ua);
124 +JOB     *select_restore_job_resource(UAContext *ua);
125 +CLIENT  *select_client_resource(UAContext *ua);
126  FILESET *select_fileset_resource(UAContext *ua);
127 -int    select_pool_and_media_dbr(UAContext *ua, POOL_DBR *pr, MEDIA_DBR *mr);
128 -int    select_media_dbr(UAContext *ua, MEDIA_DBR *mr);
129 -bool   select_pool_dbr(UAContext *ua, POOL_DBR *pr);
130 -int    select_client_dbr(UAContext *ua, CLIENT_DBR *cr);
131 -
132 -void   start_prompt(UAContext *ua, const char *msg);
133 -void   add_prompt(UAContext *ua, const char *prompt);
134 -int    do_prompt(UAContext *ua, const char *automsg, const char *msg, char *prompt, int max_prompt);
135 -CAT    *get_catalog_resource(UAContext *ua);          
136 +int     select_pool_and_media_dbr(UAContext *ua, POOL_DBR *pr, MEDIA_DBR *mr);
137 +int     select_media_dbr(UAContext *ua, MEDIA_DBR *mr);
138 +bool    select_pool_dbr(UAContext *ua, POOL_DBR *pr);
139 +int     select_client_dbr(UAContext *ua, CLIENT_DBR *cr);
140 +
141 +void    start_prompt(UAContext *ua, const char *msg);
142 +void    add_prompt(UAContext *ua, const char *prompt);
143 +int     do_prompt(UAContext *ua, const char *automsg, const char *msg, char *prompt, int max_prompt);
144 +CAT    *get_catalog_resource(UAContext *ua);           
145  STORE  *get_storage_resource(UAContext *ua, int use_default);
146 -int    get_media_type(UAContext *ua, char *MediaType, int max_media);
147 -bool   get_pool_dbr(UAContext *ua, POOL_DBR *pr);
148 -int    get_client_dbr(UAContext *ua, CLIENT_DBR *cr);
149 +int     get_media_type(UAContext *ua, char *MediaType, int max_media);
150 +bool    get_pool_dbr(UAContext *ua, POOL_DBR *pr);
151 +int     get_client_dbr(UAContext *ua, CLIENT_DBR *cr);
152  POOL   *get_pool_resource(UAContext *ua);
153  POOL   *select_pool_resource(UAContext *ua);
154  CLIENT *get_client_resource(UAContext *ua);
155 -int    get_job_dbr(UAContext *ua, JOB_DBR *jr);
156 +int     get_job_dbr(UAContext *ua, JOB_DBR *jr);
157  
158  int find_arg_keyword(UAContext *ua, const char **list);
159  int find_arg(UAContext *ua, const char *keyword);