From b8c2b200c3dd0678988593c5839be3cd2aecf84a Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Sun, 22 Nov 2009 22:23:59 +0100 Subject: Dpkg::Control::Hash: Strip leading spaces in the first line of a field's value The fields in a compliant control-style file are allowed to have values starting with any number of spaces. But that only applies to the first line on multi-line field values, so do not do the same on subsequent lines as those are handled differently. Regression introduced in commit 7d8d193332478de82e20ed5b49053378801d160f. Closes: #557547 --- scripts/Dpkg/Control/Hash.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts/Dpkg/Control') diff --git a/scripts/Dpkg/Control/Hash.pm b/scripts/Dpkg/Control/Hash.pm index afb177b7e..06d34d1e1 100644 --- a/scripts/Dpkg/Control/Hash.pm +++ b/scripts/Dpkg/Control/Hash.pm @@ -168,7 +168,7 @@ sub parse_fh { next if (m/^$/ and $paraborder); next if (m/^#/); $paraborder = 0; - if (m/^(\S+?)\s*:\s?(.*)$/) { + if (m/^(\S+?)\s*:\s*(.*)$/) { if (exists $self->{$1}) { unless ($$self->{'allow_duplicate'}) { syntaxerr($desc, sprintf(_g("duplicate field %s found"), $1)); -- cgit v1.2.3 From 77b078af402eb41027227117c7ef223a3941b457 Mon Sep 17 00:00:00 2001 From: Raphaƫl Hertzog Date: Mon, 23 Nov 2009 08:58:29 +0100 Subject: Dpkg::Control::Hash: document how leading/trailing spaces are treated --- scripts/Dpkg/Control/Hash.pm | 3 +++ 1 file changed, 3 insertions(+) (limited to 'scripts/Dpkg/Control') diff --git a/scripts/Dpkg/Control/Hash.pm b/scripts/Dpkg/Control/Hash.pm index 06d34d1e1..75fbc8957 100644 --- a/scripts/Dpkg/Control/Hash.pm +++ b/scripts/Dpkg/Control/Hash.pm @@ -52,6 +52,9 @@ unchanged directly after the field name, supplementary lines are modified. Empty lines and lines containing only dots are prefixed with " ." (space + dot) while other lines are prefixed with a single space. +During parsing, trailing spaces are stripped on all lines while leading +spaces are stripped only on the first line of each field. + =head1 FUNCTIONS =over 4 -- cgit v1.2.3