summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiels Thykier <niels@thykier.net>2019-08-18 07:24:08 +0000
committerNiels Thykier <niels@thykier.net>2019-08-18 07:27:49 +0000
commit77b205c763e937226a4e41365ed1f25b05297b16 (patch)
tree707c8f1a38da989c40df076888704af00e80b613
parentba39d1934622f4ef97d8aec8d42deda260d1096c (diff)
downloaddebhelper-77b205c763e937226a4e41365ed1f25b05297b16.tar.gz
dh: Fix regression in dh addon API
Previously, dh's API functions were sloppy in their return values but *often* they would return a truth value. We changed that in 12.5 by insisting on return undef. However, that broke addons relying on the API function to work around Perl's idiom of "module must end with a truth value". To resolve that, we now always return a truth value from all API functions to fix that. This also give consistent behaviour, which is better than the previous setup. Signed-off-by: Niels Thykier <niels@thykier.net>
-rw-r--r--debian/changelog3
-rwxr-xr-xdh17
2 files changed, 12 insertions, 8 deletions
diff --git a/debian/changelog b/debian/changelog
index 589d861b..ec806159 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,9 @@ debhelper (12.5.2) UNRELEASED; urgency=medium
* dh_makeshlibs: Fix regression in compat 10 and earlier where
dh_makeshlibs now failed on error. This safety check was
intended to be a compat 11 or later feature.
+ * dh: Ensure addon API functions return 1 to avoid gratious
+ breakage of addons due to perl's idiosyncrasy of requiring a
+ truth value at the end of modules. (See #935016)
-- Niels Thykier <niels@thykier.net> Sun, 18 Aug 2019 07:18:04 +0000
diff --git a/dh b/dh
index b55cbbd2..79d48ca3 100755
--- a/dh
+++ b/dh
@@ -553,12 +553,13 @@ sub _insert {
for my $seq (@affected_sequences) {
$seq->_insert($offset, $existing, _seq_cmd($new));
}
+ return 1;
}
sub insert_before {
- _insert(-1, @_);
+ return _insert(-1, @_);
}
sub insert_after {
- _insert(1, @_);
+ return _insert(1, @_);
}
sub remove_command {
my ($command) = @_;
@@ -566,11 +567,11 @@ sub remove_command {
_assert_not_conditional_sequence_addon('remove_command');
my @affected_sequences = _sequences_containing_cmd($command);
@affected_sequences = _filter_sequences_for_conditional_add_ons(@affected_sequences);
- return if not @affected_sequences;
+ return 1 if not @affected_sequences;
for my $seq (@affected_sequences) {
$seq->remove_command($command);
}
- return;
+ return 1;
}
sub add_command {
my ($command, $sequence) = @_;
@@ -583,7 +584,7 @@ sub add_command {
_filter_sequences_for_conditional_add_ons($seq);
$seq->add_command_at_start(_seq_cmd($command))
}
- return;
+ return 1;
}
sub add_command_at_end {
my ($command, $sequence) = @_;
@@ -596,7 +597,7 @@ sub add_command_at_end {
_filter_sequences_for_conditional_add_ons($seq);
$seq->add_command_at_end(_seq_cmd($command))
}
- return;
+ return 1;
}
sub add_command_options {
@@ -605,7 +606,7 @@ sub add_command_options {
# and that implies smarter deduplication logic)
_assert_not_conditional_sequence_addon('add_command_options');
push @{$command_opts{$command}}, @_;
- return;
+ return 1;
}
sub remove_command_options {
@@ -626,7 +627,7 @@ sub remove_command_options {
# Clear all additional options
delete $command_opts{$command};
}
- return;
+ return 1;
}
sub list_addons {