summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Jackson <ijackson@chiark.greenend.org.uk>2016-10-17 17:24:18 +0100
committerIan Jackson <ijackson@chiark.greenend.org.uk>2016-10-17 17:24:20 +0100
commitef933efbf46dce39eafd0a4bda51a180ed0c541e (patch)
treed600d8c3736cc82a77cefeac5693db89a70ec0cc
parent8ff24012c9e4b826cedca7eada4476abf518ccd5 (diff)
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 <ijackson@chiark.greenend.org.uk>
-rw-r--r--debian/changelog3
-rwxr-xr-xdgit25
2 files changed, 27 insertions, 1 deletions
diff --git a/debian/changelog b/debian/changelog
index d8827a4..203a864 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,7 +2,8 @@ dgit (2.2) unstable; urgency=low
* Fix config relating to Debian to actually make split brain mode
work. Closes:#841085.
- *
+ * Detect SIGPIPE (and SIGCHLD) being blocked or ignored.
+ Closes:#841085.
--
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 <<END;
+On entry to dgit, $@
+This is a bug produced by something in in your execution environment.
+Giving up.
+END
+}
+
+
sub finalise_opts_opts () {
foreach my $k (keys %opts_opt_map) {
my $om = $opts_opt_map{$k};
@@ -5257,6 +5281,7 @@ if ($ENV{$fakeeditorenv}) {
}
parseopts();
+check_env_sanity();
git_slurp_config();
print STDERR "DRY RUN ONLY\n" if $dryrun_level > 1;