From: Stelian Pop Date: Mon, 24 Dec 2001 12:31:12 +0000 (+0000) Subject: Fix errors when trying to restore files not found on tape. X-Git-Tag: release_0_4b26~4 X-Git-Url: https://git.wh0rd.org/?p=dump.git;a=commitdiff_plain;h=ab28ebd489d7380f23e38705f2ce4c8385575d5e Fix errors when trying to restore files not found on tape. --- diff --git a/CHANGES b/CHANGES index 73ca931..d5db34a 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,4 @@ -$Id: CHANGES,v 1.149 2001/12/24 12:28:38 stelian Exp $ +$Id: CHANGES,v 1.150 2001/12/24 12:31:12 stelian Exp $ Changes between versions 0.4b25 and 0.4b26 (released ?????????????????) ======================================================================= @@ -12,6 +12,10 @@ Changes between versions 0.4b25 and 0.4b26 (released ?????????????????) a one letter subdirectory. Thanks to Chris Siebenmann for reporting the bug. +3. Fixed several restore bugs occuring when trying to + restore some missing files on the tape. Thanks to Chris + Siebenmann for reporting the bug. + Changes between versions 0.4b24 and 0.4b25 (released November 17, 2001) ======================================================================= diff --git a/restore/restore.c b/restore/restore.c index d9561d8..f0118f2 100644 --- a/restore/restore.c +++ b/restore/restore.c @@ -41,7 +41,7 @@ #ifndef lint static const char rcsid[] = - "$Id: restore.c,v 1.18 2001/06/18 10:58:28 stelian Exp $"; + "$Id: restore.c,v 1.19 2001/12/24 12:31:12 stelian Exp $"; #endif /* not lint */ #include @@ -708,6 +708,25 @@ compareleaves(void) curvol = volno; } } + /* + * If we encounter the end of the tape and the next available + * file is not the one which we expect then we have missed one + * or more files. Since we do not request files that were not + * on the tape, the lost files must have been due to a tape + * read error, or a file that was removed while the dump was + * in progress. + */ + first = lowerbnd(first); + while (first < curfile.ino) { + ep = lookupino(first); + if (ep == NULL) + panic("%d: bad first\n", first); + fprintf(stderr, "%s: (inode %lu) not found on tape\n", + myname(ep), (unsigned long)first); + compare_errors = 1; + ep->e_flags &= ~(NEW|EXTRACT); + first = lowerbnd(first); + } } /* @@ -742,7 +761,8 @@ createleaves(char *symtabfile) ep = lookupino(first); if (ep == NULL) panic("%d: bad first\n", first); - fprintf(stderr, "%s: not found on tape\n", myname(ep)); + fprintf(stderr, "%s: (inode %lu) not found on tape\n", + myname(ep), (unsigned long)first); ep->e_flags &= ~(NEW|EXTRACT); first = lowerbnd(first); } @@ -787,6 +807,25 @@ createleaves(char *symtabfile) curvol = volno; } } + /* + * If we encounter the end of the tape and the next available + * file is not the one which we expect then we have missed one + * or more files. Since we do not request files that were not + * on the tape, the lost files must have been due to a tape + * read error, or a file that was removed while the dump was + * in progress. + */ + first = lowerbnd(first); + while (first < curfile.ino) { + ep = lookupino(first); + if (ep == NULL) + panic("%d: bad first\n", first); + fprintf(stderr, "%s: (inode %lu) not found on tape\n", + myname(ep), (unsigned long)first); + compare_errors = 1; + ep->e_flags &= ~(NEW|EXTRACT); + first = lowerbnd(first); + } } /* @@ -829,6 +868,19 @@ createfiles(void) while (curfile.ino > last) { curfile.action = SKIP; getvol((long)0); + if (curfile.ino == maxino) { + next = lowerbnd(next); + while (next < curfile.ino) { + ep = lookupino(next); + if (ep == NULL) + panic("corrupted symbol table\n"); + fprintf(stderr, "%s: (inode %lu) not found on tape\n", + myname(ep), (unsigned long)next); + ep->e_flags &= ~NEW; + next = lowerbnd(next); + } + return; + } skipmaps(); skipdirs(); } @@ -916,7 +968,8 @@ createfiles(void) ep = lookupino(next); if (ep == NULL) panic("corrupted symbol table\n"); - fprintf(stderr, "%s: not found on tape\n", myname(ep)); + fprintf(stderr, "%s: (inode %lu) not found on tape\n", + myname(ep), (unsigned long)next); ep->e_flags &= ~NEW; next = lowerbnd(next); } diff --git a/restore/tape.c b/restore/tape.c index cd133cb..c46394b 100644 --- a/restore/tape.c +++ b/restore/tape.c @@ -46,7 +46,7 @@ #ifndef lint static const char rcsid[] = - "$Id: tape.c,v 1.48 2001/11/16 14:09:07 stelian Exp $"; + "$Id: tape.c,v 1.49 2001/12/24 12:31:12 stelian Exp $"; #endif /* not lint */ #include @@ -432,12 +432,16 @@ again: fprintf(stderr, "\n"); } do { - fprintf(stderr, "Specify next volume #: "); + fprintf(stderr, "Specify next volume # (none if no more volumes): "); (void) fflush(stderr); (void) fgets(buf, TP_BSIZE, terminal); } while (!feof(terminal) && buf[0] == '\n'); if (feof(terminal)) exit(1); + if (!strcmp(buf, "none\n")) { + terminateinput(); + return; + } newvol = atoi(buf); if (newvol <= 0) { fprintf(stderr,