source: MondoRescue/branches/2.2.10/mondo/src/common/libmondo-verify.c@ 2286

Last change on this file since 2286 was 2276, checked in by Bruno Cornec, 15 years ago

r3262@localhost: bruno | 2009-07-13 02:18:17 +0200
Replace sprintf by mr_asprintf in libmondo-verify.c

  • Property svn:keywords set to Id
File size: 34.6 KB
RevLine 
[1]1/***************************************************************************
[2211]2$Id: libmondo-verify.c 2276 2009-07-13 00:34:36Z bruno $
[1]3***************************************************************************/
4
5
6/**
7 * @file
8 * Functions for verifying backups (booted from hard drive, not CD).
9 */
10
11#include "my-stuff.h"
[2211]12#include "mr_mem.h"
[1]13#include "mondostructures.h"
14#include "libmondo-verify.h"
[541]15#include "libmondo-gui-EXT.h"
[1]16#include "libmondo-files-EXT.h"
17#include "libmondo-fork-EXT.h"
18#include "libmondo-stream-EXT.h"
19#include "libmondo-string-EXT.h"
20#include "libmondo-devices-EXT.h"
21#include "libmondo-tools-EXT.h"
[541]22#include "lib-common-externs.h"
[1]23
24/*@unused@*/
[117]25//static char cvsid[] = "$Id: libmondo-verify.c 2276 2009-07-13 00:34:36Z bruno $";
[1]26
27/**
28 * The number of the most recently verified afioball.
29 * @ingroup globalGroup
30 */
31int g_last_afioball_number = -1;
32
[948]33extern char *g_getfacl;
34extern char *g_getfattr;
[1316]35extern char *MONDO_LOGFILE;
[1]36
[1645]37/* Reference to global bkpinfo */
38extern struct s_bkpinfo *bkpinfo;
39
[1648]40
[1]41/**
[1648]42 * Generate the filename of a tarball to verify.
43 * @param bkpinfo The backup information structure. @c bkpinfo->zip_suffix is the only field used.
44 * @param mountpoint The directory where the CD/DVD/ISO is mounted.
45 * @param setno The afioball number to get the location of.
46 * @return The absolute path to the afioball.
47 * @note The returned string points to static data that will be overwritten with each call.
48 * @ingroup stringGroup
49 */
50char *vfy_tball_fname(char *mountpoint, int setno)
51{
52 /*@ buffers ******************************************************* */
53 static char output[MAX_STR_LEN];
54
55 assert(bkpinfo != NULL);
56 assert_string_is_neither_NULL_nor_zerolength(mountpoint);
57 sprintf(output, "%s/archives/%d.star.%s", mountpoint, setno,
58 bkpinfo->zip_suffix);
59 if (!does_file_exist(output)) {
60 sprintf(output, "%s/archives/%d.afio.%s", mountpoint, setno,
61 bkpinfo->zip_suffix);
62 }
63 return (output);
64}
65
66
67/**
[1]68 * Generate a list of the files that have changed, based on @c afio @c -r
69 * messages.
70 * @param changedfiles_fname Filename of the place to put a list of afio's reported changed.
71 * @param ignorefiles_fname Filename of a list of files to ignore (use "" if none).
72 * @param stderr_fname File containing afio's stderr output.
73 * @return The number of differences found (0 for a perfect backup).
74 * @bug This function seems orphaned.
75 * @ingroup utilityGroup
76 */
77long
[128]78generate_list_of_changed_files(char *changedfiles_fname,
79 char *ignorefiles_fname, char *stderr_fname)
[1]80{
[128]81 /*@ buffer ********************************************************** */
[2276]82 char *command = NULL;
83 char *afio_found_changes = NULL;
[1]84
[128]85 /*@ int ************************************************************* */
86 int res = 0;
[1]87
[128]88 /*@ long ************************************************************ */
89 long afio_diffs = 0;
[1]90
[128]91 assert_string_is_neither_NULL_nor_zerolength(changedfiles_fname);
92 assert_string_is_neither_NULL_nor_zerolength(ignorefiles_fname);
93 assert_string_is_neither_NULL_nor_zerolength(stderr_fname);
[1]94
[2276]95 mr_asprintf(&afio_found_changes, "%s.afio", ignorefiles_fname);
[128]96 paranoid_system("sync");
97
98 log_msg(1, "Now scanning log file for 'afio: ' stuff");
[2276]99 mr_asprintf(&command, "grep \"afio: \" %s | sed 's/afio: //' | grep -vE '^/dev/.*$' >> %s", stderr_fname, afio_found_changes);
[128]100 log_msg(2, command);
101 res = system(command);
[2276]102 mr_free(command);
103
[128]104 if (res) {
105 log_msg(2, "Warning - failed to think");
106 }
107
108 log_msg(1, "Now scanning log file for 'star: ' stuff");
[2276]109 mr_asprintf(&command,
[911]110 "grep \"star: \" %s | sed 's/star: //' | grep -vE '^/dev/.*$' >> %s",
[128]111 stderr_fname, afio_found_changes);
112 log_msg(2, command);
113 res = system(command);
[2276]114 mr_free(command);
115
[128]116 if (res) {
117 log_msg(2, "Warning - failed to think");
118 }
119 afio_diffs = count_lines_in_file(afio_found_changes);
[2276]120 mr_asprintf(&command,
[273]121 "sort %s %s %s | uniq -c | awk '{ if ($1==\"2\") {print $2;};}' | grep -v \"incheckentry xwait()\" > %s",
[128]122 ignorefiles_fname, afio_found_changes, afio_found_changes,
123 changedfiles_fname);
[2276]124 mr_free(afio_found_changes);
[128]125 log_msg(2, command);
126 paranoid_system(command);
[2276]127 mr_free(command);
[128]128 return (afio_diffs);
[1]129}
130
131
132/**
133 * @addtogroup LLverifyGroup
134 * @{
135 */
136/**
137 * Verify all afioballs stored on the inserted CD (or an ISO image).
138 * @param bkpinfo The backup information structure. @c bkpinfo->backup_media_type
139 * is used in this function, and the structure is also passed to verify_an_afioball_from_CD().
140 * @param mountpoint The location the CD/DVD/ISO is mounted on.
141 * @return The number of sets containing differences (0 for success).
142 */
[1645]143int verify_afioballs_on_CD(char *mountpoint)
[1]144{
145
[128]146 /*@ buffers ********************************************************* */
[2276]147 char *tmp = NULL;
[2242]148 char *mds = NULL;
[1]149
[128]150 /*@ int ************************************************************* */
151 int set_number = 0;
[1]152 int retval = 0;
153 int total_sets = 0;
154 int percentage = 0;
155
[128]156 assert_string_is_neither_NULL_nor_zerolength(mountpoint);
157 assert(bkpinfo != NULL);
158
159 for (set_number = 0;
160 set_number < 9999
161 &&
[1645]162 !does_file_exist(vfy_tball_fname(mountpoint, set_number));
[128]163 set_number++);
[1645]164 if (!does_file_exist(vfy_tball_fname(mountpoint, set_number))) {
[128]165 return (0);
[1]166 }
[128]167
168 if (g_last_afioball_number != set_number - 1) {
169 if (set_number == 0) {
170 log_msg(1,
171 "Weird error in verify_afioballs_on_CD() but it's really a cosmetic error, nothing more");
172 } else {
173 retval++;
[2276]174 mr_asprintf(&tmp, "Warning - missing set(s) between %d and %d\n",
[128]175 g_last_afioball_number, set_number - 1);
176 log_to_screen(tmp);
[2276]177 mr_free(tmp);
[128]178 }
179 }
[2242]180 mds = media_descriptor_string(bkpinfo->backup_media_type);
[2276]181 mr_asprintf(&tmp, "Verifying %s #%d's tarballs", mds, g_current_media_number);
[2242]182 mr_free(mds);
183
[128]184 open_evalcall_form(tmp);
[2276]185 mr_free(tmp);
[128]186
187 for (total_sets = set_number;
[1645]188 does_file_exist(vfy_tball_fname(mountpoint, total_sets));
[128]189 total_sets++) {
190 log_msg(1, "total_sets = %d", total_sets);
191 }
192 for (;
[1645]193 does_file_exist(vfy_tball_fname(mountpoint, set_number));
[128]194 set_number++) {
195 percentage =
196 (set_number - g_last_afioball_number) * 100 / (total_sets -
197 g_last_afioball_number);
198 update_evalcall_form(percentage);
199 log_msg(1, "set = %d", set_number);
200 retval +=
[1645]201 verify_an_afioball_from_CD(vfy_tball_fname(mountpoint, set_number));
[128]202 }
203 g_last_afioball_number = set_number - 1;
204 close_evalcall_form();
205 return (retval);
[1]206}
207
208/**
209 * Verify all slices stored on the inserted CD (or a mounted ISO image).
210 * @param bkpinfo The backup information structure. Fields used:
211 * - @c compression_level
212 * - @c restore_path
213 * - @c use_lzo
214 * - @c zip_exe
215 * - @c zip_suffix
216 * @param mtpt The mountpoint the CD/DVD/ISO is mounted on.
217 * @return The number of differences (0 for perfect biggiefiles).
218 */
[1645]219int verify_all_slices_on_CD(char *mtpt)
[1]220{
221
[128]222 /*@ buffer ********************************************************** */
[2276]223 char *tmp = NULL;
224 char *mountpoint = NULL;
225 char *command = NULL;
[2242]226 char *mds = NULL;
[128]227 char *sz_exe;
228 static char *bufblkA = NULL;
229 static char *bufblkB = NULL;
230 const long maxbufsize = 65536L;
231 long currsizA = 0;
232 long currsizB = 0;
233 long j;
[1]234
[128]235 /*@ long ************************************************************ */
236 long bigfile_num = 0;
237 long slice_num = -1;
238 int res;
[1]239
[128]240 static FILE *forig = NULL;
241 static struct s_filename_and_lstat_info biggiestruct;
242 static long last_bigfile_num = -1;
243 static long last_slice_num = -1;
244 FILE *pin;
245 FILE *fin;
246 int retval = 0;
[1]247
[128]248 malloc_string(sz_exe);
249 if (!bufblkA) {
250 if (!(bufblkA = malloc(maxbufsize))) {
251 fatal_error("Cannot malloc bufblkA");
252 }
253 }
254 if (!bufblkB) {
255 if (!(bufblkB = malloc(maxbufsize))) {
256 fatal_error("Cannot malloc bufblkB");
257 }
258 }
[1]259
[128]260 assert(bkpinfo != NULL);
261 assert_string_is_neither_NULL_nor_zerolength(mtpt);
[1]262
[128]263 if (bkpinfo->compression_level > 0) {
264 if (bkpinfo->use_lzo) {
265 strcpy(sz_exe, "lzop");
[1003]266 } else if (bkpinfo->use_gzip) {
[998]267 strcpy(sz_exe, "gzip");
[128]268 } else {
269 strcpy(sz_exe, "bzip2");
270 }
271 } else {
272 sz_exe[0] = '\0';
273 }
[1]274
[2230]275 log_it("before vsbf");
[2242]276 mds = media_descriptor_string(bkpinfo->backup_media_type);
[2276]277 mr_asprintf(&tmp, "Verifying %s#%d's big files", mds, g_current_media_number);
[2242]278 mr_free(mds);
279
[128]280 open_evalcall_form(tmp);
[2276]281 mr_free(tmp);
282
[2230]283 log_it("after vsbf");
[2276]284 mr_asprintf(&mountpoint, "%s/archives", mtpt);
[128]285 if (last_bigfile_num == -1) {
286 bigfile_num = 0;
287 slice_num = 0;
288 } else if (slice_num == 0) {
289 bigfile_num = last_bigfile_num + 1;
290 slice_num = 0;
291 } else {
292 bigfile_num = last_bigfile_num;
293 slice_num = last_slice_num + 1;
294 }
[2276]295 while (does_file_exist(slice_fname(bigfile_num, slice_num, mountpoint, bkpinfo->zip_suffix))
[128]296 ||
[2276]297 does_file_exist(slice_fname(bigfile_num, slice_num, mountpoint, ""))) {
[1236]298 // handle slices until end of CD
[128]299 if (slice_num == 0) {
300 log_msg(2, "ISO=%d bigfile=%ld --START--",
301 g_current_media_number, bigfile_num);
[2276]302 if (! (fin = fopen(slice_fname(bigfile_num, slice_num, mountpoint, ""), "r"))) {
[128]303 log_msg(2, "Cannot open bigfile's info file");
304 } else {
[2276]305 if (fread ((void *) &biggiestruct, 1, sizeof(biggiestruct), fin) < sizeof(biggiestruct)) {
[128]306 log_msg(2, "Unable to get biggiestruct");
307 }
308 paranoid_fclose(fin);
309 }
[2276]310 mr_asprintf(&tmp, "%s/%s", bkpinfo->restore_path, biggiestruct.filename);
[128]311 log_msg(2, "Opening biggiefile #%ld - '%s'", bigfile_num, tmp);
[2276]312 forig = fopen(tmp, "r");
313 mr_free(tmp);
314
315 if (!forig) {
[128]316 log_msg(2, "Failed to open bigfile. Darn.");
[1262]317 log_to_screen("%s/%s not found on live filesystem",
[1236]318 bkpinfo->restore_path,
319 biggiestruct.filename);
[2211]320 mr_asprintf(&tmp, "echo \"%s/%s not found\" >> %s/biggies.changed",
[1236]321 bkpinfo->restore_path,
[1644]322 biggiestruct.filename,
323 bkpinfo->tmpdir);
[1236]324 system(tmp);
[2276]325 mr_free(tmp);
[1236]326
327 bigfile_num++;
328 slice_num = 0;
[128]329 retval++;
[1236]330 } else {
331 slice_num++;
[128]332 }
[1236]333 } else if (does_file_exist(slice_fname(bigfile_num, slice_num, mountpoint, "")) &&
334 (length_of_file(slice_fname(bigfile_num, slice_num, mountpoint, "")) == 0)) {
[128]335 log_msg(2, "ISO=%d bigfile=%ld ---END---",
336 g_current_media_number, bigfile_num);
337 bigfile_num++;
338 paranoid_fclose(forig);
339 slice_num = 0;
340 } else {
[1261]341 log_msg(2, "ISO=%d bigfile=%ld slice=%ld",
[128]342 g_current_media_number, bigfile_num, slice_num);
[1236]343 if (!does_file_exist(slice_fname(bigfile_num, slice_num, mountpoint, ""))) {
[2276]344 mr_asprintf(&command, "%s -dc %s 2>> %s",
[273]345 sz_exe,
[1236]346 slice_fname(bigfile_num, slice_num, mountpoint, bkpinfo->zip_suffix),
[128]347 MONDO_LOGFILE);
348 } else {
[2276]349 mr_asprintf(&command, "cat %s 2>> %s", slice_fname(bigfile_num, slice_num, mountpoint, ""), MONDO_LOGFILE);
[128]350 }
[2276]351 pin = popen(command, "r");
352 mr_free(command);
353 if (pin) {
[128]354 res = 0;
355 while (!feof(pin)) {
356 currsizA = fread(bufblkA, 1, maxbufsize, pin);
357 if (currsizA <= 0) {
358 break;
359 }
360 currsizB = fread(bufblkB, 1, currsizA, forig);
361 if (currsizA != currsizB) {
362 res++;
363 } else {
364 for (j = 0;
365 j < currsizA && bufblkA[j] == bufblkB[j];
366 j++);
367 if (j < currsizA) {
368 res++;
369 }
370 }
371 }
372 paranoid_pclose(pin);
[1236]373 if (res && !strncmp(biggiestruct.filename, "/dev/", 5)) {
[128]374 log_msg(3,
[296]375 "Ignoring differences between %s and live filesystem because it's a device and therefore the archives are stored via ntfsclone, not dd.",
[128]376 biggiestruct.filename);
377 log_msg(3,
378 "If you really want verification for %s, please contact the devteam and offer an incentive.",
379 biggiestruct.filename);
380 res = 0;
381 }
382 if (res) {
383 log_msg(0,
384 "afio: \"%s\": Corrupt biggie file, says libmondo-archive.c",
385 biggiestruct.filename);
386 retval++;
387 }
388 }
389 slice_num++;
390 }
[1]391 }
[2276]392 mr_free(mountpoint);
[128]393 last_bigfile_num = bigfile_num;
394 last_slice_num = slice_num - 1;
395 if (last_slice_num < 0) {
396 last_bigfile_num--;
[1]397 }
[128]398 close_evalcall_form();
399 if (bufblkA) {
400 paranoid_free(bufblkA);
[1]401 }
[128]402 if (bufblkB) {
403 paranoid_free(bufblkB);
404 }
405 paranoid_free(sz_exe);
406 return (0);
[1]407}
408
409
410
411
412
413
414/**
415 * Verify one afioball from the CD.
416 * You should be changed to the root directory (/) for this to work.
417 * @param bkpinfo The backup information structure. Fields used:
418 * - @c bkpinfo->use_lzo
419 * - @c bkpinfo->tmpdir
420 * - @c bkpinfo->zip_exe
421 * - @c bkpinfo->zip_suffix
422 * @param tarball_fname The filename of the afioball to verify.
423 * @return 0, always.
424 */
[1645]425int verify_a_tarball(char *tarball_fname)
[1]426{
[128]427 /*@ buffers ********************************************************* */
[2276]428 char *command = NULL;
429 char *outlog = NULL;
[1]430 char *tmp;
[128]431 // char *p;
[1]432
[128]433 /*@ pointers ******************************************************* */
434 FILE *pin;
[1]435
[128]436 /*@ long *********************************************************** */
437 long diffs = 0;
438 /* getcwd(old_pwd,MAX_STR_LEN-1); */
[1]439
440
[128]441 malloc_string(tmp);
442 assert(bkpinfo != NULL);
443 assert_string_is_neither_NULL_nor_zerolength(tarball_fname);
[1]444
[128]445 log_it("Verifying fileset '%s'", tarball_fname);
[2276]446 mr_asprintf(&outlog, "%s/afio.log", bkpinfo->tmpdir);
447 /* if programmer forgot to say which compression thingy to use then find out */
[128]448 if (strstr(tarball_fname, ".lzo")
449 && strcmp(bkpinfo->zip_suffix, "lzo")) {
450 log_msg(2, "OK, I'm going to start using lzop.");
451 strcpy(bkpinfo->zip_exe, "lzop");
452 strcpy(bkpinfo->zip_suffix, "lzo");
453 bkpinfo->use_lzo = TRUE;
[998]454 bkpinfo->use_gzip = FALSE;
[128]455 }
[998]456 if (strstr(tarball_fname, ".gz")
457 && strcmp(bkpinfo->zip_suffix, "gz")) {
458 log_msg(2, "OK, I'm going to start using gzip.");
459 strcpy(bkpinfo->zip_exe, "gzip");
460 strcpy(bkpinfo->zip_suffix, "gz");
461 bkpinfo->use_lzo = FALSE;
462 bkpinfo->use_gzip = TRUE;
463 }
[128]464 if (strstr(tarball_fname, ".bz2")
465 && strcmp(bkpinfo->zip_suffix, "bz2")) {
466 log_msg(2, "OK, I'm going to start using bzip2.");
467 strcpy(bkpinfo->zip_exe, "bzip2");
468 strcpy(bkpinfo->zip_suffix, "bz2");
469 bkpinfo->use_lzo = FALSE;
[998]470 bkpinfo->use_gzip = FALSE;
[128]471 }
472 unlink(outlog);
473 if (strstr(tarball_fname, ".star")) {
474 bkpinfo->use_star = TRUE;
475 if (strstr(tarball_fname, ".bz2"))
[2276]476 mr_asprintf(&command,
[128]477 "star -diff diffopts=mode,size,data file=%s %s >> %s 2>> %s",
478 tarball_fname,
479 (strstr(tarball_fname, ".bz2")) ? "-bz" : " ", outlog,
480 outlog);
481 } else {
482 bkpinfo->use_star = FALSE;
[2276]483 mr_asprintf(&command, "afio -r -P %s -Z %s >> %s 2>> %s",
[128]484 bkpinfo->zip_exe, tarball_fname, outlog, outlog);
485 }
486 log_msg(6, "command=%s", command);
487 paranoid_system(command);
[2276]488 mr_free(command);
489
[128]490 if (length_of_file(outlog) < 10) {
[2276]491 mr_asprintf(&command, "cat %s >> %s", outlog, MONDO_LOGFILE);
[128]492 } else {
[2276]493 mr_asprintf(&command, "cut -d: -f%d %s | sort -u",
[273]494 (bkpinfo->use_star) ? 1 : 2, outlog);
[128]495 pin = popen(command, "r");
496 if (pin) {
497 for (fgets(tmp, MAX_STR_LEN, pin); !feof(pin);
498 fgets(tmp, MAX_STR_LEN, pin)) {
499 if (bkpinfo->use_star) {
500 if (!strstr(tmp, "diffopts=")) {
501 while (strlen(tmp) > 0
502 && tmp[strlen(tmp) - 1] < 32) {
503 tmp[strlen(tmp) - 1] = '\0';
504 }
505 if (strchr(tmp, '/')) {
506 if (!diffs) {
507 log_msg(0, "'%s' - differences found",
508 tarball_fname);
509 }
510 log_msg(0, "star: /%s",
511 strip_afio_output_line(tmp));
512 diffs++;
513 }
514 }
515 } else {
516 if (!diffs) {
517 log_msg(0, "'%s' - differences found",
518 tarball_fname);
519 }
520 log_msg(0, "afio: /%s", strip_afio_output_line(tmp));
521 diffs++;
522 }
[1]523 }
[128]524 paranoid_pclose(pin);
525 } else {
526 log_OS_error(command);
527 }
528 }
[2276]529 mr_free(command);
530 mr_free(outlog);
[128]531 paranoid_free(tmp);
532 return (0);
[1]533}
534
535
536
537
538
539
540/**
541 * Verify one afioball from the CD.
542 * Checks for existence (calls fatal_error() if it does not exist) and
543 * then calls verify_an_afioball().
544 * @param bkpinfo The backup information structure. Passed to verify_an_afioball().
545 * @param tarball_fname The filename of the afioball to verify.
546 * @return The return value of verify_an_afioball().
547 * @see verify_an_afioball
548 */
549int
[1645]550verify_an_afioball_from_CD(char *tarball_fname)
[1]551{
552
[128]553 /*@ int ************************************************************* */
554 int res = 0;
[1]555
[128]556 assert_string_is_neither_NULL_nor_zerolength(tarball_fname);
[1]557
[128]558 log_msg(1, "Verifying %s", tarball_fname);
559 if (!does_file_exist(tarball_fname)) {
560 fatal_error("Cannot verify nonexistent afioball");
561 }
[1645]562 res = verify_a_tarball(tarball_fname);
[128]563 return (res);
[1]564}
565
566
567/**
568 * Verify one afioball from the opened tape/CD stream.
569 * Copies the file from tape to tmpdir and then calls verify_an_afioball().
570 * @param bkpinfo The backup information structure. Passed to verify_an_afioball().
571 * @param orig_fname The original filename of the afioball to verify.
572 * @param size The size of the afioball to verify.
573 * @return The return value of verify_an_afioball().
574 * @see verify_an_afioball
575 */
576int
[1645]577verify_an_afioball_from_stream(char *orig_fname, long long size)
[1]578{
579
[128]580 /*@ int ************************************************************** */
581 int retval = 0;
[1]582 int res = 0;
583
[128]584 /*@ buffers ********************************************************** */
[2276]585 char *tmp = NULL;
586 char *tarball_fname = NULL;
[1]587
[128]588 /*@ pointers ********************************************************* */
589 char *p;
[1]590
[128]591 assert(bkpinfo != NULL);
592 assert_string_is_neither_NULL_nor_zerolength(orig_fname);
[1]593
[128]594 p = strrchr(orig_fname, '/');
595 if (!p) {
596 p = orig_fname;
597 } else {
598 p++;
599 }
[2276]600 mr_asprintf(&tmp, "mkdir -p %s/tmpfs", bkpinfo->tmpdir);
[128]601 paranoid_system(tmp);
[2276]602 mr_free(tmp);
603
604 mr_asprintf(&tarball_fname, "%s/tmpfs/temporary-%s", bkpinfo->tmpdir, p);
[1645]605 read_file_from_stream_to_file(tarball_fname, size);
606 res = verify_a_tarball(tarball_fname);
[128]607 if (res) {
[2276]608 log_msg(0, "Afioball '%s' no longer matches your live filesystem", p);
[128]609 retval++;
610 }
611 unlink(tarball_fname);
[2276]612 mr_free(tarball_fname);
[128]613 return (retval);
[1]614}
615
616
617/**
618 * Verify one biggiefile form the opened tape/CD stream.
619 * @param bkpinfo The backup information structure. @c bkpinfo->tmpdir is the only field used.
620 * @param biggie_fname The filename of the biggiefile to verify.
621 * @param size The size in bytes of said biggiefile.
622 * @return 0 for success (even if the file doesn't match); nonzero for a tape error.
623 */
624int
[1645]625verify_a_biggiefile_from_stream(char *biggie_fname, long long size)
[1]626{
627
[128]628 /*@ int ************************************************************* */
629 int retval = 0;
[1]630 int res = 0;
631 int current_slice_number = 0;
632 int ctrl_chr = '\0';
633
[128]634 /*@ char ************************************************************ */
[2276]635 char *test_file = NULL;
[1]636 char *biggie_cksum;
637 char *orig_cksum;
[2276]638 char *tmp = NULL;
[1]639 char *slice_fnam;
[128]640
641 /*@ pointers ******************************************************** */
[1]642 char *p;
643
[128]644 /*@ long long ******************************************************* */
645 long long slice_siz;
[1]646
[128]647 malloc_string(biggie_cksum);
648 malloc_string(orig_cksum);
649 malloc_string(slice_fnam);
650 assert(bkpinfo != NULL);
651 assert_string_is_neither_NULL_nor_zerolength(biggie_fname);
[1]652
[128]653 p = strrchr(biggie_fname, '/');
654 if (!p) {
655 p = biggie_fname;
656 } else {
657 p++;
658 }
[2276]659 mr_asprintf(&test_file, "%s/temporary-%s", bkpinfo->tmpdir, p);
[128]660 for (res =
661 read_header_block_from_stream(&slice_siz, slice_fnam, &ctrl_chr);
662 ctrl_chr != BLK_STOP_A_BIGGIE;
663 res =
664 read_header_block_from_stream(&slice_siz, slice_fnam,
665 &ctrl_chr)) {
666 if (ctrl_chr != BLK_START_AN_AFIO_OR_SLICE) {
667 wrong_marker(BLK_START_AN_AFIO_OR_SLICE, ctrl_chr);
668 }
[1645]669 res = read_file_from_stream_to_file(test_file, slice_siz);
[128]670 unlink(test_file);
671 res =
672 read_header_block_from_stream(&slice_siz, slice_fnam,
673 &ctrl_chr);
674 if (ctrl_chr != BLK_STOP_AN_AFIO_OR_SLICE) {
675 log_msg(2, "test_file = %s", test_file);
676 wrong_marker(BLK_STOP_AN_AFIO_OR_SLICE, ctrl_chr);
677 }
678 current_slice_number++;
679 retval += res;
[1]680 }
[128]681 strcpy(biggie_cksum, slice_fnam);
682 if (biggie_cksum[0] != '\0') {
683 strcpy(orig_cksum, calc_checksum_of_file(biggie_fname));
684 if (strcmp(biggie_cksum, orig_cksum)) {
[2276]685 log_msg(2, "orig cksum=%s; curr cksum=%s", biggie_cksum, orig_cksum);
686 mr_asprintf(&tmp, "%s has changed on live filesystem", biggie_fname);
[128]687 log_to_screen(tmp);
[2276]688 mr_free(tmp);
689
690 mr_asprintf(&tmp, "echo \"%s\" >> %s/biggies.changed", biggie_fname, bkpinfo->tmpdir);
[128]691 system(tmp);
[2276]692 mr_free(tmp);
[128]693 }
[1]694 }
[2276]695 mr_free(test_file);
[128]696 paranoid_free(biggie_cksum);
697 paranoid_free(orig_cksum);
698 paranoid_free(slice_fnam);
699 return (retval);
[1]700}
701
702
703/**
704 * Verify all afioballs from the opened tape/CD stream.
705 * @param bkpinfo The backup information structure. Fields used:
706 * - @c bkpinfo->restore_path
707 * - @c bkpinfo->tmpdir
708 *
709 * @return 0 for success (even if there are differences); nonzero for a tape error.
710 */
[1645]711int verify_afioballs_from_stream()
[1]712{
[128]713 /*@ int ********************************************************** */
714 int retval = 0;
[1]715 int res = 0;
716 long current_afioball_number = 0;
717 int ctrl_chr = 0;
718 int total_afioballs = 0;
719
[128]720 /*@ buffers ***************************************************** */
[2276]721 char *tmp = NULL;
[1]722 char *fname;
[2276]723 char *curr_xattr_list_fname = NULL;
724 char *curr_acl_list_fname = NULL;
[1]725
[128]726 /*@ long long *************************************************** */
727 long long size = 0;
[1]728
[128]729 assert(bkpinfo != NULL);
730 malloc_string(fname);
[1]731
[948]732 if (g_getfattr) {
[2276]733 mr_asprintf(&curr_xattr_list_fname, XATTR_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir);
[948]734 }
735 if (g_getfacl) {
[2276]736 mr_asprintf(&curr_acl_list_fname, ACL_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir);
[948]737 }
[541]738 log_to_screen("Verifying regular archives on tape");
[1645]739 total_afioballs = get_last_filelist_number() + 1;
[541]740 open_progress_form("Verifying filesystem",
741 "I am verifying archives against your live filesystem now.",
742 "Please wait. This may take a couple of hours.", "",
[128]743 total_afioballs);
744 res = read_header_block_from_stream(&size, fname, &ctrl_chr);
745 if (ctrl_chr != BLK_START_AFIOBALLS) {
[2230]746 log_it("YOU SHOULD NOT GET HERE");
747 log_it("Grabbing the EXAT files");
[128]748 if (ctrl_chr == BLK_START_EXTENDED_ATTRIBUTES) {
749 res =
[1645]750 read_EXAT_files_from_tape(&size, fname, &ctrl_chr,
[128]751 curr_xattr_list_fname,
752 curr_acl_list_fname);
753 }
[1]754 }
[128]755 if (ctrl_chr != BLK_START_AFIOBALLS) {
756 wrong_marker(BLK_START_AFIOBALLS, ctrl_chr);
[1]757 }
[2276]758 if (g_getfattr) {
759 mr_free(curr_xattr_list_fname);
760 }
761 if (g_getfacl) {
762 mr_free(curr_acl_list_fname);
763 }
[128]764
765 for (res = read_header_block_from_stream(&size, fname, &ctrl_chr);
766 ctrl_chr != BLK_STOP_AFIOBALLS;
767 res = read_header_block_from_stream(&size, fname, &ctrl_chr)) {
[948]768 if (g_getfattr) {
[2276]769 mr_asprintf(&curr_xattr_list_fname, XATTR_LIST_FNAME_RAW_SZ, bkpinfo->tmpdir, current_afioball_number);
[948]770 }
771 if (g_getfacl) {
[2276]772 mr_asprintf(&curr_acl_list_fname, ACL_LIST_FNAME_RAW_SZ, bkpinfo->tmpdir, current_afioball_number);
[948]773 }
[128]774 if (ctrl_chr == BLK_START_EXTENDED_ATTRIBUTES) {
[2230]775 log_it("Reading EXAT files from tape");
[128]776 res =
[1645]777 read_EXAT_files_from_tape(&size, fname, &ctrl_chr,
[128]778 curr_xattr_list_fname,
779 curr_acl_list_fname);
780 }
[2276]781 if (g_getfattr) {
782 mr_free(curr_xattr_list_fname);
783 }
784 if (g_getfacl) {
785 mr_free(curr_acl_list_fname);
786 }
[128]787 if (ctrl_chr != BLK_START_AN_AFIO_OR_SLICE) {
788 wrong_marker(BLK_START_AN_AFIO_OR_SLICE, ctrl_chr);
789 }
[2276]790 mr_asprintf(&tmp, "Verifying fileset #%ld", current_afioball_number);
[128]791 update_progress_form(tmp);
[2276]792 mr_free(tmp);
793
[1645]794 res = verify_an_afioball_from_stream(fname, size);
[128]795 if (res) {
[2276]796 mr_asprintf(&tmp, "Afioball %ld differs from live filesystem",
[128]797 current_afioball_number);
798 log_to_screen(tmp);
[2276]799 mr_free(tmp);
[128]800 }
801 retval += res;
802 current_afioball_number++;
803 g_current_progress++;
804 res = read_header_block_from_stream(&size, fname, &ctrl_chr);
805 if (ctrl_chr != BLK_STOP_AN_AFIO_OR_SLICE) {
806 wrong_marker(BLK_STOP_AN_AFIO_OR_SLICE, ctrl_chr);
807 }
[1]808 }
[128]809 log_msg(1, "All done with afioballs");
810 close_progress_form();
811 paranoid_free(fname);
812 return (retval);
[1]813}
814
815/**
816 * Verify all biggiefiles on the opened CD/tape stream.
817 * @param bkpinfo The backup information structure. Fields used:
818 * - @c bkpinfo->restore_path
819 * - @c bkpinfo->tmpdir
820 *
821 * @return 0 for success (even if there are differences); nonzero for a tape error.
822 */
[1645]823int verify_biggiefiles_from_stream()
[1]824{
825
[128]826 /*@ int ************************************************************ */
827 int retval = 0;
[1]828 int res = 0;
829 int ctrl_chr = 0;
830
[128]831 /*@ long *********************************************************** */
832 long noof_biggiefiles = 0;
[1]833 long current_biggiefile_number = 0;
834
[128]835 /*@ buffers ******************************************************** */
[2276]836 char *orig_fname;
837 char *logical_fname = NULL;
838 char *comment = NULL;
839 char *curr_xattr_list_fname = NULL;
840 char *curr_acl_list_fname = NULL;
[128]841 /*@ pointers ******************************************************* */
[1]842 char *p;
843
[128]844 /*@ long long size ************************************************* */
845 long long size = 0;
[1]846
[128]847 assert(bkpinfo != NULL);
848 malloc_string(orig_fname);
[1]849
[948]850 if (g_getfattr) {
[2276]851 mr_asprintf(&curr_xattr_list_fname, XATTR_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir);
[948]852 }
853 if (g_getfacl) {
[2276]854 mr_asprintf(&curr_acl_list_fname, ACL_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir);
[948]855 }
[2276]856 mr_asprintf(&comment, "Verifying all bigfiles.");
[128]857 log_to_screen(comment);
858 res = read_header_block_from_stream(&size, orig_fname, &ctrl_chr);
859 if (ctrl_chr != BLK_START_BIGGIEFILES) {
860 if (ctrl_chr == BLK_START_EXTENDED_ATTRIBUTES) {
[2230]861 log_it("Grabbing the EXAT biggiefiles");
[128]862 res =
[1645]863 read_EXAT_files_from_tape(&size, orig_fname,
[128]864 &ctrl_chr, curr_xattr_list_fname,
865 curr_acl_list_fname);
866 }
[1]867 }
[2276]868 if (g_getfattr) {
869 mr_free(curr_xattr_list_fname);
870 }
871 if (g_getfacl) {
872 mr_free(curr_acl_list_fname);
873 }
874
[128]875 if (ctrl_chr != BLK_START_BIGGIEFILES) {
876 wrong_marker(BLK_START_BIGGIEFILES, ctrl_chr);
[1]877 }
[128]878 noof_biggiefiles = (long) size;
879 log_msg(1, "noof_biggiefiles = %ld", noof_biggiefiles);
[541]880 open_progress_form("Verifying big files", comment,
881 "Please wait. This may take some time.", "",
[128]882 noof_biggiefiles);
[2276]883 mr_free(comment);
884
[128]885 for (res = read_header_block_from_stream(&size, orig_fname, &ctrl_chr);
886 ctrl_chr != BLK_STOP_BIGGIEFILES;
887 res = read_header_block_from_stream(&size, orig_fname, &ctrl_chr))
[1]888 {
[128]889 if (ctrl_chr != BLK_START_A_NORMBIGGIE
890 && ctrl_chr != BLK_START_A_PIHBIGGIE) {
891 wrong_marker(BLK_START_A_NORMBIGGIE, ctrl_chr);
892 }
893 p = strrchr(orig_fname, '/');
894 if (!p) {
895 p = orig_fname;
896 } else {
897 p++;
898 }
[2276]899 mr_asprintf(&comment, "Verifying bigfile #%ld (%ld K)",
[128]900 current_biggiefile_number, (long) size >> 10);
901 update_progress_form(comment);
[2276]902 mr_free(comment);
903
904 mr_asprintf(&logical_fname, "%s/%s", bkpinfo->restore_path, orig_fname);
905 res = verify_a_biggiefile_from_stream(logical_fname, size);
906 mr_free(logical_fname);
907
[128]908 retval += res;
909 current_biggiefile_number++;
910 g_current_progress++;
[1]911 }
[128]912 close_progress_form();
913 paranoid_free(orig_fname);
914 return (retval);
[1]915}
916
917/* @} - end of LLverifyGroup */
918
919
920/**
[1709]921 * Verify the USB device
922 * @param bkpinfo The backup information structure. Fields used:
923 * - @c bkpinfo->isodir
924 * - @c bkpinfo->media_device
925 * - @c bkpinfo->tmpdir
926 * - @c bkpinfo->verify_data
927 *
928 * @return 0 for success (even if differences are found), nonzero for failure.
929 * @ingroup verifyGroup
930 */
931int verify_usb_image()
932{
933
934 /*@ int ************************************************************ */
935 int retval = 0;
936
937 /*@ buffers ******************************************************** */
938 char *mountpoint = NULL;
939 char *tmp = NULL;
940 char *tmp1 = NULL;
941 char *fname = NULL;
[1711]942 int ret = 0;
[1709]943#ifdef __FreeBSD__
944 char mdd[32];
945 char *mddevice = mdd;
946 int vndev = 2;
947#else
948//skip
949#endif
950
951 assert(bkpinfo != NULL);
952
[2211]953 mr_asprintf(&fname, "%s1", bkpinfo->media_device);
[1709]954 if (is_this_device_mounted(fname)) {
955 log_msg(1, "USB device mounted. Remounting it at the right place");
[2211]956 mr_asprintf(&tmp, "umount %s", fname);
[1709]957 run_program_and_log_output(tmp, FALSE);
958 paranoid_free(tmp);
959 }
960 paranoid_free(fname);
961
962 log_msg(1, "Mounting USB device.");
[2211]963 mr_asprintf(&mountpoint, "%s/usb", bkpinfo->tmpdir);
964 mr_asprintf(&tmp, "mkdir -p %s", mountpoint);
[1709]965 run_program_and_log_output(tmp, FALSE);
966 paranoid_free(tmp);
967 /* Mindi always create one single parition on the USB dev */
[2211]968 mr_asprintf(&tmp, "mount %s1 %s", bkpinfo->media_device, mountpoint);
[1709]969 ret = run_program_and_log_output(tmp, FALSE);
970 paranoid_free(tmp);
971 if (ret) {
972 paranoid_free(mountpoint);
973 return(ret);
974 }
975
976 sync();
977 log_msg(2, "OK, I've mounted the USB Disk/Key\n");
[2211]978 mr_asprintf(&tmp, "%s/archives/NOT-THE-LAST", mountpoint);
[1709]979 if (!does_file_exist(tmp)) {
980 log_msg
981 (2,
982 "This is the last USB device. I am therefore setting bkpinfo->verify_data to FALSE.");
983 bkpinfo->verify_data = FALSE;
984/*
985 (a) It's an easy way to tell the calling subroutine that we've finished &
986 there are no more device to be verified; (b) It stops the post-backup verifier
987 from running after the per-device verifier has run too.
988*/
989 }
990 paranoid_free(tmp);
991 verify_afioballs_on_CD(mountpoint);
[2230]992 log_it("before verify_all_slices");
[1709]993 verify_all_slices_on_CD(mountpoint);
994
[2211]995 mr_asprintf(&tmp1, "umount %s", mountpoint);
[1709]996#ifdef __FreeBSD__
997 ret += system(tmp1);
998 ret += kick_vn(mddevice);
999 if (ret)
1000#else
1001 if (system(tmp1))
1002#endif
1003 {
[2211]1004 mr_asprintf(&tmp, "%s failed; unable to unmount USB device\n", tmp1);
[1709]1005 log_to_screen(tmp);
1006 paranoid_free(tmp);
1007 retval++;
1008 } else {
1009 log_msg(2, "OK, I've unmounted the USB device\n");
1010 }
1011 paranoid_free(tmp1);
1012 paranoid_free(mountpoint);
1013 return (retval);
1014}
1015
1016
1017/**
[1]1018 * Verify the CD indicated by @c g_current_media_number.
1019 * @param bkpinfo The backup information structure. Fields used:
1020 * - @c bkpinfo->isodir
[20]1021 * - @c bkpinfo->prefix
[1]1022 * - @c bkpinfo->manual_cd_tray
1023 * - @c bkpinfo->media_device
1024 * - @c bkpinfo->nfs_remote_dir
1025 * - @c bkpinfo->tmpdir
1026 * - @c bkpinfo->verify_data
1027 *
1028 * @return 0 for success (even if differences are found), nonzero for failure.
1029 * @ingroup verifyGroup
1030 */
[1645]1031int verify_cd_image()
[1]1032{
1033
[128]1034 /*@ int ************************************************************ */
1035 int retval = 0;
[1]1036
[128]1037 /*@ buffers ******************************************************** */
[2276]1038 char *mountpoint = NULL;
1039 char *command = NULL;
1040 char *tmp = NULL;
1041 char *fname = NULL;
[1]1042#ifdef __FreeBSD__
[128]1043 char mdd[32];
[1]1044 char *mddevice = mdd;
[128]1045 int ret = 0;
1046 int vndev = 2;
[1]1047#else
1048//skip
1049#endif
1050
[128]1051 assert(bkpinfo != NULL);
[1]1052
[2276]1053 mr_asprintf(&mountpoint, "%s/cdrom", bkpinfo->tmpdir);
1054 mr_asprintf(&fname, "%s/%s/%s-%d.iso", bkpinfo->isodir, bkpinfo->nfs_remote_dir, bkpinfo->prefix, g_current_media_number);
[128]1055
1056 mkdir(mountpoint, 1777);
1057 sync();
1058 if (!does_file_exist(fname)) {
[2276]1059 log_msg(2, "%s not found; assuming you backed up to CD; verifying CD...", fname);
[128]1060 if (bkpinfo->manual_cd_tray) {
[541]1061 popup_and_OK("Please push CD tray closed.");
[128]1062 }
[1645]1063 if (find_and_mount_actual_cd(mountpoint)) {
[541]1064 log_to_screen("failed to mount actual CD");
[2276]1065 mr_free(mountpoint);
1066 mr_free(fname);
[128]1067 return (1);
1068 }
1069 } else {
[2276]1070 log_msg(2, "%s found; verifying ISO...", fname);
[1]1071#ifdef __FreeBSD__
[128]1072 ret = 0;
1073 vndev = 2;
1074 mddevice = make_vn(fname);
1075 if (ret) {
[2276]1076 mr_asprintf(&tmp, "make_vn of %s failed; unable to verify ISO\n", fname);
[128]1077 log_to_screen(tmp);
[2276]1078 mr_free(tmp);
1079 mr_free(mountpoint);
1080 mr_free(fname);
[128]1081 return (1);
1082 }
[2276]1083 mr_asprintf(&command, "mount_cd9660 %s %s", mddevice, mountpoint);
[1]1084#else
[2276]1085 mr_asprintf(&command, "mount -o loop,ro -t iso9660 %s %s", fname, mountpoint);
[1]1086#endif
[128]1087 if (run_program_and_log_output(command, FALSE)) {
[2276]1088 mr_asprintf(&tmp, "%s failed; unable to mount ISO image\n", command);
[128]1089 log_to_screen(tmp);
[2276]1090 mr_free(tmp);
1091 mr_free(mountpoint);
1092 mr_free(command);
1093 mr_free(fname);
[128]1094 return (1);
1095 }
[2276]1096 mr_free(command);
[1]1097 }
[128]1098 log_msg(2, "OK, I've mounted the ISO/CD\n");
[2276]1099 mr_asprintf(&tmp, "%s/archives/NOT-THE-LAST", mountpoint);
[128]1100 if (!does_file_exist(tmp)) {
1101 log_msg
1102 (2,
1103 "This is the last CD. I am therefore setting bkpinfo->verify_data to FALSE.");
1104 bkpinfo->verify_data = FALSE;
[1]1105/*
1106 (a) It's an easy way to tell the calling subroutine that we've finished &
1107 there are no more CD's to be verified; (b) It stops the post-backup verifier
1108 from running after the per-CD verifier has run too.
1109*/
[128]1110 }
[2276]1111 mr_free(tmp);
1112
[1645]1113 verify_afioballs_on_CD(mountpoint);
[2230]1114 log_it("before verify_all_slices");
[1645]1115 verify_all_slices_on_CD(mountpoint);
[1]1116
1117#ifdef __FreeBSD__
[128]1118 ret = 0;
[2276]1119 mr_asprintf(&command, "umount %s", mountpoint);
[128]1120 ret += system(command);
1121 ret += kick_vn(mddevice);
1122 if (ret)
[1]1123#else
[2276]1124 mr_asprintf(&command, "umount %s", mountpoint);
[128]1125 if (system(command))
[1]1126#endif
1127 {
[2276]1128 mr_asprintf(&tmp, "%s failed; unable to unmount ISO image\n", command);
[128]1129 log_to_screen(tmp);
[2276]1130 mr_free(tmp);
1131
[128]1132 retval++;
1133 } else {
1134 log_msg(2, "OK, I've unmounted the ISO file\n");
[1]1135 }
[2276]1136 mr_free(mountpoint);
1137 mr_free(command);
1138
[128]1139 if (!does_file_exist(fname)) {
[2276]1140 mr_asprintf(&command, "umount %s", bkpinfo->media_device);
[128]1141 run_program_and_log_output(command, 2);
[2276]1142 mr_free(command);
1143
[128]1144 if (!bkpinfo->please_dont_eject
1145 && eject_device(bkpinfo->media_device)) {
1146 log_msg(2, "Failed to eject CD-ROM drive");
1147 }
1148 }
[2276]1149 mr_free(fname);
[128]1150 return (retval);
[1]1151}
1152
1153/**
1154 * Verify all backups on tape.
1155 * This should be done after the backup process has already closed the tape.
1156 * @param bkpinfo The backup information structure. Passed to various helper functions.
1157 * @return 0 for success (even if thee were differences), nonzero for failure.
1158 * @ingroup verifyGroup
1159 */
[1645]1160int verify_tape_backups()
[1]1161{
1162
[128]1163 /*@ int ************************************************************ */
1164 int retval = 0;
[1]1165
[128]1166 /*@ buffers ******************************************************** */
[2276]1167 char *tmp = NULL;
1168 char *changed_files_fname = NULL;
[1]1169
[128]1170 /*@ long *********************************************************** */
1171 long diffs = 0;
[1]1172
[128]1173 assert(bkpinfo != NULL);
[1]1174
[128]1175 log_msg(3, "verify_tape_backups --- starting");
[541]1176 log_to_screen("Verifying backups");
[1645]1177 openin_tape();
[1]1178/* verify archives themselves */
[1645]1179 retval += verify_afioballs_from_stream();
1180 retval += verify_biggiefiles_from_stream();
[1]1181/* find the final blocks */
[128]1182 paranoid_system("sync");
1183 sleep(2);
[1645]1184 closein_tape();
[1]1185/* close tape; exit */
1186// fclose(g_tape_stream); <-- not needed; is handled by closein_tape()
[2276]1187 mr_asprintf(&tmp, "rm -f %s/biggies.changed %s/changed.files 2> /dev/null", bkpinfo->tmpdir, bkpinfo->tmpdir);
[1644]1188 paranoid_system(tmp);
[2276]1189 mr_free(tmp);
1190
1191 mr_asprintf(&changed_files_fname, "%s/changed.files", bkpinfo->tmpdir);
1192 mr_asprintf(&tmp, "grep -E '^%s:.*$' %s | cut -d'\"' -f2 | sort -u | awk '{print \"/\"$0;};' | tr -s '/' '/' | grep -v \"(total of\" | grep -v \"incheckentry.*xwait\" | grep -vE '^/afio:.*$' | grep -vE '^dev/.*$' > %s", (bkpinfo->use_star) ? "star" : "afio", MONDO_LOGFILE, changed_files_fname);
[128]1193 log_msg(2, "Running command to derive list of changed files");
1194 log_msg(2, tmp);
1195 if (system(tmp)) {
[2276]1196 if (does_file_exist(changed_files_fname) && length_of_file(changed_files_fname) > 2) {
1197 log_to_screen("Warning - unable to check logfile to derive list of changed files");
[128]1198 } else {
[2276]1199 log_to_screen("No differences found. Therefore, no 'changed.files' text file.");
[128]1200 }
1201 }
[2276]1202 mr_free(tmp);
1203
1204 mr_asprintf(&tmp, "cat %s/biggies.changed >> %s", bkpinfo->tmpdir, changed_files_fname);
[128]1205 paranoid_system(tmp);
[2276]1206 mr_free(tmp);
[1]1207
[128]1208 diffs = count_lines_in_file(changed_files_fname);
1209 if (diffs > 0) {
[2276]1210 mr_asprintf(&tmp, "cp -f %s %s/changed.files", changed_files_fname,
[1747]1211 MONDO_CACHE);
[128]1212 run_program_and_log_output(tmp, FALSE);
[2276]1213 mr_free(tmp);
1214
1215 log_msg(0, "%ld files differed from live filesystem; type less %s or less %s/changed.files to see", diffs, changed_files_fname, MONDO_CACHE);
[1747]1216 log_to_screen("See "MONDO_CACHE"/changed.files for a list of nonmatching files.");
[1644]1217 log_to_screen("The files probably changed on filesystem, not on backup media.");
[128]1218 }
[2276]1219 mr_free(changed_files_fname);
[128]1220 return (retval);
[1]1221}
1222
1223
1224
Note: See TracBrowser for help on using the repository browser.