From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 69188 invoked by alias); 31 Mar 2016 15:24:56 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 69173 invoked by uid 89); 31 Mar 2016 15:24:55 -0000 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 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 31 Mar 2016 15:24:44 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A124D46202 for ; Thu, 31 Mar 2016 15:24:43 +0000 (UTC) Received: from [10.3.113.124] (ovpn-113-124.phx2.redhat.com [10.3.113.124]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u2VFOh9m030181 for ; Thu, 31 Mar 2016 11:24:43 -0400 Subject: Re: windows exit codes truncated to 1 Byte To: cygwin@cygwin.com References: <1233154500.205789.1459429282664.JavaMail.yahoo.ref@mail.yahoo.com> <1233154500.205789.1459429282664.JavaMail.yahoo@mail.yahoo.com> <56FD268D.4060904@gmx.de> From: Eric Blake Openpgp: url=http://people.redhat.com/eblake/eblake.gpg Message-ID: <56FD413A.9050502@redhat.com> Date: Thu, 31 Mar 2016 15:24:00 -0000 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> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="UrLiU2iCvsek7aejr6uBIsUKR5VEav7WD" X-IsSubscribed: yes X-SW-Source: 2016-03/txt/msg00577.txt.bz2 --UrLiU2iCvsek7aejr6uBIsUKR5VEav7WD Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Content-length: 1522 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" Content-length: 604 -----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--