diff options
author | Niels Thykier <niels@thykier.net> | 2019-08-18 07:24:08 +0000 |
---|---|---|
committer | Niels Thykier <niels@thykier.net> | 2019-08-18 07:27:49 +0000 |
commit | 77b205c763e937226a4e41365ed1f25b05297b16 (patch) | |
tree | 707c8f1a38da989c40df076888704af00e80b613 | |
parent | ba39d1934622f4ef97d8aec8d42deda260d1096c (diff) | |
download | debhelper-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/changelog | 3 | ||||
-rwxr-xr-x | dh | 17 |
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 @@ -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 { |