bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] trap -p does not display ignored signals inherited from pare


From: Eric Blake
Subject: Re: [PATCH] trap -p does not display ignored signals inherited from parent by a bash process
Date: Thu, 25 Mar 2010 08:43:45 -0600
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100301 Fedora/3.0.3-1.fc12 Lightning/1.0b1 Thunderbird/3.0.3

On 03/25/2010 08:39 AM, Siddhesh Poyarekar wrote:
> On Thu, Mar 25, 2010 at 7:19 PM, Eric Blake <eblake@redhat.com> wrote:
>> Technically, this is only a POSIX requirement on non-interactive shells.
>>  Interactive shells may reset ignored signals on entry, effectively
>> starting life as if nothing had been inherited ignored.  But I don't
>> know (without looking at the sources) whether bash explicitly modifies
>> inherited ignored signals in interactive shells.
> 
> Bash does not do it; ignored signals remain ignored in the subshell. I
> wanted to know if it would be possible to explicitly document it in
> the manpage or provide a non-standard extension to display signals
> that are 'not available to play with'.

Subshells are different than new shells on what POSIX requires for
signal manipulations.  Again, quoting POSIX:

"When a subshell is entered, traps that are not being ignored are set to
the default actions. This does not imply that the trap command cannot be
used within the subshell to set new traps."

That is, if a non-interactive parent inherited a signal ignored, then
neither the parent nor the subshell can change it.  But if a
non-interactive parent inherits a default signal, then explicitly
ignores it, then subshells will inherit it ignored but can still reset
it back to default.

-- 
Eric Blake   eblake@redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]