[SCM] Debian package checker branch, master, updated. 2.2.13-10-g6729c73
The following commit has been merged in the master branch:
commit 6729c7349b9777dcd59635e174f9e52c5b6a50ca
Author: Russ Allbery <rra@debian.org>
Date: Fri Jul 24 20:33:52 2009 -0700
Fix parsing of dpkg-divert commands with files ending in numbers
* checks/scripts:
+ [RA] Fix parsing of dpkg-divert commands diverting a file ending in
a number, followed by a redirection. Thanks, Andreas Beckmann.
(Closes: #534942)
diff --git a/checks/scripts b/checks/scripts
index 7fed856..2c513ad 100644
--- a/checks/scripts
+++ b/checks/scripts
@@ -888,19 +888,18 @@ while (<SCRIPTS>) {
} else {
my $mode = /--remove/ ? 'remove' : 'add';
my ($divert) = /dpkg-divert\s*(.*)$/;
- $divert =~ s/\s*--(?:add|quiet|remove|rename|test|(:?admindir|divert|package)\s+\S+)//g;
- $divert =~ s/\s+//g;
+ $divert =~ s/\s*--(?:add|quiet|remove|rename|test|(:?admindir|divert|package)\s+\S+)\s*//g;
# Remove unpaired opening or closing parenthesis
- while($divert =~ m/\G.*?\(.+?\)/gc) {}
+ 1 while($divert =~ m/\G.*?\(.+?\)/gc);
$divert =~ s/\G(.*?)[()]/$1/;
pos($divert) = undef;
# Remove unpaired opening or closing braces
- while($divert =~ m/\G.*?{.+?}/gc) {}
+ 1 while($divert =~ m/\G.*?{.+?}/gc);
$divert =~ s/\G(.*?)[{}]/$1/;
pos($divert) = undef;
# position after the last pair of quotation marks, if any
- while($divert =~ m/\G.*?("|').+?\1/gc) {} #"
+ 1 while($divert =~ m/\G.*?(\"|\').+?\1/gc);
# Strip anything matching and after '&&', '||', ';', or '>'
# this is safe only after we are positioned after the last pair
# of quotation marks
@@ -909,10 +908,14 @@ while (<SCRIPTS>) {
# Remove quotation marks, they affect:
# * our var to regex trick
# * stripping the initial slash if the path was quoted
- $divert =~ s/["']//g; #"
+ $divert =~ s/[\"\']//g;
# remove the leading / because it's not in the index hash
$divert =~ s,^/,,;
+ # remove any remaining leading or trailing whitespace.
+ $divert =~ s/^\s+//;
+ $divert =~ s/\s+$//;
+
$divert = quotemeta($divert);
# For now just replace variables, they will later be normalised
diff --git a/debian/changelog b/debian/changelog
index cf850a2..0efe818 100755
--- a/debian/changelog
+++ b/debian/changelog
@@ -17,6 +17,10 @@ lintian (2.2.14) unstable; urgency=low
* checks/patch-systems{,.desc}:
+ [RA] Check for a patch system in use but no debian/README.source.
Based on a patch from Jonathan Yu. (Closes: #537969)
+ * checks/scripts:
+ + [RA] Fix parsing of dpkg-divert commands diverting a file ending in
+ a number, followed by a redirection. Thanks, Andreas Beckmann.
+ (Closes: #534942)
* lib/Spelling.pm:
+ [RA] Add spelling correction for precedence.
diff --git a/t/tests/scripts-diversions/debian/debian/install b/t/tests/scripts-diversions/debian/debian/install
index d9ecc9c..a38bd53 100644
--- a/t/tests/scripts-diversions/debian/debian/install
+++ b/t/tests/scripts-diversions/debian/debian/install
@@ -1,2 +1,3 @@
orphan usr/share/scripts
some-file usr/share/scripts
+file.1 /usr/share/scripts
diff --git a/t/tests/scripts-diversions/debian/debian/postrm b/t/tests/scripts-diversions/debian/debian/postrm
index d34360a..b965f3e 100644
--- a/t/tests/scripts-diversions/debian/debian/postrm
+++ b/t/tests/scripts-diversions/debian/debian/postrm
@@ -15,6 +15,11 @@ if [ remove = "$1" ]; then
dpkg-divert --remove --package scripts-diversions --rename \
--divert /usr/share/scripts/no-such-file.real \
/usr/share/scripts/no-such-file
+
+ # Regression test for diversions ending in numbers (Bug#534942)
+ dpkg-divert --remove --package scripts-diversions \
+ --divert /usr/share/scripts/file.1.real \
+ /usr/share/scripts/file.1 > /dev/null
fi
#DEBHELPER#
diff --git a/t/tests/scripts-diversions/debian/debian/preinst b/t/tests/scripts-diversions/debian/debian/preinst
index 9bc2f71..c980aef 100644
--- a/t/tests/scripts-diversions/debian/debian/preinst
+++ b/t/tests/scripts-diversions/debian/debian/preinst
@@ -30,6 +30,11 @@ if [ install = "$1" ]; then
dpkg-divert --add --package scripts-diversions --rename \
--divert /usr/share/scripts/no-such-file.real \
/usr/share/scripts/no-such-file
+
+ # Regression test for diversions ending in numbers (Bug#534942)
+ dpkg-divert --add --rename --package scripts-diversions \
+ --divert /usr/share/scripts/file.1.real \
+ /usr/share/scripts/file.1 > /dev/null
fi
# This isn't a diversion we create anywhere, but we're allowed to do this in
diff --git a/t/tests/scripts-diversions/debian/file.1 b/t/tests/scripts-diversions/debian/file.1
new file mode 100644
index 0000000..a58ae6c
--- /dev/null
+++ b/t/tests/scripts-diversions/debian/file.1
@@ -0,0 +1 @@
+Some file ending in a number.
--
Debian package checker
Reply to: