-$Id: CHANGES,v 1.154 2002/01/10 09:02:54 stelian Exp $
+$Id: CHANGES,v 1.155 2002/01/11 08:54:12 stelian Exp $
Changes between versions 0.4b26 and 0.4b27 (released ???????????????)
=====================================================================
1. Fixed behaviour of dump when exceeding resource limits
(SIGXFSZ treatment).
+2. Added the -L flag to restore to allow the user to specify a
+ maximal allowed number of miscompares when using restore
+ with the -C option to check the backup.
+
+3. Detailed the manual entry for the -N option of restore.
+
Changes between versions 0.4b25 and 0.4b26 (released January 7, 2002)
=====================================================================
#ifndef lint
static const char rcsid[] =
- "$Id: main.c,v 1.32 2001/11/16 14:09:07 stelian Exp $";
+ "$Id: main.c,v 1.33 2002/01/11 08:54:14 stelian Exp $";
#endif /* not lint */
#include <config.h>
int bflag = 0, cvtflag = 0, dflag = 0, vflag = 0, yflag = 0;
int hflag = 1, mflag = 1, Mflag = 0, Nflag = 0, Vflag = 0, zflag = 0;
-int uflag = 0, lflag = 0;
+int uflag = 0, lflag = 0, Lflag = 0;
int dokerberos = 0;
char command = '\0';
long dumpnum = 1;
#ifdef KERBEROS
"k"
#endif
- "lmMN"
+ "lL:mMN"
#ifdef USE_QFA
"Q:"
#endif
case 'l':
lflag = 1;
break;
+ case 'L':
+ Lflag = strtol(optarg, &p, 10);
+ if (*p)
+ errx(1, "illegal limit -- %s", optarg);
+ if (Lflag < 0)
+ errx(1, "limit must be greater than 0");
+ break;
case 'm':
mflag = 0;
break;
(void)fprintf(stderr,
"usage:\t%s%s\n\t%s%s\n\t%s%s\n\t%s%s\n\t%s%s\n\t%s%s\n",
- __progname, " -C [-c" kerbflag "lMvVy] [-b blocksize] [-D filesystem] [-f file] [-F script] [-s fileno]",
+ __progname, " -C [-c" kerbflag "lMvVy] [-b blocksize] [-D filesystem] [-f file] [-F script] [-L limit] [-s fileno]",
__progname, " -i [-ch" kerbflag "lmMuvVy] [-b blocksize] [-f file] [-F script] " qfaflag "[-s fileno]",
__progname, " -r [-c" kerbflag "lMuvVy] [-b blocksize] [-f file] [-F script] [-s fileno] [-T directory]",
__progname, " -R [-c" kerbflag "lMuvVy] [-b blocksize] [-f file] [-F script] [-s fileno] [-T directory]",
case 'D':
case 'f':
case 'F':
+ case 'L':
case 'Q':
case 's':
case 'T':
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $Id: restore.8.in,v 1.19 2001/11/16 14:09:07 stelian Exp $
+.\" $Id: restore.8.in,v 1.20 2002/01/11 08:54:14 stelian Exp $
.\"
.Dd __DATE__
.Dt RESTORE 8
.Op Fl D Ar filesystem
.Op Fl f Ar file
.Op Fl F Ar script
+.Op Fl L Ar limit
.Op Fl s Ar fileno
.Op Fl T Ar directory
.Nm restore
It first changes its working directory to the root of the filesystem
that was dumped and compares the tape with the files in its new
current directory.
+See also the
+.Fl L
+flag described below.
.It Fl i
This mode allows interactive restoration of files from a dump.
After reading in the directory information from the dump,
option or
.Nm restore
will fail to access it correctly.
+.It Fl L Ar limit
+The
+.Fl L
+flag allows the user to specify a maximal number of miscompares
+when using
+.Nm restore
+with the
+.Fl C
+option to check the backup. If this limit is reached,
+.Nm restore
+will abort with an error message. A value of 0 (the default value)
+disables the check.
.It Fl m
Extract by inode numbers rather than by file name.
This is useful if only a few files are being extracted,
.Fl N
flag causes
.Nm
-to only print file names. Files are not extracted.
+to perform a full execution as requested by one of
+.Fl i,
+.Fl R,
+.Fl r,
+.Fl t
+or
+.Fl x
+command without actually writing any file on disk.
.It Fl Q Ar file
Use the file
.Ar file
#ifndef lint
static const char rcsid[] =
- "$Id: restore.c,v 1.20 2001/12/24 15:53:41 stelian Exp $";
+ "$Id: restore.c,v 1.21 2002/01/11 08:54:14 stelian Exp $";
#endif /* not lint */
#include <config.h>
if (compare_ignore_not_found) break;
fprintf(stderr, "%s: (inode %lu) not found on tape\n",
name, (unsigned long)ino);
- compare_errors = 1;
+ do_compare_error;
break;
/*
{
if ((ep->e_flags & (NEW|EXTRACT)) == 0) {
badentry(ep, "unexpected file on tape");
- compare_errors = 1;
+ do_compare_error;
}
if (do_compare) (void) comparefile(myname(ep));
ep->e_flags &= ~(NEW|EXTRACT);
if (ep == NULL)
panic("%d: bad first\n", first);
fprintf(stderr, "%s: not found on tape\n", myname(ep));
- compare_errors = 1;
+ do_compare_error;
ep->e_flags &= ~(NEW|EXTRACT);
first = lowerbnd(first);
}
if (first != curfile.ino) {
fprintf(stderr, "expected next file %ld, got %lu\n",
(long)first, (unsigned long)curfile.ino);
- compare_errors = 1;
+ do_compare_error;
skipfile();
goto next;
}
ep = lookupino(curfile.ino);
if (ep == NULL) {
panic("unknown file on tape\n");
- compare_errors = 1;
+ do_compare_error;
}
compare_entry(ep, 1);
for (ep = ep->e_links; ep != NULL; ep = ep->e_links) {
panic("%d: bad first\n", first);
fprintf(stderr, "%s: (inode %lu) not found on tape\n",
myname(ep), (unsigned long)first);
- compare_errors = 1;
+ do_compare_error;
ep->e_flags &= ~(NEW|EXTRACT);
first = lowerbnd(first);
}
panic("%d: bad first\n", first);
fprintf(stderr, "%s: (inode %lu) not found on tape\n",
myname(ep), (unsigned long)first);
- compare_errors = 1;
+ do_compare_error;
ep->e_flags &= ~(NEW|EXTRACT);
first = lowerbnd(first);
}
* Stelian Pop <pop@noos.fr>, 1999-2000
* Stelian Pop <pop@noos.fr> - AlcĂ´ve <www.alcove.fr>, 2000
*
- * $Id: restore.h,v 1.20 2001/12/24 15:53:41 stelian Exp $
+ * $Id: restore.h,v 1.21 2002/01/11 08:54:14 stelian Exp $
*/
/*
extern int dflag; /* print out debugging info */
extern int hflag; /* restore heirarchies */
extern int lflag; /* assume remote filename is a regular file */
+extern int Lflag; /* compare errors limit */
extern int mflag; /* restore by name instead of inode number */
extern int Mflag; /* multi-volume restore */
extern int Vflag; /* multi-volume on a single device like CDROM */
extern long gSeekstart;
extern int tapeposflag;
#endif /* USE_QFA */
+
+#define do_compare_error \
+ if (++compare_errors >= Lflag && Lflag) { \
+ printf("Compare errors limit reached, exiting...\n"); \
+ exit(2); \
+ }
+
#ifndef lint
static const char rcsid[] =
- "$Id: tape.c,v 1.50 2001/12/24 15:53:41 stelian Exp $";
+ "$Id: tape.c,v 1.51 2002/01/11 08:54:14 stelian Exp $";
#endif /* not lint */
#include <config.h>
if (STAT(tapefile, &sbuf_tape) != 0) {
panic("Can't lstat tmp file %s: %s\n", tapefile,
strerror(errno));
- compare_errors = 1;
+ do_compare_error;
}
if (sbuf_disk->st_size != sbuf_tape.st_size) {
fprintf(stderr,
"%s: size changed from %ld to %ld.\n",
diskfile, (long)sbuf_tape.st_size, (long)sbuf_disk->st_size);
- compare_errors = 1;
+ do_compare_error;
#ifdef COMPARE_FAIL_KEEP_FILE
return (0);
#else
if ((fd_tape = OPEN(tapefile, O_RDONLY)) < 0) {
panic("Can't open %s: %s\n", tapefile, strerror(errno));
- compare_errors = 1;
+ do_compare_error;
}
if ((fd_disk = OPEN(diskfile, O_RDONLY)) < 0) {
close(fd_tape);
panic("Can't open %s: %s\n", diskfile, strerror(errno));
- compare_errors = 1;
+ do_compare_error;
}
if (do_cmpfiles(fd_tape, fd_disk, sbuf_tape.st_size)) {
diskfile);
close(fd_tape);
close(fd_disk);
- compare_errors = 1;
+ do_compare_error;
#ifdef COMPARE_FAIL_KEEP_FILE
/* rename the file to live in /tmp */
/* rename `tapefile' to /tmp/<basename of diskfile> */
if ((r = LSTAT(name, &sb)) != 0) {
warn("%s: does not exist (%d)", name, r);
- compare_errors = 1;
+ do_compare_error;
skipfile();
return;
}
if (sb.st_mode != mode) {
fprintf(stderr, "%s: mode changed from 0%o to 0%o.\n",
name, mode & 07777, sb.st_mode & 07777);
- compare_errors = 1;
+ do_compare_error;
}
switch (mode & IFMT) {
default:
if (!(sb.st_mode & S_IFLNK)) {
fprintf(stderr, "%s: is no longer a symbolic link\n",
name);
- compare_errors = 1;
+ do_compare_error;
return;
}
lnkbuf[0] = '\0';
fprintf(stderr,
"%s: zero length symbolic link (ignored)\n",
name);
- compare_errors = 1;
+ do_compare_error;
return;
}
if ((lsize = readlink(name, lbuf, MAXPATHLEN)) < 0) {
panic("readlink of %s failed: %s", name,
strerror(errno));
- compare_errors = 1;
+ do_compare_error;
}
lbuf[lsize] = 0;
if (strcmp(lbuf, lnkbuf) != 0) {
fprintf(stderr,
"%s: symbolic link changed from %s to %s.\n",
name, lnkbuf, lbuf);
- compare_errors = 1;
+ do_compare_error;
return;
}
return;
if (!(sb.st_mode & (S_IFCHR|S_IFBLK))) {
fprintf(stderr, "%s: no longer a special file\n",
name);
- compare_errors = 1;
+ do_compare_error;
skipfile();
return;
}
(int)curfile.dip->di_rdev & 0xff,
((int)sb.st_rdev >> 8) & 0xff,
(int)sb.st_rdev & 0xff);
- compare_errors = 1;
+ do_compare_error;
}
skipfile();
return;
if ((ifile = OPEN(name, O_RDONLY)) < 0) {
panic("Can't open %s: %s\n", name, strerror(errno));
skipfile();
- compare_errors = 1;
+ do_compare_error;
}
else {
cmperror = 0;
}
}
if (cmperror)
- compare_errors = 1;
+ do_compare_error;
close(ifile);
}
#else