calling sigprocmask from bash

There doesn't seem to be a pure bash solution.

Ksh (both ksh93 and mksh) unblock all signals (tested on Debian wheezy), so if you can use ksh instead of bash, it will solve your problem.

If you can't change the fact that bash is invoked, you might be able to make bash execute ksh and make ksh execute the child process: replace

bash -c '…; exec child_process'

by

bash -c '…; exec ksh -c "exec child_process"'

Beware of quoting issues!

Ksh is fast and easy to use, but often not part of the default installation. If that is an issue, you can use Perl instead, which is part of the default installation in most non-embedded Linux systems.

perl -e '
    use POSIX;
    $s = POSIX::SigSet->new(); $s->fillset();
    sigprocmask(1, $s, $s) or die $!;    # 1 = SIG_UNBLOCK
    exec "child_process"'

Tags:

Bash

Signals