summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiels Thykier <niels@thykier.net>2019-02-09 10:44:22 +0000
committerNiels Thykier <niels@thykier.net>2019-02-09 10:44:22 +0000
commit7d4f23e73f377606db49e3ceda4e2ece370fa679 (patch)
tree7da5f8f4c6ca39f8cec8dd9c8c6bb578e81205ba
parent93b498029886e50d0e04dab81375365659c5411e (diff)
downloaddebhelper-7d4f23e73f377606db49e3ceda4e2ece370fa679.tar.gz
filedoublearray: Strip whitespace and detect whitespace-only lines
Signed-off-by: Niels Thykier <niels@thykier.net>
-rw-r--r--debian/changelog8
-rw-r--r--lib/Debian/Debhelper/Dh_Lib.pm12
2 files changed, 18 insertions, 2 deletions
diff --git a/debian/changelog b/debian/changelog
index d7bbe0d9..2db581eb 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -7,6 +7,14 @@ debhelper (12.1) UNRELEASED; urgency=medium
* dh_strip: Print a warning when an ELF binary does not have a
build-id (or when dh_strip cannot find it).
+ [ Niels Thykier ]
+ * Dh_Lib.pm: Strip leading and trailing whitespace from lines in
+ regular debhelper config files. Whitespace-only lines from
+ executable config files are now explicitly detected and triggers
+ a human readable error message early rather than warnings/errors
+ about uninitialized variables. Thanks to Ben Finney for the
+ suggestion and the initial patch. (Closes: #919853)
+
-- Niels Thykier <niels@thykier.net> Fri, 04 Jan 2019 18:27:58 +0100
debhelper (12) unstable; urgency=medium
diff --git a/lib/Debian/Debhelper/Dh_Lib.pm b/lib/Debian/Debhelper/Dh_Lib.pm
index 482e758e..f78f3248 100644
--- a/lib/Debian/Debhelper/Dh_Lib.pm
+++ b/lib/Debian/Debhelper/Dh_Lib.pm
@@ -1387,9 +1387,17 @@ sub filedoublearray {
my @ret;
while (<DH_FARRAY_IN>) {
chomp;
- if (not $x) {
- next if /^#/ || /^$/;
+ if ($x) {
+ if (m/^\s++$/) {
+ error("Executable config file $file produced a non-empty whitespace-only line");
+ }
+ } else {
+ s/^\s++//;
+ next if /^#/;
+ s/\s++$//;
}
+ # We always ignore/permit empty lines
+ next if $_ eq '';
my @line;
if (defined($globdir) && ! $x) {