Path: csiph.com!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail From: Steffen Nurpmeso Newsgroups: gnu.bash.bug Subject: Re: Async processes started in functions not reliably started Date: Wed, 07 Aug 2019 21:34:02 +0200 Lines: 52 Approved: bug-bash@gnu.org Message-ID: References: <20190805120543.Bf9-U%steffen@sdaoden.eu> <20190803224008.dVNLU%steffen@sdaoden.eu> <20190803231715.YFelC%steffen@sdaoden.eu> <26245.1565045376@jinx.noi.kre.to> <20190806142527.9HS0i%steffen@sdaoden.eu> <20190807193402.d1ZQM%steffen@sdaoden.eu> NNTP-Posting-Host: lists.gnu.org X-Trace: usenet.stanford.edu 1565206449 22143 209.51.188.17 (7 Aug 2019 19:34:09 GMT) X-Complaints-To: action@cs.stanford.edu Cc: bug-bash@gnu.org, Steffen Nurpmeso To: Robert Elz Envelope-to: bug-bash@gnu.org In-Reply-To: <20190806142527.9HS0i%steffen@sdaoden.eu> Mail-Followup-To: Robert Elz , bug-bash@gnu.org, Steffen Nurpmeso User-Agent: s-nail v14.9.14-9-g0a0ff75e OpenPGP: id=EE19E1C1F2F7054F8D3954D8308964B51883A0DD; url=https://ftp.sdaoden.eu/steffen.asc; preference=signencrypt BlahBlahBlah: Any stupid boy can crush a beetle. But all the professors in the world can make no bugs. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 217.144.132.164 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: <20190807193402.d1ZQM%steffen@sdaoden.eu> X-Mailman-Original-References: <20190805120543.Bf9-U%steffen@sdaoden.eu> <20190803224008.dVNLU%steffen@sdaoden.eu> <20190803231715.YFelC%steffen@sdaoden.eu> <26245.1565045376@jinx.noi.kre.to> <20190806142527.9HS0i%steffen@sdaoden.eu> Xref: csiph.com gnu.bash.bug:15308 Hello. Steffen Nurpmeso wrote in <20190806142527.9HS0i%steffen@sdaoden.eu>: |Robert Elz wrote in <26245.1565045376@jinx.noi.kre.to>: || Date: Mon, 05 Aug 2019 14:05:43 +0200 || From: Steffen Nurpmeso || Message-ID: <20190805120543.Bf9-U%steffen@sdaoden.eu> .. ||The shell cannot really know - your example was not functional until ||after it set up the traps. .. ||In the parent: || || OK=false || T=$(trap -p USR2) # only needed if USR2 might be trapped \ || already || trap 'OK=true' USR2 ... ||In the child: || || trap 'whatever' SIG_I_NEED || # any other init that is needed || || kill -s USR2 $$ # or if the parent pid is not $$, use whatever is. ... ||No temp files, named pipes, or othe similar stateful mechanisms needed. Sorry for all that noise once again, but i have then rewritten it using mkfifo etc. with credits for some of you (which collects things i have seen flying by since Saturday night): They also came up with the solution: do not wait(1) on child processes until we know about their state, so that anytime before we actually do wait(1) we can safely kill(1) them (Jilles Tjoelker). Thus, let's create a FIFO (Chet Ramey) to get a synchronized device, strip the wild test undertaker to a core that only writes "timeout" to that FIFO, and also improve its startup-is-completed to simply send a signal to the parent process (Robert Elz). So either the tests finish nicely, in which case they write their job number to the fifo, or we see "timeout" and kill all remains. There is still a minimal race which would falsely report tests as failures, but should do no other harm. Thanks. --steffen | |Der Kragenbaer, The moon bear, |der holt sich munter he cheerfully and one by one |einen nach dem anderen runter wa.ks himself off |(By Robert Gernhardt)