diff options
author | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2015-07-25 16:30:09 +0100 |
---|---|---|
committer | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2015-07-25 17:56:42 +0100 |
commit | d6be829bf56e699d27d388026d4af7ab710ba328 (patch) | |
tree | a4eb3ec080271e145d99200a43a3f5d3271e41bc | |
parent | 9141753fb5096b41074684d5bdfbb0c6f69a0c1a (diff) |
Work around #793471 (madness with $SIG{__WARN__} and Perl's system builtin): move $SIG{} setting into setup_sigwarn in Dgit.pm, and check getppid.
We also need to fix up the expectation for an error message in one of
the tests, where the message changes as a side effect.
-rw-r--r-- | Debian/Dgit.pm | 10 | ||||
-rw-r--r-- | debian/changelog | 3 | ||||
-rwxr-xr-x | dgit | 4 | ||||
-rwxr-xr-x | infra/dgit-repos-policy-debian | 5 | ||||
-rwxr-xr-x | infra/dgit-repos-server | 6 | ||||
-rwxr-xr-x | tests/tests/trustingpolicy-replay | 2 |
6 files changed, 22 insertions, 8 deletions
diff --git a/Debian/Dgit.pm b/Debian/Dgit.pm index edb338c..d66b712 100644 --- a/Debian/Dgit.pm +++ b/Debian/Dgit.pm @@ -15,7 +15,8 @@ BEGIN { $VERSION = 1.00; @ISA = qw(Exporter); - @EXPORT = qw(debiantag server_branch server_ref + @EXPORT = qw(setup_sigwarn + debiantag server_branch server_ref stat_exists fail ensuredir waitstatusmsg failedcmd cmdoutput cmdoutput_errok git_rev_parse git_get_ref git_for_each_ref @@ -48,6 +49,13 @@ sub FRESHREPO () { return 0x4; } our $debugprefix; our $debuglevel = 0; +sub setup_sigwarn () { + our $sigwarn_mainprocess = $$; + $SIG{__WARN__} = sub { + die $_[0] unless getppid == $sigwarn_mainprocess; + }; +} + sub initdebug ($) { ($debugprefix) = @_; open DEBUG, ">/dev/null" or die $!; diff --git a/debian/changelog b/debian/changelog index 4a0765a..2e6e744 100644 --- a/debian/changelog +++ b/debian/changelog @@ -25,6 +25,9 @@ dgit (1.1) unstable; urgency=low packages (!) * --new is needed for read access to packages in NEW, too. Document this, and make it work properly. + * Work around #793471 (madness with $SIG{__WARN__} and Perl's system + builtin): move $SIG{} setting into setup_sigwarn in Dgit.pm, and + check getppid. -- @@ -18,7 +18,9 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. use strict; -$SIG{__WARN__} = sub { die $_[0]; }; + +use Debian::Dgit; +setup_sigwarn(); use IO::Handle; use Data::Dumper; diff --git a/infra/dgit-repos-policy-debian b/infra/dgit-repos-policy-debian index b6310d9..fbf2d51 100755 --- a/infra/dgit-repos-policy-debian +++ b/infra/dgit-repos-policy-debian @@ -2,7 +2,9 @@ # dgit repos policy hook script for Debian use strict; -$SIG{__WARN__} = sub { die $_[0]; }; + +use Debian::Dgit qw(:DEFAULT :policyflags); +setup_sigwarn(); use POSIX; use JSON; @@ -11,7 +13,6 @@ use DBI; use IPC::Open2; use Data::Dumper; -use Debian::Dgit qw(:DEFAULT :policyflags); use Debian::Dgit::Policy::Debian; initdebug('%'); diff --git a/infra/dgit-repos-server b/infra/dgit-repos-server index 92f197b..9705a64 100755 --- a/infra/dgit-repos-server +++ b/infra/dgit-repos-server @@ -33,7 +33,9 @@ # (With --cron AUTH-SPEC is not used and may be the empty string.) use strict; -$SIG{__WARN__} = sub { die $_[0]; }; + +use Debian::Dgit qw(:DEFAULT :policyflags); +setup_sigwarn(); # DGIT-REPOS-DIR contains: # git tree (or other object) lock (in acquisition order, outer first) @@ -189,8 +191,6 @@ use Fcntl qw(:flock); use File::Path qw(rmtree); use File::Temp qw(tempfile); -use Debian::Dgit qw(:DEFAULT :policyflags); - initdebug(''); our $func; diff --git a/tests/tests/trustingpolicy-replay b/tests/tests/trustingpolicy-replay index b779f64..517f98a 100755 --- a/tests/tests/trustingpolicy-replay +++ b/tests/tests/trustingpolicy-replay @@ -47,7 +47,7 @@ prepare-replay () { t-commit "request with $delib that we will replay" t-dgit build - t-expect-push-fail E:'policy-hook.*No such file or directory' \ + t-expect-push-fail 'system: No such file or directory' \ t-dgit push $delib t-policy dgit-repos-policy-trusting |