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