On Fri, Jan 28, 2022 at 06:32:07PM -0800, Philip Guenther wrote: > On Fri, Jan 28, 2022 at 5:28 AM наб <nabijaczlew...@nabijaczleweli.xyz> > wrote: > > This is a base-line attempt at separating errors from the child from the > > ones from script itself ‒ 125 is the general-purpose code in POSIX > > utilities that exec() (with 126 being ENOEXEC and 127 ‒ ENOENT) > > > > I just checked the draft of the next revision of the POSIX spec and can > find no reference to 125 being either recommended or required as the status > for general exec failures. For example, the spec for xargs includes this: > > EXIT STATUS > The following exit values shall be returned: > 0 All invocations of utility returned exit > status zero. > 1-125 A command line meeting the specified > requirements could > not be assembled, one or more of the > invocations of utility > returned a non-zero exit status, or some > other error occurred. > 126 The utility specified by utility was found but > could not be invoked. > 127 The utility specified by utility could not be > found. > > I'm confident that this isn't a change from previous versions. Where is > this proposed use of 125 documented? I guess I overconstrained that ‒ all utilities that explicitly note a general failure (xargs, as you mentioned, env, time, &c.) do note "1-125 An error occurred in the env utility.".
I think it'd be Nice to return 125 (since we already exit 126/127 when forwarding sh(1)) to enforce a better separation of the child exit codes from the script exit codes, but if you don't feel like that's a good reason to deviate from the status quo so far then that's fair enough, too, and I don't feel /too/ strongly about it either way. > Philip Guenther Best, наб
signature.asc
Description: PGP signature