delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2024/03/17/09:11:23

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B637E3858404
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1710681081;
bh=6Nyh1jqPYGxpCxvGimespfm8sZ9rYrFo9qhXJu6G8qc=;
h=Subject:In-Reply-To:Date:Cc:References:To:List-Id:
List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe:
From:Reply-To:From;
b=J2gNCRuU2EdQUVoB4so/b+Nmnx/pNfiNd+uggHRQoB3ZCmiFefiOtUVTUrnJhYhPw
gKb9VkPArAURb8dbEDHtjx7/0flPufRy2PgFIeep5J1WeJD8ua4/FqdpKh6G3rwq24
znRr6iQaFIJ43Xg1pEo0bn68fzl/iz69sQZ3fus4=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 633983858D37
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 633983858D37
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710681059; cv=none;
b=TU/BJ9HGSABRYCtjYCJD1GFPpK0o4XG4kApIYtivH5mMiJDdXMKD9lRW1qIE/8vRFeVZcWGbLfZN2gPHg6ZmMzk51A4Aw7Qzk1VK77zc+pgcxWAnT2bHtsu842qHwkTIpzW2bodPI94IZFITtFvrkeE3rd2fIzpJaQV/nzBq4Lk=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
t=1710681059; c=relaxed/simple;
bh=SqgxVi/Arnbi21OYKt0ORtVPkhqYpLnnqFsRHjN04Cw=;
h=DKIM-Signature:Mime-Version:Subject:From:Date:Message-Id:To;
b=Ry66j6kIhYxaJTsK1Y1wdEY7Wjkz2vVyUx5ruFbEESYePVJI3V6liyCKwXQ8PLez6kAR3DWUAPck+cjiGiD1fH+792eZONIDzkvmHx5gbbeIemajc+ZObnI3Bv+LHI1Mc0LrTPoEoDHoNiCqNtwgQThSccXpXnPr0KhTrP4Xqs4=
ARC-Authentication-Results: i=1; server2.sourceware.org
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1710681056; x=1711285856;
h=to:references:message-id:content-transfer-encoding:cc:date
:in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=MCkmFpzpEnhpPZ65V1s6QmzZCcA7/Dle0Smfwev+emk=;
b=l6CDLtht5cPjYgSyLt8Dm8jNOvSxX5UesfAUPgTETwtkHBf47DtFagW95jhLPluLx1
JDWVXxA3joK8G7wxsqVum5ULObb7sOcSfN59NUaBl52/zlmQmfewJodJO+DMjA0GA470
hX4E9LUOFQvVBBHhb6DqKEs6phX49u6AiqnNDqXb2Mw2NGfK6Q/ScfWaQfJr+C1UlzuL
RqiiYuDUJa0EBQEzkadhRibYnTsZQ6T7ozQf8b7urIQIcQZKEefA0QbA8Bd9VFUIje5T
WmNf1gMq6wD4KHAnwqGyddMcKiPfTiwypPRqEYaA15j5mePj3abuvdXTUnUPd82oqy72
t1Tw==
X-Gm-Message-State: AOJu0Yzu/6UhtBVvBTS9pH/aR0nczyfOe45j3YuJsVDMmdJf2Em3Kt94
3SYfZS1JHVvNGlDhPyaXHcye9u0UckuO/ucKZiw4WvpmHS44UxNOaXbQnRZfp8wTsu0f84rfSJp
p
X-Google-Smtp-Source: AGHT+IF5In/itXAfNUsL93TKQUjx+lz7uGo5tYDemjlZoIJAV1rZrLZ5j+ADtfj97zj+bng5rN+zQw==
X-Received: by 2002:a17:907:86a5:b0:a46:967b:7c94 with SMTP id
qa37-20020a17090786a500b00a46967b7c94mr4550683ejc.18.1710681056059;
Sun, 17 Mar 2024 06:10:56 -0700 (PDT)
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.700.6.1.1\))
Subject: Re: Bogus exit code 127 from a child process
In-Reply-To: <8F45EC6F-A035-449B-89D0-065FAE3FC157@unified-streaming.com>
Date: Sun, 17 Mar 2024 14:10:55 +0100
Cc: cygwin AT cygwin DOT com
Message-Id: <259F0ECF-9AE8-42E7-A746-8227F8B7870C@unified-streaming.com>
References: <d5c90ec69060cea65c9eb31492a655ac AT ispras DOT ru>
<20240317174402 DOT 4a3e73a7fca2f5978ac93913 AT nifty DOT ne DOT jp>
<61d4fca73047915567fc9b4aac2860a3 AT ispras DOT ru>
<20240317182757 DOT 84b41a596c344f395c1d8f9a AT nifty DOT ne DOT jp>
<c587acce90e624992471b392c1f0e171 AT ispras DOT ru>
<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>
To: Takashi Yano <takashi DOT yano AT nifty DOT ne DOT jp>
X-Mailer: Apple Mail (2.3731.700.6.1.1)
X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00, DKIM_SIGNED,
DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, JMQ_SPF_NEUTRAL, RCVD_IN_DNSWL_NONE,
SPF_HELO_NONE, SPF_PASS, TXREP,
T_SCC_BODY_TEXT_LINE autolearn=no 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
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Dimitry Andric via Cygwin <cygwin AT cygwin DOT com>
Reply-To: Dimitry Andric <dimitry AT unified-streaming DOT com>
Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com>

On 17 Mar 2024, at 13:50, Dimitry Andric <dimitry AT unified-streaming DOT com> wrote:
> 
> On 17 Mar 2024, at 13:35, Takashi Yano via Cygwin <cygwin AT cygwin DOT 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.

-Dimitry


-- 
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

- Raw text -


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