This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: windows exit codes truncated to 1 Byte


On 03/31/2016 12:50 PM, Corinna Vinschen wrote:
> On Mar 31 09:24, Eric Blake wrote:
>> On 03/31/2016 07:30 AM, BjÃrn Stabel wrote:
>>> Am 31.03.2016 um 15:01 schrieb Cristian:
>>>> I noted that exit codes returned by CMD and other apps (msiexec) are truncated to 1 byte (0 .. 255).
>>
>> This matches Linux, but not POSIX.
> 
> Why?  Does bash use waitid?

Not yet, but with the link I referred to below, the thought is that
eventually bash WILL use waitid(), based on the direction POSIX is
headed in.

> But...
> 
>>> POSIX specifies that the lower 8 bits of the exit status be made
>>> available to the caller of wait/waitpid:
>>> http://pubs.opengroup.org/onlinepubs/9699919799/functions/wait.html
>>
>> Correct: wait() and waitpid() can only return 8 bits; but POSIX states
>> that waitid() MUST be able to access all 32-bits untruncated; this is
>> where Linux gets it wrong (Linux truncates during exit(), so waitid()
>> can only return 8 bits; other operating systems do NOT truncate during
>> exit, but preserve all 32 bits; if you use wait() or waitpid() you only
>> get 8 bits, but if you use waitid() you can see the full 32 bits).
> 
> ...that only makes sense if we implement waitid at all.  SHTDI and all
> that...

Right - without waitid(), it's fairly obvious that cygwin isn't quite up
to POSIX compliance yet :)  And indeed, patches are welcome, if someone
who cares enough about more than 8 bits wants to step up and write it
(personally, I don't care enough as long as Linux is still truncating
early during exit()).

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]