tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: style, sysexits(3), and man RETURN VALUES for sys programs



> Date: Sat, 3 Jun 2023 14:12:21 +0200
> From: tlaronde%polynum.com@localhost
> 
> Le Sat, Jun 03, 2023 at 12:02:20PM +0000, Taylor R Campbell a écrit :
> > > Date: Sat, 3 Jun 2023 13:45:44 +0200
> > > From: tlaronde%polynum.com@localhost
> > > 
> > > So I suggest to add a mention of sysexits(7) to style.
> > 
> > I don't think sysexits(7) is consistently used enough, or really
> > useful enough, to warrant being a part of the style guide.  Very few
> > programs, even those in src, use it, and I don't think anything
> > _relies_ on it for semantics in calling programs.
> 
> But I think it is a loss of information to put everything in
> EXIT_FAILURE. All in all, the majority of scripts will simply test
> against 0, so being more fine grained (there are only 15 exit values at
> the moment) doesn't cause problems and, IMHO, adds some value that can
> be useful.

It's not really a loss of information: usually the error message
printed to stderr is much more informative.

The question is whether it's useful for composition, so that calling
programs can make meaningful decisions to take useful action on the
basis of the called program's exit code -- like the convention of zero
for success, nonzero for failure, which is absolutely useful for
composition.

Unless you're devising a scheme to do that with sysexits(3), and
implementing it systematically so that other programs derive some
benefit from it, spending time to make inetd(8) scrupulously adhere to
the sysexits(3) ontology of failure modes is likely a distraction from
your main goals.


Home | Main Index | Thread Index | Old Index