X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 55F1A3858404 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1710731404; bh=7v1FISf702fjud6CKWw3+I+KPYcWnevaG8tD3D7fFyk=; h=Date:To:Subject:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=vaPvvfDd4U+nIX1avOyZVN8v617MU7W5GhNWQ7tCZaah3fr3p0QBJ3mwMuvpg+FO8 Z0ZQ31JVy6oY+QtwTzbqVgmNN6yCJVQ5bC5ksNULdu5Vki3CJexGms5AOwUsop7uTx 1OMGBl1moBkKmvmA9ss8kLU8Zt0zLLQbCFHoNYKU= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 41CE43858D37 ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 41CE43858D37 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710731354; cv=none; b=A4CtQo/hhrhuAkFvEPAOCwcYAkk+bsKRF5d+JpyK30CIipHQXriSh/QkJyfZ9jFD5zwsz378bRjopK35DevnWidT4KlICdA17vSBqC+8gU9poC0G39c5lETNgw5wSiX/6IXI/M0ZW1xXbtPbdPpmxOv5YnAQOK4hzk/MoaqyCpk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710731354; c=relaxed/simple; bh=/0zW46Zu3IcyjmyPS+knVhSj3v2rDHiR5BFndB80L5c=; h=Date:From:To:Subject:Message-Id:Mime-Version; b=KWRxY8mBrTocUVXDJEM3cIBzBcMKMXoRBC113prdlYJDU8wrdEfHlSYWpj3n84f9g+RG6K8EMTvOr0H/GimhqjugmY+4cg2gCMFWXAkvdqj+veiLeBt0vlnn9gMbeuwwoHNtGaPY0Uppu/OD65KYgv6YlQMKKk3vBA25PNTjsrw= ARC-Authentication-Results: i=1; server2.sourceware.org Date: Mon, 18 Mar 2024 12:09:06 +0900 To: cygwin AT cygwin DOT com Subject: Re: Bogus exit code 127 from a child process Message-Id: <20240318120906.ccac3ad237a8f6c4c1b94c71@nifty.ne.jp> In-Reply-To: <259F0ECF-9AE8-42E7-A746-8227F8B7870C@unified-streaming.com> References: <20240317174402 DOT 4a3e73a7fca2f5978ac93913 AT nifty DOT ne DOT jp> <61d4fca73047915567fc9b4aac2860a3 AT ispras DOT ru> <20240317182757 DOT 84b41a596c344f395c1d8f9a AT nifty DOT ne DOT jp> <20240317192116 DOT b00f24c9ee065f16d6ac6673 AT nifty DOT ne DOT jp> <20240317210358 DOT ad701873dc5cfc9a3026dc0c AT nifty DOT ne DOT jp> <20240317211517 DOT 40cfbe0a664f7c7fe3d6e73d AT nifty DOT ne DOT jp> <20240317213548 DOT 652be777a51f00108414d9bf AT nifty DOT ne DOT jp> <8F45EC6F-A035-449B-89D0-065FAE3FC157 AT unified-streaming DOT com> <259F0ECF-9AE8-42E7-A746-8227F8B7870C AT unified-streaming DOT com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32) Mime-Version: 1.0 X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.30 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Takashi Yano via Cygwin Reply-To: Takashi Yano Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com Sender: "Cygwin" On Sun, 17 Mar 2024 14:10:55 +0100 Dimitry Andric wrote: > On 17 Mar 2024, at 13:50, Dimitry Andric wrote: > > > > On 17 Mar 2024, at 13:35, Takashi Yano via Cygwin 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 -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple