summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillem Jover <guillem@debian.org>2019-10-05 04:28:30 +0200
committerGuillem Jover <guillem@debian.org>2019-11-26 02:42:45 +0100
commitb287a80263dd4e45bb82b7e6bad76faeb47358d4 (patch)
tree0d3cb6c35e722a67561aac5813d7e9338a08d63b
parentddb82d8bfe58e8a25444bdd772f534e0564efb3d (diff)
downloaddpkg-b287a80263dd4e45bb82b7e6bad76faeb47358d4.tar.gz
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.
-rw-r--r--debian/changelog1
-rw-r--r--scripts/Dpkg/Exit.pm2
-rw-r--r--scripts/Dpkg/Source/Package.pm21
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 {