Sure. That solves the immediate problem, provides people with a strong hint to use options, and does no harm to the legacy option behaviour which people used for half a century and will use for the next half a century....
Todd C. Miller <todd.mil...@sudo.ws> wrote: > On Thu, 02 Jun 2022 07:54:02 -0600, "Theo de Raadt" wrote: > > > I'm fine with a / check, but it also needs documenting. While there can't > > we say at least one option must be supplied? > > How about this? > > - todd > > Index: sbin/dump/dump.8 > =================================================================== > RCS file: /cvs/src/sbin/dump/dump.8,v > retrieving revision 1.54 > diff -u -p -u -r1.54 dump.8 > --- sbin/dump/dump.8 19 Dec 2019 09:38:03 -0000 1.54 > +++ sbin/dump/dump.8 2 Jun 2022 14:39:09 -0000 > @@ -293,6 +293,13 @@ In the latter case, certain restrictions > is ignored, the only dump level that is supported is > .Fl 0 , > and all of the files must reside on the same filesystem. > +If no options are specified, the first of the > +.Ar files-to-dump > +must contain a > +.Ql / > +character to prevent it from being interpreted as a > +.Bx 4.3 > +option string. > .Pp > .Nm > requires operator intervention on these conditions: > Index: sbin/dump/main.c > =================================================================== > RCS file: /cvs/src/sbin/dump/main.c,v > retrieving revision 1.62 > diff -u -p -u -r1.62 main.c > --- sbin/dump/main.c 21 Jan 2021 00:16:36 -0000 1.62 > +++ sbin/dump/main.c 2 Jun 2022 13:32:15 -0000 > @@ -718,9 +718,9 @@ obsolete(int *argcp, char **argvp[]) > argv = *argvp; > argc = *argcp; > > - /* Return if no arguments or first argument has leading dash. */ > + /* Return if no args or first argument has leading dash or a slash. */ > ap = argv[1]; > - if (argc == 1 || *ap == '-') > + if (argc == 1 || *ap == '-' || strchr(ap, '/') != NULL) > return; > > /* Allocate space for new arguments. */