On Sun, Jun 14, 2015 at 06:14:09PM -0600, Theo de Raadt wrote:
> > If so, let me know and I can write a patch.
>
> Please do, then it is easier for archaic people to play with it.
This is my first patch, so I may have made some mistakes.
I tried to correct and expand the man page while leaving its existing
format. It's a little redundant, but it seems like this caveat is
important enough to describe more than once.
Of course, this breaks existing scripts that used the -a option -
they'll just get the usage prompt. It will fail more dangerously
(silently) with scripts intended for old-style tapes, so (if I
understand correctly) it should probably go in "Following -current" and
the release notes.
Index: sbin/dump/dump.8
===================================================================
RCS file: /cvs/src/sbin/dump/dump.8,v
retrieving revision 1.49
diff -u -p -r1.49 dump.8
--- sbin/dump/dump.8 3 May 2015 01:44:34 -0000 1.49
+++ sbin/dump/dump.8 15 Jun 2015 23:16:10 -0000
@@ -40,7 +40,7 @@
.Sh SYNOPSIS
.Nm dump
.Bk -words
-.Op Fl 0123456789acnSuWw
+.Op Fl 0123456789AcnSuWw
.Op Fl B Ar records
.Op Fl b Ar blocksize
.Op Fl d Ar density
@@ -62,8 +62,8 @@ A dump that is larger than the output me
multiple volumes.
On most media the size is determined by writing until an
end-of-media indication is returned.
-This can be enforced by using the
-.Fl a
+This is the default behavior and can be overridden with the
+.Fl A
option.
.Pp
.Nm
@@ -98,7 +98,10 @@ On media that cannot reliably return an
each volume is of a fixed size;
the actual size is determined by the tape size, density and/or
block count options below.
-By default, the same output file name is used for each volume
+The
+.Fl A
+option should be used with such media.
+The same output file name is used for each volume
after prompting the operator to change media.
.Pp
Rewinding or ejecting tape features after a close operation on
@@ -126,15 +129,24 @@ to
copy all files new or modified since the
last dump of a lower level.
The default level is 0.
-.It Fl a
-.Dq auto-size .
-Bypass all tape length considerations, and enforce writing until
-an end-of-media indication is returned.
-This option is recommended for most modern tape drives.
-Use of this option is particularly
-recommended when appending to an existing tape, or using a tape
-drive with hardware compression (where you can never be sure about
-the compression ratio).
+.It Fl A
+.Dq fixed-size .
+Assume that the media cannot reliably return
+an end-of-media indication, and therefore use fixed
+volume sizes.
+.Nm
+will prompt the operator
+for the readiness of each
+volume before it is written to.
+.Pp
+This was once the default behavior of
+.Nm dump Ns ,
+while the
+.Fl a
+option enforced auto-sizing. The default was reversed
+because backup volumes
+without end-of-media indication are becoming
+increasingly rare.
.It Fl B Ar records
The number of kilobytes per volume, rounded
down to a multiple of the blocksize.
@@ -451,6 +463,13 @@ The
.Bx 4.3
option syntax is implemented for backward compatibility but
is not documented here.
+.Pp
+The
+.Fl A
+option first appeared and the
+.Fl a
+option was removed in
+.Ox 5.8 .
.Sh BUGS
Fewer than 32 read errors on the filesystem are ignored.
.Pp
Index: sbin/dump/dump.h
===================================================================
RCS file: /cvs/src/sbin/dump/dump.h,v
retrieving revision 1.24
diff -u -p -r1.24 dump.h
--- sbin/dump/dump.h 23 May 2015 05:17:20 -0000 1.24
+++ sbin/dump/dump.h 15 Jun 2015 23:16:10 -0000
@@ -68,7 +68,7 @@ int newtape; /* new tape flag */
int density; /* density in 0.1" units */
int64_t tapesize; /* estimated tape size, blocks */
int64_t tsize; /* tape size in 0.1" units */
-int unlimited; /* if set, write to end of medium */
+int fixed; /* if set, use fixed volume size */
int64_t asize; /* number of 0.1" units written on current tape
*/
int etapes; /* estimated number of tapes */
int nonodump; /* if set, do not honor UF_NODUMP user flags */
Index: sbin/dump/main.c
===================================================================
RCS file: /cvs/src/sbin/dump/main.c,v
retrieving revision 1.56
diff -u -p -r1.56 main.c
--- sbin/dump/main.c 23 May 2015 05:17:20 -0000 1.56
+++ sbin/dump/main.c 15 Jun 2015 23:16:10 -0000
@@ -115,7 +115,7 @@ main(int argc, char *argv[])
usage();
obsolete(&argc, &argv);
- while ((ch = getopt(argc, argv, "0123456789aB:b:cd:f:h:ns:ST:uWw")) !=
-1)
+ while ((ch = getopt(argc, argv, "0123456789AB:b:cd:f:h:ns:ST:uWw")) !=
-1)
switch (ch) {
/* dump level */
case '0': case '1': case '2': case '3': case '4':
@@ -193,8 +193,8 @@ main(int argc, char *argv[])
exit(X_FINOK); /* do nothing else */
break;
- case 'a': /* `auto-size', Write to EOM. */
- unlimited = 1;
+ case 'A': /* `fixed-size' volumes */
+ fixed = 1;
break;
default:
@@ -291,7 +291,7 @@ main(int argc, char *argv[])
if (blocksperfile)
blocksperfile = blocksperfile / ntrec * ntrec; /* round down */
- else if (!unlimited) {
+ else if (fixed) {
/*
* Determine how to default tape size and density
*
@@ -468,7 +468,7 @@ main(int argc, char *argv[])
anydirskipped = mapdirs(maxino, &tapesize);
}
- if (pipeout || unlimited) {
+ if (pipeout || !fixed) {
tapesize += 10; /* 10 trailer blocks */
msg("estimated %lld tape blocks.\n", tapesize);
} else {
@@ -594,7 +594,7 @@ usage(void)
{
extern char *__progname;
- (void)fprintf(stderr, "usage: %s [-0123456789acnSuWw] [-B records] "
+ (void)fprintf(stderr, "usage: %s [-0123456789AcnSuWw] [-B records] "
"[-b blocksize] [-d density]\n"
"\t[-f file] [-h level] [-s feet] "
"[-T date] files-to-dump\n",
Index: sbin/dump/tape.c
===================================================================
RCS file: /cvs/src/sbin/dump/tape.c,v
retrieving revision 1.42
diff -u -p -r1.42 tape.c
--- sbin/dump/tape.c 20 Jan 2015 18:22:20 -0000 1.42
+++ sbin/dump/tape.c 15 Jun 2015 23:16:10 -0000
@@ -129,7 +129,7 @@ alloctape(void)
* repositioning after stopping, i.e, streaming mode, where the gap is
* variable, 0.30" to 0.45". The gap is maximal when the tape stops.
*/
- if (blocksperfile == 0 && !unlimited)
+ if (blocksperfile == 0 && fixed)
tenths = writesize / density +
(cartridge ? 16 : density == 625 ? 5 : 8);
/*
@@ -346,7 +346,7 @@ flushtape(void)
asize += tenths;
blockswritten += ntrec;
blocksthisvol += ntrec;
- if (!pipeout && !unlimited && (blocksperfile ?
+ if (!pipeout && fixed && (blocksperfile ?
(blocksthisvol >= blocksperfile) : (asize > tsize))) {
close_rewind();
startnewtape(0);