control: tag 921757 patch Santjago,
can you confirm that the attached patch fixes the problem on your build setup? (If you don't have the time for the test, I'd take you up on your offer for SSH access.) Cheers, -Hilko
>From 03f0e226eff2444aa80b294eb8adeb5661a683ca Mon Sep 17 00:00:00 2001 From: Hilko Bengen <ben...@debian.org> Date: Mon, 25 Feb 2019 09:47:35 +0100 Subject: [PATCH] Eliminate race condition in runcmd --- osutils.pm | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/osutils.pm b/osutils.pm index b06a042b..ec582c66 100644 --- a/osutils.pm +++ b/osutils.pm @@ -93,19 +93,10 @@ sub quote { # Open a process to run external program and check its return status sub runcmd { diag "running " . join(' ', @_); - my ($pid, $status); - - local $SIG{CHLD} = sub { - local ($!, $?); - while ((my $child = waitpid(-1, WNOHANG)) > 0) { - diag "runcmd pid $pid returned $child"; - $status = $?; - } - }; my ($wtr, $rdr, $err); $err = gensym; - $pid = open3($wtr, $rdr, $err, @_); + my $pid = open3($wtr, $rdr, $err, @_); die "couldn't open: $!" unless defined $pid; close($wtr) or die "couldn't close fh: $!"; @@ -125,6 +116,12 @@ sub runcmd { close($rdr) or die "couldn't close fh: $!"; close($err) or die "couldn't close fh: $!"; + my $status; + while ((my $child = waitpid(-1, WNOHANG)) > 0) { + diag "runcmd pid $pid returned $child"; + $status = $?; + } + my $exit_code = $status >> 8; die "runcmd failed with exit code $exit_code" unless ($exit_code == 0); return $exit_code; -- 2.20.1