From ef933efbf46dce39eafd0a4bda51a180ed0c541e Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Mon, 17 Oct 2016 17:24:18 +0100 Subject: Detect SIGPIPE (and SIGCHLD) being blocked or ignored. Closes:#841085. In fact, it seems in my test that Perl resets SIGCHLD itself, printing something to stderr, so that trip does not actually fire. But it makes sense to keep it. Signed-off-by: Ian Jackson --- dgit | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'dgit') diff --git a/dgit b/dgit index 60ab9a6..53f4713 100755 --- a/dgit +++ b/dgit @@ -5222,6 +5222,30 @@ sub parseopts () { } } +sub check_env_sanity () { + my $blocked = new POSIX::SigSet; + sigprocmask SIG_UNBLOCK, $blocked, $blocked or die $!; + + eval { + foreach my $name (qw(PIPE CHLD)) { + my $signame = "SIG$name"; + my $signum = eval "POSIX::$signame" // die; + ($SIG{$name} // 'DEFAULT') eq 'DEFAULT' or + die "$signame is set to something other than SIG_DFL\n"; + $blocked->ismember($signum) and + die "$signame is blocked\n"; + } + }; + return unless $@; + chomp $@; + fail < 1; -- cgit v1.2.3