From: Robert Elz <kre@munnari.OZ.AU> To: Martijn Dekker <firstname.lastname@example.org> Cc: busybox <email@example.com>, Harald van Dijk <firstname.lastname@example.org>, DASH shell mailing list <email@example.com>, Jilles Tjoelker <firstname.lastname@example.org>, Bug reports for the GNU Bourne Again SHell <email@example.com> Subject: Re: Bizarre interaction bug involving bash w/ lastpipe + Almquist 'wait' Date: Fri, 07 Feb 2020 09:41:27 +0700 [thread overview] Message-ID: <firstname.lastname@example.org> (raw) In-Reply-To: <email@example.com> Date: Thu, 6 Feb 2020 16:12:06 +0000 From: Martijn Dekker <firstname.lastname@example.org> Message-ID: <email@example.com> | NetBSD sh behaves differently. NetBSD 8.1 sh (as installed on sdf.org | and sdf-eu.org) seem to act completely normally, but NetBSD 9.0rc2 sh | (on my VirtualBox test VM) segfaults. Output on NetBSD 9.0rc2: I have updated my opinion on that, I think it is "don't have the bug", though it is possible a blocked SIGCHLD acts differently on NetBSD than on other systems. On NetBSD it seems to affect nothing (the shell does not rely upon receiving SIGCHLD so not getting it is irrelevant) and the wait code when given an arg (as your script did) would always wait until that process exited, and return as soon as it did. None of that is changed in -9 ... but the wait command now has -n, which also works with a list of pids, and while waiting for any process in its list to exit, gets told each time a process is reaped (from lower level code) which job that process was from (new code of mine) so it can see if the process that completed finished one of the jobs for which it is waiting.\ I wasn't expecting to see exiting children that are not the shell's children, which is what happens here - the : | return creates a child (of bash) to run the ':' command, then the function returns without waiting for that one. You then exec the NetBSD shell, which inherits that child (a child of the same process) but is unaware of it. If that one happens to exit while the ash script running on the NetBSD sh is doing the wait command, core would dump. (Fix for that is now in the tree). If the bash invoked ':' command exited some other time and was noticed (eg: between commands) as having finished, it would simply have been ignored. I saw both happen. kre
next prev parent reply other threads:[~2020-02-07 2:41 UTC|newest] Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-02-06 16:12 Martijn Dekker 2020-02-06 19:29 ` Harald van Dijk 2020-02-07 11:19 ` AW: " Walter Harms 2020-02-07 14:33 ` Martijn Dekker 2020-02-07 16:16 ` Chet Ramey 2020-02-06 20:43 ` Robert Elz 2020-02-07 2:41 ` Robert Elz [this message] 2020-02-08 18:39 ` Harald van Dijk 2020-02-09 19:03 ` Jilles Tjoelker 2020-02-18 16:46 ` Denys Vlasenko 2020-02-18 21:59 ` Harald van Dijk 2020-02-18 18:17 ` Robert Elz
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 \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --subject='Re: Bizarre interaction bug involving bash w/ lastpipe + Almquist '\''wait'\''' \ /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
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 NNTP newsgroup(s).