in reply to Re: zcat pipe gives "gzip: stdout: Broken pipe" error
in thread zcat pipe gives "gzip: stdout: Broken pipe" error

Wow, I did not know signal disposition could persist across an exec(). TIL...
  • Comment on Re^2: zcat pipe gives "gzip: stdout: Broken pipe" error

Replies are listed 'Best First'.
Re^3: zcat pipe gives "gzip: stdout: Broken pipe" error
by ikegami (Patriarch) on Mar 26, 2025 at 16:59 UTC

    Linux's https://man7.org/linux/man-pages/man2/execve.2.html says:

    All process attributes are preserved during an execve(), except the following:

    • The dispositions of any signals that are being caught are reset to the default (signal(7)).

    • [...]

    So a caught signal such as $SIG{ PIPE } = \&handler; gets reset to $SIG{ PIPE } = "DEFAULT";, but not $SIG{ PIPE } = "IGNORE";.

    Most if not all reset things are out of necessity. $SIG{ PIPE } = \&handler can't be kept since &handler will stop existing.