chiark / gitweb /
Work around #793471 (madness with $SIG{__WARN__} and Perl's system builtin): move...
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 25 Jul 2015 15:30:09 +0000 (16:30 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 25 Jul 2015 16:56:42 +0000 (17:56 +0100)
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.

Debian/Dgit.pm
debian/changelog
dgit
infra/dgit-repos-policy-debian
infra/dgit-repos-server
tests/tests/trustingpolicy-replay

index edb338ca455a3e9f50405a139518292a1f94931a..d66b712bc86af9ba104a88cc0bbac06e375d2370 100644 (file)
@@ -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 $!;
index 4a0765a37c33969ecc1c48673acd1cd47ceff528..2e6e7447bc1666834952118617849ab9fbfe54a2 100644 (file)
@@ -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.
 
  --
 
diff --git a/dgit b/dgit
index 1e389088fd10f7c2d97ae885cae0a8889afdb93a..9dadc8cce98274eb96944e60b01df5d26a491a95 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -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;
index b6310d958d1ee61273f2348181ce7a7cc2056a98..fbf2d516219378ffd2caa86ff294f23c21acca32 100755 (executable)
@@ -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('%');
index 92f197b0b001b31bc5dd11907ab7ab1c1359a00f..9705a6420a628298c5c95857042ed3c74c94d941 100755 (executable)
@@ -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;
index b779f64b129b1c604559f42c92133586693652b3..517f98a08014759fd13b22bb095472e59087cfd1 100755 (executable)
@@ -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