chiark / gitweb /
dgit: Do not execute END blocks in children.
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 11 Jan 2017 23:31:37 +0000 (23:31 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 12 Jan 2017 00:31:20 +0000 (00:31 +0000)
END blocks run inside children created by fork or piped open (the
latter, if they run perl code), on exit or (I think maybe) die.  This
is far from appropriate.

So far symptoms of this bug seem to be limited to duplicated error
messages but I have not done a thorough analysis.  Closes:#850052.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
debian/changelog
dgit

index 9f7b5fa6ffee63d1de01c8c6d9b7fa9e8463b7f2..8edf5274279ffd8876561409e3b4143e89c789c5 100644 (file)
@@ -1,6 +1,9 @@
 dgit (3.2~) unstable; urgency=medium
 
-  * 
+  Bugfixes:
+  * dgit: Do not execute END blocks in children.  So far symptoms of this
+    bug seem to be limited to duplicated error messages but I have not
+    done a thorough analysis.  Closes:#850052.
 
  --
 
diff --git a/dgit b/dgit
index f7f2b710b9732ae11b82a0b594b17301e56a26ad..afdf2c58ec8d13c7dc54e2444f6abd1b5412b147 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -156,6 +156,7 @@ our $split_brain = 0;
 
 END {
     local ($@, $?);
+    return unless forkcheck_mainprocess();
     print STDERR "! $_\n" foreach $supplementary_message =~ m/^.+$/mg;
 }
 
@@ -220,6 +221,7 @@ initdebug('');
 our @end;
 END { 
     local ($?);
+    return unless forkcheck_mainprocess();
     foreach my $f (@end) {
        eval { $f->(); };
        print STDERR "$us: cleanup: $@" if length $@;
@@ -4473,7 +4475,10 @@ sub i_cleanup {
     }
 }
 
-END { i_cleanup(); }
+END {
+    return unless forkcheck_mainprocess();
+    i_cleanup();
+}
 
 sub i_method {
     my ($base,$selector,@args) = @_;