On Fri, 12 Oct 2018 17:55:14 +0100
Jason McIntyre wrote:
> On Fri, Oct 12, 2018 at 10:13:13PM +1300, Dave Cameron wrote:
> > doas(1) currently states:
> > -clip-
> > EXIT STATUS
> > The doas utility exits 0 on success, and >0 if an error
> > occurs. It may fail for one of the following reasons:
> >
> > o The config file /etc/doas.conf could not be parsed.
> > o The user attempted to run a command which is not permitted.
> > o The password was incorrect.
> > o The specified command was not found or is not executable.
> > -clip-
> > This is incorrect, doas returns the exit status of command as in:
> > -clip-
> > $ doas false && echo "was true"
> > -no output-
> >
> > $ doas true && echo "was true"
> > was true
> > -clip-
> >
> > Manpage amended, to be like nice(1).
> >
> > Patch below:
> >
>
> hi.
>
> this is not quite the full story, i think: for options like -C the man
> page is correct. so i think your diff should somehow spell out that
> generally doas will exit with the status of command, but can itself
> exit in such and such a manner if invoked with the options ..
>
> jmc
>
I believe this updated patch enumerates all possible cases, though I'm
not sure the style is ideal:
-snip-
EXIT STATUS
doas may fail for one of the following reasons:
• The config file /etc/doas.conf could not be parsed.
• The user attempted to run a command which is not permitted.
• The password was incorrect.
• The password was required, but -n was given.
• The specified command was not found or is not executable.
Otherwise, the exit status of doas shall be that of command, the
shell if the -s option was given, or 0 if the -C or -L options
were given.
-snip-
I also added the error condition when a password is required
non-interactively.
Someone else may be able to put it better.
Dave Cameron
Index: usr.bin/doas/doas.1
===
RCS file: /cvs/src/usr.bin/doas/doas.1,v
retrieving revision 1.19
diff -u -r1.19 doas.1
--- usr.bin/doas/doas.1 4 Sep 2016 15:20:37 - 1.19
+++ usr.bin/doas/doas.1 12 Oct 2018 22:03:53 -
@@ -87,8 +87,8 @@
The default is root.
.El
.Sh EXIT STATUS
-.Ex -std doas
-It may fail for one of the following reasons:
+.Nm
+may fail for one of the following reasons:
.Pp
.Bl -bullet -compact
.It
@@ -100,8 +100,17 @@
.It
The password was incorrect.
.It
+The password was required, but -n was given.
+.It
The specified command was not found or is not executable.
.El
+.Pp
+Otherwise, the exit status of
+.Nm
+shall be that of
+.Ar command ,
+the shell if the -s option was given,
+or 0 if the -C or -L options were given.
.Sh SEE ALSO
.Xr su 1 ,
.Xr doas.conf 5
--