-N restore option man page entry
-$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 ???????????????)
=====================================================================
Changes between versions 0.4b26 and 0.4b27 (released ???????????????)
=====================================================================
1. Fixed behaviour of dump when exceeding resource limits
(SIGXFSZ treatment).
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)
=====================================================================
Changes between versions 0.4b25 and 0.4b26 (released January 7, 2002)
=====================================================================
#ifndef lint
static const char rcsid[] =
#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>
#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 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;
int dokerberos = 0;
char command = '\0';
long dumpnum = 1;
#ifdef KERBEROS
"k"
#endif
#ifdef KERBEROS
"k"
#endif
#ifdef USE_QFA
"Q:"
#endif
#ifdef USE_QFA
"Q:"
#endif
case 'l':
lflag = 1;
break;
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;
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",
(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]",
__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 'D':
case 'f':
case 'F':
case 'Q':
case 's':
case 'T':
case 'Q':
case 's':
case 'T':
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" 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
.\"
.Dd __DATE__
.Dt RESTORE 8
.Op Fl D Ar filesystem
.Op Fl f Ar file
.Op Fl F Ar script
.Op Fl D Ar filesystem
.Op Fl f Ar file
.Op Fl F Ar script
.Op Fl s Ar fileno
.Op Fl T Ar directory
.Nm restore
.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.
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,
.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.
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,
.It Fl m
Extract by inode numbers rather than by file name.
This is useful if only a few files are being extracted,
-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
.It Fl Q Ar file
Use the file
.Ar file
#ifndef lint
static const char rcsid[] =
#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>
#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);
if (compare_ignore_not_found) break;
fprintf(stderr, "%s: (inode %lu) not found on tape\n",
name, (unsigned long)ino);
{
if ((ep->e_flags & (NEW|EXTRACT)) == 0) {
badentry(ep, "unexpected file on tape");
{
if ((ep->e_flags & (NEW|EXTRACT)) == 0) {
badentry(ep, "unexpected file on tape");
}
if (do_compare) (void) comparefile(myname(ep));
ep->e_flags &= ~(NEW|EXTRACT);
}
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));
if (ep == NULL)
panic("%d: bad first\n", first);
fprintf(stderr, "%s: not found on tape\n", myname(ep));
ep->e_flags &= ~(NEW|EXTRACT);
first = lowerbnd(first);
}
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);
if (first != curfile.ino) {
fprintf(stderr, "expected next file %ld, got %lu\n",
(long)first, (unsigned long)curfile.ino);
skipfile();
goto next;
}
ep = lookupino(curfile.ino);
if (ep == NULL) {
panic("unknown file on tape\n");
skipfile();
goto next;
}
ep = lookupino(curfile.ino);
if (ep == NULL) {
panic("unknown file on tape\n");
}
compare_entry(ep, 1);
for (ep = ep->e_links; ep != NULL; ep = ep->e_links) {
}
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);
panic("%d: bad first\n", first);
fprintf(stderr, "%s: (inode %lu) not found on tape\n",
myname(ep), (unsigned long)first);
ep->e_flags &= ~(NEW|EXTRACT);
first = lowerbnd(first);
}
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);
panic("%d: bad first\n", first);
fprintf(stderr, "%s: (inode %lu) not found on tape\n",
myname(ep), (unsigned long)first);
ep->e_flags &= ~(NEW|EXTRACT);
first = lowerbnd(first);
}
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
*
* 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 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 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 */
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[] =
#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>
#endif /* not lint */
#include <config.h>
if (STAT(tapefile, &sbuf_tape) != 0) {
panic("Can't lstat tmp file %s: %s\n", tapefile,
strerror(errno));
if (STAT(tapefile, &sbuf_tape) != 0) {
panic("Can't lstat tmp file %s: %s\n", tapefile,
strerror(errno));
}
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);
}
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);
#ifdef COMPARE_FAIL_KEEP_FILE
return (0);
#else
#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));
if ((fd_tape = OPEN(tapefile, O_RDONLY)) < 0) {
panic("Can't open %s: %s\n", tapefile, strerror(errno));
}
if ((fd_disk = OPEN(diskfile, O_RDONLY)) < 0) {
close(fd_tape);
panic("Can't open %s: %s\n", diskfile, strerror(errno));
}
if ((fd_disk = OPEN(diskfile, O_RDONLY)) < 0) {
close(fd_tape);
panic("Can't open %s: %s\n", diskfile, strerror(errno));
}
if (do_cmpfiles(fd_tape, fd_disk, sbuf_tape.st_size)) {
}
if (do_cmpfiles(fd_tape, fd_disk, sbuf_tape.st_size)) {
diskfile);
close(fd_tape);
close(fd_disk);
diskfile);
close(fd_tape);
close(fd_disk);
#ifdef COMPARE_FAIL_KEEP_FILE
/* rename the file to live in /tmp */
/* rename `tapefile' to /tmp/<basename of diskfile> */
#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);
if ((r = LSTAT(name, &sb)) != 0) {
warn("%s: does not exist (%d)", name, r);
if (sb.st_mode != mode) {
fprintf(stderr, "%s: mode changed from 0%o to 0%o.\n",
name, mode & 07777, sb.st_mode & 07777);
if (sb.st_mode != mode) {
fprintf(stderr, "%s: mode changed from 0%o to 0%o.\n",
name, mode & 07777, sb.st_mode & 07777);
}
switch (mode & IFMT) {
default:
}
switch (mode & IFMT) {
default:
if (!(sb.st_mode & S_IFLNK)) {
fprintf(stderr, "%s: is no longer a symbolic link\n",
name);
if (!(sb.st_mode & S_IFLNK)) {
fprintf(stderr, "%s: is no longer a symbolic link\n",
name);
return;
}
lnkbuf[0] = '\0';
return;
}
lnkbuf[0] = '\0';
fprintf(stderr,
"%s: zero length symbolic link (ignored)\n",
name);
fprintf(stderr,
"%s: zero length symbolic link (ignored)\n",
name);
return;
}
if ((lsize = readlink(name, lbuf, MAXPATHLEN)) < 0) {
panic("readlink of %s failed: %s", name,
strerror(errno));
return;
}
if ((lsize = readlink(name, lbuf, MAXPATHLEN)) < 0) {
panic("readlink of %s failed: %s", name,
strerror(errno));
}
lbuf[lsize] = 0;
if (strcmp(lbuf, lnkbuf) != 0) {
fprintf(stderr,
"%s: symbolic link changed from %s to %s.\n",
name, lnkbuf, lbuf);
}
lbuf[lsize] = 0;
if (strcmp(lbuf, lnkbuf) != 0) {
fprintf(stderr,
"%s: symbolic link changed from %s to %s.\n",
name, lnkbuf, lbuf);
if (!(sb.st_mode & (S_IFCHR|S_IFBLK))) {
fprintf(stderr, "%s: no longer a special file\n",
name);
if (!(sb.st_mode & (S_IFCHR|S_IFBLK))) {
fprintf(stderr, "%s: no longer a special file\n",
name);
(int)curfile.dip->di_rdev & 0xff,
((int)sb.st_rdev >> 8) & 0xff,
(int)sb.st_rdev & 0xff);
(int)curfile.dip->di_rdev & 0xff,
((int)sb.st_rdev >> 8) & 0xff,
(int)sb.st_rdev & 0xff);
if ((ifile = OPEN(name, O_RDONLY)) < 0) {
panic("Can't open %s: %s\n", name, strerror(errno));
skipfile();
if ((ifile = OPEN(name, O_RDONLY)) < 0) {
panic("Can't open %s: %s\n", name, strerror(errno));
skipfile();