delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2016/03/31/11:25:15

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:subject:to:references:from:message-id:date
:mime-version:in-reply-to:content-type; q=dns; s=default; b=gbCx
bP2PM7vYvjx44quyematv7J6z4DJHMxjtvnDsj+NxLk4V4D8Lw9hud4l3UFbBzFW
0kjU3VAEffaIouPAW6+X+0ihmoSyaoGuU5tqFPRQTOyKoH1apl+Yg3Z/kCpea6gK
f+/PdCfC34m6XoSnDX8+8lfDKJNnC5ttmqLYaaw=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:subject:to:references:from:message-id:date
:mime-version:in-reply-to:content-type; s=default; bh=1ooTi8HXyp
oJ3bzSXiev4hDdnQA=; b=HzZsb+g+ev2N6chGBte7JLl77yVx5iB4UBP+OsSmcL
YcxHluXfau4WMNb9Azx7q0DxNM5xuqoqmbLgoFM/+1pWNFZypKXYKXy+sBKDIyIn
IQIHGc0US9NTUFSmIPab0TvE56HTjze5WeAsQInCY3Av1Zk2txopv0Il6sQtE65l
g=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-2.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=MUST, Hx-languages-length:1547, H*MI:sk:56FD268, H*f:sk:56FD268
X-HELO: mx1.redhat.com
Subject: Re: windows exit codes truncated to 1 Byte
To: cygwin AT cygwin DOT com
References: <1233154500 DOT 205789 DOT 1459429282664 DOT JavaMail DOT yahoo DOT ref AT mail DOT yahoo DOT com> <1233154500 DOT 205789 DOT 1459429282664 DOT JavaMail DOT yahoo AT mail DOT yahoo DOT com> <56FD268D DOT 4060904 AT gmx DOT de>
From: Eric Blake <eblake AT redhat DOT com>
Openpgp: url=http://people.redhat.com/eblake/eblake.gpg
Message-ID: <56FD413A.9050502@redhat.com>
Date: Thu, 31 Mar 2016 09:24:42 -0600
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.1
MIME-Version: 1.0
In-Reply-To: <56FD268D.4060904@gmx.de>
X-IsSubscribed: yes

--UrLiU2iCvsek7aejr6uBIsUKR5VEav7WD
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

On 03/31/2016 07:30 AM, Bj=C3=B6rn Stabel wrote:
> Am 31.03.2016 um 15:01 schrieb Cristian:
>> I noted that exit codes returned by CMD and other apps (msiexec) are tru=
ncated to 1 byte (0 .. 255).

This matches Linux, but not POSIX.

>> Windows exit codes are represented using 32 bits, so is this limitation =
intentional?

Part intentional (we do what Linux does), and part accidental (Cygwin
handles the return status slightly different than Windows, and that
handling makes it impossible to easily preserve all 32-bits, even if
Linux were to be patched to obey POSIX).

> 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).

> Maybe there's another way to get the entire status value, but this looks
> like a POSIX limitation to me.
> Cygwin is conformant here.

Cygwin is only partially conformant here.

See also: http://austingroupbugs.net/view.php?id=3D947

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


--UrLiU2iCvsek7aejr6uBIsUKR5VEav7WD
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
Comment: Public key at http://people.redhat.com/eblake/eblake.gpg
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBCAAGBQJW/UE7AAoJEKeha0olJ0NqD/IH/2ErpdVRmZfiaQHhDHpb/EzI
Bf0oCXlhjnibAZ28oS8TPcr1rlEo4HobcKZsImF7DUXfVIPP8D4ZTWKyWI0eBr2X
kVBuHSxbw8QpudbnkEffexwKPsnX6kNm0FnQGnmfu6d2AVhpY0zgY562SnvS3Q7H
XuYze/5dWhs5QiFu5+oh/HzJOM/mpec4m/tMozTxg5+s0PIg+8hgzxTVzZ/O/h8U
eqVPKBqJRKp8bkBFgWsVBeIEMYk56WikXFrHmH4T36au54n2/u9mXWgerwZ1Lq4+
W4U+ciQPWN9e35Vp3S/9ed5wS4HAVuKixuAcBt5Yedi7Hor4W7w1YfJ3d7bUDd0=
=0TZ3
-----END PGP SIGNATURE-----

--UrLiU2iCvsek7aejr6uBIsUKR5VEav7WD--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019