delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2016/03/31/14:50:34

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:date:from:to:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; q=dns; s=
default; b=LJl/AoZVbEeJpwdf0sohRL6mGOpswS7I505tRRwd/IPt7CZrRte3v
AXz0LzInlF2UoXfSHrkcuIDESc9CCp6j8gzS/34lhoHuxduAsd0jHquPIlyfoKzW
iY0ys19xF8UYnb5rfc09nfXINK+mwW8+/gv1lrLcs8HUszZZqG1kTg=
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:date:from:to:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; s=default;
bh=2mcndtOoO6P3keBliHnUY/trJ6k=; b=Mxuv0AnGXLUhub9WN9/vKbCkTDLr
mqJd34v4SHew5DmWp/S6EISQVrHT4FrkGjK446BIPWdiPRjy2wh70US/qWSOFzaZ
lGZdUixi0FAihHYF/3qCWGJ2TZaWFigcFDVDmaTmsX202QeLQarVBZPhDA4spCSt
pyLN+p2/zzv4hw0=
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=-96.6 required=5.0 tests=BAYES_00,GOOD_FROM_CORINNA_CYGWIN,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_PBL,RDNS_DYNAMIC autolearn=ham version=3.3.2 spammy=H*f:sk:56FD413, H*i:sk:56FD413, H*MI:sk:56FD413, states
X-HELO: calimero.vinschen.de
Date: Thu, 31 Mar 2016 20:50:02 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: windows exit codes truncated to 1 Byte
Message-ID: <20160331185002.GA3353@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-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> <56FD413A DOT 9050502 AT redhat DOT com>
MIME-Version: 1.0
In-Reply-To: <56FD413A.9050502@redhat.com>
User-Agent: Mutt/1.5.24 (2015-08-30)

--tThc/1wpZn/ma/RB
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Mar 31 09:24, Eric Blake wrote:
> 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 t=
runcated to 1 byte (0 .. 255).
>=20
> This matches Linux, but not POSIX.

Why?  Does bash use waitid?

> >> Windows exit codes are represented using 32 bits, so is this limitatio=
n intentional?
>=20
> 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).

I don't quite understand this.  Right now the exitcode value is
truncated to 8 bits to fit into the 32 bit status value as defined
for wait/waitpid, but this is not set in stone.  We could change
the communication between parent and child to allow preserving the
full 32 bit value for waitid.

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
>=20
> 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...


Corinna

--=20
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

--tThc/1wpZn/ma/RB
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJW/XFaAAoJEPU2Bp2uRE+g4v0P/2v/msFe2/xPRayZHk2cqEua
3UIlB/Ne0Mr2Le5k61umk1nFCPaIF/tnRWIEncClm4V1ibSbiBVU844gkvFU4YVl
qH1dPdt2W1HxprX6zPlOKQwpFHAPuor4FeuvPbwbAuyWOdX+E38ZUly35lWtlkf3
KsYNCxo2aTyrB5GActy18RG8hNhLtEVVGD0eXcKhCo6aKsNhD2CJNqaXTa/9Iehq
KIHjnfG2iXz0nnBmgaFpLTwnGc65N7fBFBmYiIXpRjNIPnc8+UsAz0etLk3sSaSc
F4TUGJ8D8yy6Tkkm5zVQXvL4QOhEdPpTNyncdPEaJU6o5JKgPnrivXsbei+B27TB
cFjY9BJw1RYz8FcmBnMAHdDBYygD9WwxrJkEWDU6YYAFkGKcOEp81GP5dlrTkNVj
6aeZjBKQD7oa1jRd0VLfpAz9vZJQngsrQPoe8G3J0LkaNgQw73OEKVSHXTgILauu
8JCiZtt1yiIFbGo9uyhr0/C/b+/eMxL2paupnfgIj7LhUp0IiafIlG7oEM+IOYOH
z5VJiqVulJMQkB7VHvD/L5ykWETw0FMEMSI93Fy1JnjFxA9YeqKsZcJBdqg6tJxK
q0/DYQp8wzBOxmECjUShLSJJpcykFBa3p+z/0QzftnG8Lra9+Gito0ZsIhUjR7SC
IMZUqTpvmZdTK1+fbDwn
=97xF
-----END PGP SIGNATURE-----

--tThc/1wpZn/ma/RB--

- Raw text -


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