diff options
Diffstat (limited to 'dgit')
-rwxr-xr-x | dgit | 25 |
1 files changed, 25 insertions, 0 deletions
@@ -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; |