On Sat, Apr 10, 2010 at 8:51 AM, Chet Ramey <chet.ra...@case.edu> wrote: > On 3/31/10 1:45 AM, Siddhesh Poyarekar wrote: > >> Bash Version: 4.1 >> Patch Level: 2 >> Release Status: release >> >> Description: >> When output of trap is piped to another command, say, less or >> cat -, it shows only ignored signals. > > As the standard is currently written, this is the correct behavior. > > The standard considers traps in subshells in two places: where it talks > about "subshell environments" and where it describes the behavior of trap. > > The former says only that all commands in a pipeline are run in a subshell > environment, and that in a subshell environment traps "are set to the > default values." The latter says that "when a subshell is entered, traps > that are not being ignored are set to the default actions." This is an > obvious contradiction, and most shells implement the latter. > > Bash and some other shells special-case command substitution, because the > standard includes an example illustrating the use of command substitution > to save and restore traps. This is not univeral -- dash, for instance, > does not do it. >
Thanks, will you consider fixing this or accept a patch to fix this? A fix along the lines of the standards change Eric pointed out ought to work I think. I'm not sure at what point the change becomes effective/enforceable. -- Siddhesh Poyarekar http://siddhesh.in