From: Takashi Yano <takashi.yano@nifty.ne.jp>
To: cygwin@cygwin.com
Subject: Re: Bogus exit code 127 from a child process
Date: Mon, 18 Mar 2024 12:09:06 +0900 [thread overview]
Message-ID: <20240318120906.ccac3ad237a8f6c4c1b94c71@nifty.ne.jp> (raw)
In-Reply-To: <259F0ECF-9AE8-42E7-A746-8227F8B7870C@unified-streaming.com>
On Sun, 17 Mar 2024 14:10:55 +0100
Dimitry Andric wrote:
> On 17 Mar 2024, at 13:50, Dimitry Andric <dimitry@unified-streaming.com> wrote:
> >
> > On 17 Mar 2024, at 13:35, Takashi Yano via Cygwin <cygwin@cygwin.com> wrote:
> > ...
> >>
> >> I also test your test case:
> >> while bash -c 'true & true & wait -n || { echo 1: $?; exit 1; } && wait -n || { echo 2: $?; exit 1; }'; do echo $((i++)); done
> >> in Linux (Debian 12.5), and the issue reproduced!
> >
> > Yeah, same here with bash 5.1.16(1)-release on Ubuntu 22.04. It errors out with 127 after ~50-200 loops.
>
> Having built bash master (bash-5.2-27-gf3b6bd19) here, it consistently gives 127 in this area:
>
> https://git.savannah.gnu.org/cgit/bash.git/tree/builtins/wait.def#n227
>
> 211 #if defined (JOB_CONTROL)
> 212 if (nflag)
> 213 {
> 214 if (list)
> 215 {
> 216 opt = set_waitlist (list);
> 217 if (opt == 0)
> 218 WAIT_RETURN (127);
> 219 wflags |= JWAIT_WAITING;
> 220 }
> 221
> 222 status = wait_for_any_job (wflags, &pstat);
> 223 if (vname && status >= 0)
> 224 builtin_bind_var_to_int (vname, pstat.pid, bindflags);
> 225
> 226 if (status < 0)
> => 227 status = 127;
> 228 if (list)
> 229 unset_waitlist ();
> 230 WAIT_RETURN (status);
> 231 }
> 232 #endif
>
> So for some reason, wait_for_any_job() returns a negative value in this particular situation.
Line 218 looks also suspicious.
--
Takashi Yano <takashi.yano@nifty.ne.jp>
next prev parent reply other threads:[~2024-03-18 3:09 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-17 8:14 Alexey Izbyshev
2024-03-17 8:44 ` Takashi Yano
2024-03-17 9:01 ` Alexey Izbyshev
2024-03-17 9:27 ` Takashi Yano
2024-03-17 10:03 ` Alexey Izbyshev
2024-03-17 10:21 ` Takashi Yano
2024-03-17 12:03 ` Takashi Yano
2024-03-17 12:15 ` Takashi Yano
2024-03-17 12:35 ` Takashi Yano
2024-03-17 12:50 ` Dimitry Andric
2024-03-17 13:10 ` Dimitry Andric
2024-03-18 3:09 ` Takashi Yano [this message]
2024-03-18 4:58 ` Takashi Yano
2024-03-18 11:08 ` Alexey Izbyshev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240318120906.ccac3ad237a8f6c4c1b94c71@nifty.ne.jp \
--to=takashi.yano@nifty.ne.jp \
--cc=cygwin@cygwin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).