On Tue, Mar 23, 2010 at 7:46 PM, Eric Blake <ebl...@redhat.com> wrote:
> On 03/23/2010 01:29 AM, Siddhesh Poyarekar wrote:
>> Steps to Reproduce:
>> 1. trap '' SIGINT
>> 2. exec bash
>> 3. trap -p
>
> POSIX states:
>
> "Signals that were ignored on entry to a non-interactive shell cannot be
> trapped or reset, although no error need be reported when attempting to
> do so. An interactive shell may reset or catch signals ignored on entry."
> http://www.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#trap
>
> I see no bug - bash is within its rights to pretend that an inherited
> ignored SIGINT has no trap setting, seeing as how the user cannot modify
> that through any use of trap.  That is, 'trap -p' is designed to output
> the text that will restore traps to their normal state, but since there
> is no way to change the state of SIGINT from being ignored, there is
> nothing needed in the output.
>

Thanks for that explanation. I guess we can also detect if a signal is
being ignored by trying to set a trap for that signal and verify that
it has not been set. This was my original problem and I went about
trying to fix it in code rather than reading the docs carefully :)

-- 
Siddhesh Poyarekar
http://siddhesh.in


Reply via email to