From ae4dea507387c90a796e2a752a717f8bc5ed1dae Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 17 May 2015 14:13:25 +0100 Subject: [PATCH] Infra: Exit statuses: work around bizarre behaviour of perl die wrt $?, and de-reserve policy hook status flag 0x80 --- Debian/Dgit.pm | 4 ++-- infra/dgit-repos-policy-debian | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Debian/Dgit.pm b/Debian/Dgit.pm index 3f2988e4..e8d2608a 100644 --- a/Debian/Dgit.pm +++ b/Debian/Dgit.pm @@ -36,10 +36,10 @@ our $branchprefix = 'dgit'; # policy hook exit status bits # see dgit-repos-server head comment for documentation -# 1 is reserved in case something fails with `exit 1' +# 1 is reserved in case something fails with `exit 1' and to spot +# dynamic loader, runtime, etc., failures, which report 127 or 255 sub NOFFCHECK () { return 0x2; } sub FRESHREPO () { return 0x4; } -# 0x80 is reserved sub debiantag ($) { my ($v) = @_; diff --git a/infra/dgit-repos-policy-debian b/infra/dgit-repos-policy-debian index 6e0f0dc3..06ad0022 100755 --- a/infra/dgit-repos-policy-debian +++ b/infra/dgit-repos-policy-debian @@ -17,6 +17,8 @@ use Debian::Dgit::Policy::Debian; initdebug('%'); enabledebuglevel $ENV{'DGIT_DRS_DEBUG'}; +END { $? = 127; } # deliberate exit uses _exit + our $distro = shift @ARGV // die "need DISTRO"; our $repos = shift @ARGV // die "need DGIT-REPOS-DIR"; our $dgitlive = shift @ARGV // die "need DGIT-LIVE-DIR"; @@ -434,7 +436,7 @@ if (!$fn) { } my $sleepy=0; -our $rcode = 127; +my $rcode; for (;;) { poldb_setup(poldb_path($repos)); @@ -453,5 +455,6 @@ for (;;) { $poldbh->rollback; } -print STDERR $stderr; -exit $rcode; +print STDERR $stderr or die $!; +flush STDERR or die $!; +_exit $rcode; -- 2.30.2