Module Name: src Committed By: martin Date: Mon Feb 10 18:54:14 UTC 2020
Modified Files: src/bin/sh [netbsd-9]: jobs.c main.c Log Message: Pull up following revision(s) (requested by kre in ticket #684): bin/sh/jobs.c: revision 1.107 bin/sh/main.c: revision 1.83 bin/sh/main.c: revision 1.84 bin/sh/main.c: revision 1.85 If we are invoked with SIGCHLD ignored, we fail badly, as we assume that we can always wait(2) for our children, and an ignored SIGCHLD prevents that. Recent versions of bash can be convinced (due to a bug most likely) to invoke us that way. Always return SIGCHLD to SIG_DFL during init - we already prevent scripts from fiddling it. All ash derived shells apparently have this problem (observed by Martijn Dekker, and notified on the bash-bug list). Actual issue diagnosed by Harald van Dijk (same list). Actually, the issue with bash (in previous) is more likely that the SIGCHLD is blocked rather than ignored. We want neither. Make sure SIGCHLD is unblocked as well as SIG_DFL. XXX pullup -9 bin/sh: Fixes -Werror=shadow causing build breaks. Conflicting variable name, sigset_t sigs has been renamed to sigset_t mask Reviewed by: kamil@ Avoid a core dump if a child process that is not one of our children happens to exit while we are waiting for another child to exit. This can happen with code like sh -c ' sleep 5 & exec sh -c "sleep 10 & wait !$" ' when the inner "sh" is waiting for the 10 second sleep to be done, the 5 second sleep started earlier terminates. It is a child of our process, as the inner shell is the same process as the outer one, but not a known child (the inner shell has no idea what the outer one did before it started). This was observed in the wild by Martijn Dekker (where the outer shell was bash but that's irrelevant). XXX pullup -9 To generate a diff of this commit: cvs rdiff -u -r1.106 -r1.106.2.1 src/bin/sh/jobs.c cvs rdiff -u -r1.82 -r1.82.2.1 src/bin/sh/main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.