This is an automated email from the git hooks/post-receive script.

guillem pushed a commit to branch master
in repository dpkg.

View the commit online:
https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=b287a80263dd4e45bb82b7e6bad76faeb47358d4

commit b287a80263dd4e45bb82b7e6bad76faeb47358d4
Author: Guillem Jover <[email protected]>
AuthorDate: Sat Oct 5 04:28:30 2019 +0200

    Dpkg::Exit: Register exit handlers also for __DIE__
    
    This makes sure we execute the handlers on normal errors, and can thus
    remove the traps from several functions to run the handlers and to then
    rethrow the exception.
---
 debian/changelog               |  1 +
 scripts/Dpkg/Exit.pm           |  2 +-
 scripts/Dpkg/Source/Package.pm | 21 +++++----------------
 3 files changed, 7 insertions(+), 17 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 3bb18cef3..4367a5673 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -73,6 +73,7 @@ dpkg (1.20.0) UNRELEASED; urgency=medium
     - Dpkg::Vendor: Remove obsolete 'keyrings' hook.
     - Dpkg::Exit: Unregister all signal handlers once we have executed them.
       Closes: #932841
+    - Dpkg::Exit: Register exit handlers also for __DIE__.
   * Documentation:
     - man: Fix uncommon wording constructs.
     - man: Use a minus sign for a literal string.
diff --git a/scripts/Dpkg/Exit.pm b/scripts/Dpkg/Exit.pm
index 53c4981cd..70a29b1a6 100644
--- a/scripts/Dpkg/Exit.pm
+++ b/scripts/Dpkg/Exit.pm
@@ -83,7 +83,7 @@ sub _exit_handler {
     exit(127);
 }
 
-my @SIGNAMES = qw(INT HUP QUIT);
+my @SIGNAMES = qw(INT HUP QUIT __DIE__);
 my %SIGOLD;
 
 sub _setup_exit_handlers
diff --git a/scripts/Dpkg/Source/Package.pm b/scripts/Dpkg/Source/Package.pm
index d973c5643..d38e228e5 100644
--- a/scripts/Dpkg/Source/Package.pm
+++ b/scripts/Dpkg/Source/Package.pm
@@ -54,7 +54,6 @@ use Dpkg::Control;
 use Dpkg::Checksums;
 use Dpkg::Version;
 use Dpkg::Compression;
-use Dpkg::Exit qw(run_exit_handlers);
 use Dpkg::Path qw(check_files_are_the_same find_command);
 use Dpkg::IPC;
 use Dpkg::Vendor qw(run_vendor_hook);
@@ -520,11 +519,7 @@ sub extract {
     }
 
     # Try extract
-    eval { $self->do_extract($newdirectory) };
-    if ($@) {
-        run_exit_handlers();
-        die $@;
-    }
+    $self->do_extract($newdirectory);
 
     # Store format if non-standard so that next build keeps the same format
     if ($self->{fields}{'Format'} and
@@ -569,11 +564,8 @@ sub before_build {
 
 sub build {
     my $self = shift;
-    eval { $self->do_build(@_) };
-    if ($@) {
-        run_exit_handlers();
-        die $@;
-    }
+
+    $self->do_build(@_);
 }
 
 sub after_build {
@@ -603,11 +595,8 @@ sub add_file {
 
 sub commit {
     my $self = shift;
-    eval { $self->do_commit(@_) };
-    if ($@) {
-        run_exit_handlers();
-        die $@;
-    }
+
+    $self->do_commit(@_);
 }
 
 sub do_commit {

-- 
Dpkg.Org's dpkg

Reply via email to