[quake3-bugzilla] [Bug 5080] [patch] code/sys/sys_unix.c:Sys_Dialog doesn't check exit codes properly

bugzilla-daemon at icculus.org bugzilla-daemon at icculus.org
Sun Jul 17 14:29:28 EDT 2011


https://bugzilla.icculus.org/show_bug.cgi?id=5080

--- Comment #5 from Simon McVittie <smcv-ioquake3 at pseudorandom.co.uk> 2011-07-17 14:29:24 EDT ---
(In reply to comment #4)
> I
> think exit code 127 is always command not found because /bin/sh is a POSIX
> shell.  I don't have the spec in front of me, but my guess is that it's a
> requirement.

POSIX 2008 <http://pubs.opengroup.org/onlinepubs/9699919799/> basically says
the same as bash documents:
> If a command is not found, the exit status shall be 127. If the command name
> is found, but it is not an executable utility, the exit status shall be 126.
> Applications that invoke utilities without using the shell should use these
> exit status values to report similar errors.
>
> If a command fails during word expansion or redirection, its exit status
> shall be greater than zero.

(In reply to comment #4)
> On Debian, you can use dash
> instead of /bin/sh (bash) which is smaller but still meets the POSIX
> requirements.

(More precisely, /bin/sh on Debian can either be dash or bash; dash is the
default for new installs.)

As I said above, dash doesn't document its behaviour, but in practice it's the
same as specified by POSIX.

> To summarize, you can assume 127 = command not found and then you need to force
> all three commands to return certain return codes or go through them all and
> find out what they return.

Yes, that; except that 126 will almost never be seen in practice (unless you
deliberately chmod -x /usr/bin/zenity, or whatever), but it'd be correct to
treat it like 127.

-- 
Configure bugmail: https://bugzilla.icculus.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the quake3-bugzilla mailing list