Mail Archives: cygwin/2015/09/03/06:56:10
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=kY7dQQ6Uy1t/rJ6A0zMdrk1C3tidMnmdhKsSRrTJDDSv7BBmKyxPq
|
| 4GPJXsg1b3BLwVELg6ZNfAEbwOOzhZoplydQF9UrHEjG3EzG9IzjVqvXVTUUCU/U
|
| KcexTPLPXOqBdQt+5S7/5v3YLW/kojjDRWHaxLIAEhKXqI2TMiN/5Y=
|
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=RwFfQj1LD+la+mNRe1qU/biIyUg=; b=MDP1GoFywze85c9cicRawXrjb64i
|
| g0vbvoBwCdDfCDf6hO8jP0AITtVK+ihAMK+fuQrEKgMhUYOkDHbmdUDTaSzgVgu0
|
| 0MpH0Hz62UnPEYvbfDH1UAbCBf2XFX8k5EWfIksHB9jUfF44Mc+W8xInRlKUKz8e
|
| sLA4a8Lo4mtQUg0=
|
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=-4.1 required=5.0 tests=AWL,BAYES_50,KAM_LAZY_DOMAIN_SECURITY autolearn=no version=3.3.2
|
X-HELO: | calimero.vinschen.de
|
Date: | Thu, 3 Sep 2015 12:55:49 +0200
|
From: | Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
|
To: | cygwin AT cygwin DOT com
|
Subject: | Re: [OT] Wine + Cygwin: `script -e` exit status forwarding randomly return zero for non zero child process
|
Message-ID: | <20150903105549.GT23669@calimero.vinschen.de>
|
Reply-To: | cygwin AT cygwin DOT com
|
Mail-Followup-To: | cygwin AT cygwin DOT com
|
References: | <CALd+sZS6eHn8tUxCzB-JhGkfn2FUzg5dNKHwcY+ryBT-o=2DFw AT mail DOT gmail DOT com>
|
MIME-Version: | 1.0
|
In-Reply-To: | <CALd+sZS6eHn8tUxCzB-JhGkfn2FUzg5dNKHwcY+ryBT-o=2DFw@mail.gmail.com>
|
User-Agent: | Mutt/1.5.23 (2014-03-12)
|
--2xeD/fx0+7k8I/QN
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
Hi Qian,
On Sep 2 22:27, Qian Hong wrote:
> Dear list,
>=20
> Before the actual question, I wonder whether Wine specific issues are
> considered as off-topic here, and whether it is allowed here? Anyway,
> thanks for your great contribution on Cygwin!
>=20
> In the past few months, we were working on supporting Cygwin/MSYS2 on
> Wine (Wine Staging at this moment, we will upstream our patches
> lately). After fixing a couple of Wine Staging bugs [1], today
> Cygwin/MSYS2 works much better on Wine Staging than before.
> GCC/GDB/etc, including most part of toolchain, are now basically
> supported on Wine Staging 1.7.50.
>=20
> However, the remain bugs are difficult, so it would be great to have
> some help from Cygwin community to speed up the bug fix progress, many
> thanks for anyone interesting to join!
>=20
> =3D=3D=3D=3D thanks for reading :) =3D=3D=3D=3D
>=20
> Now, here is one bug blocks me for two days:
>=20
> On Cygwin Windows, `script -e -c "exit 5"` will always return 5;
> On Cygwin Wine, `script -e -c "exit 5"` sometimes returns 5 while
> sometimes return zero. I tested with a 100-times-loop, 34 of them
> return zero, while 66 of them return 5.
Comparing the straces, two interesting facts are conspicuous:
- Independently of "good" or "bad", it's pretty clear that everything
worked as expected as far as the child processes of the parent script
are concerned. In both cases, the 1st forked script process returns
with the correct result:
good (parent script pid 48, child script pid 50):
4026 6468659 [main] script 50 pinfo::exit: Calling ExitProcess n 0x500,
exitcode 0x500
[...]
5079923 6473669 [waitproc] script 48 pinfo::maybe_set_exit_code_from_wi=
ndows
: pid 50, exit value - old 0x8000500, windows 0xDEADBEEF, cygwin 0x8000=
500
bad (parent script pid 25, child script pid 38):
215 2716087 [main] script 38 pinfo::exit: Calling ExitProcess n 0x500,
exitcode 0x500
[...]
2487909 2717274 [waitproc] script 25 pinfo::maybe_set_exit_code_from_wi=
ndows
: pid 38, exit value - old 0x8000500, windows 0xDEADBEEF, cygwin 0x8000=
500
- After the forked script returned, what happens in the parent is absolutly
identical in both cases, up to a point during exit. This point is reached
with line 1573 in the "bad" case and line 1580 in the "good" case. Then
"something" happens:
In the bad case the pty master thread gets an error condition returned
from DisconnectNamedPipe:
305 2754169 [ptym] script 25 fhandler_pty_master::pty_master_thread:
DisconnectNamedPipe, Win32 error 6
After that, the pty master thread exits in both cases and then, for
some invisible reason, the "bad" process exits immediately, even
though it's not really finished:
170 2755070 [main] script 25 cygthread::terminate_thread: thread 'pty=
mf',
id 0x3F, inuse 1, stack_ptr 0xC0B7D0
--- Process 25 thread 63 exited with status 0x0
--- Process 25 thread 61 exited with status 0x0
--- Process 25 thread 12 exited with status 0x0
--- Process 25 thread 11 exited with status 0x0
--- Process 25 exited with status 0x0
while the "good" guy performs the remaining cleanup tasks. The last
of the remaining cleanup tasks is calling ExitProcess with the right
exit code:
221 7249273 [main] script 48 pinfo::exit: Calling ExitProcess n 0x500,
exitcode 0x5
To me this looks like the "bad" script has been exited forcefully
for some reason.
There's something else which occured to me while looking through both
straces: Are you aware that Windows PIDs are *always* multiples of 4?
PID 0, 4, 8, 12, 16, ... exist
PID 1, 2, 3, 5, 6, 7, ... don't.
Wine apparently doesn't follow this scheme. I would treat that as a bug.
I can easily imagine applications which rely on the fact that PIDs are
always multiples of four and use the lower two bits for dubious purposes.
I'd suggest to change that in Wine for compatibility reasons.
HTH,
Corinna
--=20
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Maintainer cygwin AT cygwin DOT com
Red Hat
--2xeD/fx0+7k8I/QN
Content-Type: application/pgp-signature
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iQIcBAEBCAAGBQJV6Cc1AAoJEPU2Bp2uRE+g/KYP/jDNWfLuSZA+jvXTKo/fIypT
g4VnIjsqv0XThEfQ7TVPi97R/sUo6UBDl+5brDerOhsuC7C2bWM9jfyQh8P+lbwu
vlPMYAvBaJJXB45fPc7Wy/n9E81kU7Ud71WyM6PyVCCtAjfe8cKcXqzyzTO54V2e
rXG/F3/6hjGIuko4JuTiheAC3U/xz3pcOCAI8if4r7v9KGq6oO2ZhplJhUuSSPVs
KcfFXkvorHCbWU68zoKwfPFN0H4OZH4L6M5+Ta2kr9WLnPvSYcIY+F8ZBEn69hHH
8mnyOyzuptwaPYtj6M6AtADZi8DlCLvrsZ79BD7EVOPUk5aRuc6sxSaTw/hGkIIH
WqiEyHMFPhtA/B2Z10oH5WYjHpcYYMkJn3vhNOoeyeuMUyO+sFRakDuw7vrjTBf3
0tB9VROAMvAjl246iEJtelfy+FqjyivFE71WTtZXm/OBh5c5DYwnUdg9yeHtSwTC
P1LiO6Xu+lEzmkRGEQnXdbS91avLsZr6MWsdbeOQRgKWN+b6zRoTFhtPD5UrlzOn
d14QUqpO7GMBhxcnul6Op/v/t7wrsb478OoL2y7pSmpxLxTk4VLDKa+iWemh3M5q
aweyKqFXS+jPk8Xu3V8gOQcQxWjpePPntp+Jxl8Payctepe6mC5jF73iyi1zo5Nv
n3HzVsmQtlp9NWgy9fqD
=/F85
-----END PGP SIGNATURE-----
--2xeD/fx0+7k8I/QN--
- Raw text -