[SCM] Debian package checker branch, master, updated. 2.5.8-21-gef149d6
The following commit has been merged in the master branch:
commit ef149d60cea4eb693559d2b5f62c7626c1608f18
Author: Niels Thykier <niels@thykier.net>
Date: Fri Jun 15 16:51:56 2012 +0200
checks/init.d: Correct the regex to match package names
Move the regex to match package names from checks/fields to
Lintian::Check and use that regex in checks/init.d.
Signed-off-by: Niels Thykier <niels@thykier.net>
diff --git a/checks/fields b/checks/fields
index 81679c0..8ab3dc8 100644
--- a/checks/fields
+++ b/checks/fields
@@ -30,7 +30,7 @@ use Dpkg::Version qw(version_check);
use Lintian::Architecture qw(:all);
use Lintian::Data ();
-use Lintian::Check qw(check_maintainer);
+use Lintian::Check qw(check_maintainer $PKGNAME_REGEX);
use Lintian::Relation ();
use Lintian::Relation::Version qw(versions_compare);
use Lintian::Tags qw(tag);
@@ -170,7 +170,7 @@ if ($type eq 'binary'){
my $name = $info->field('package');
unfold('package', \$name);
- tag 'bad-package-name' unless $name =~ /^[A-Z0-9][-+\.A-Z0-9]+$/i;
+ tag 'bad-package-name' unless $name =~ /^$PKGNAME_REGEX$/i;
tag 'package-not-lowercase' if ($name =~ /[A-Z]/)
}
}
diff --git a/checks/init.d b/checks/init.d
index d3f29dd..99d6958 100644
--- a/checks/init.d
+++ b/checks/init.d
@@ -22,6 +22,7 @@ package Lintian::init_d;
use strict;
use warnings;
+use Lintian::Check qw($PKGNAME_REGEX);
use Lintian::Tags qw(tag);
use Lintian::Util qw(fail);
@@ -78,7 +79,6 @@ my %initd_postrm;
my %conffiles;
my $opts_r = qr/-\S+\s*/;
-my $name_r = qr/[\w.-]+/;
my $action_r = qr/\w+/;
my $exclude_r = qr/if\s+\[\s+-x\s+\S*update-rc\.d/;
@@ -88,7 +88,7 @@ if (open(IN, '<', $postinst)) {
next if /$exclude_r/o;
s/\#.*$//o;
next unless /^(?:.+;|^\s*system[\s\(\']+)?\s*update-rc\.d\s+
- (?:$opts_r)*($name_r)\s+($action_r)/xo;
+ (?:$opts_r)*($PKGNAME_REGEX)\s+($action_r)/xo;
my ($name,$opt) = ($1,$2);
next if $opt eq 'remove';
if ($initd_postinst{$name}++ == 1) {
@@ -107,7 +107,9 @@ if (open(IN, '<', $preinst)) {
while (<IN>) {
next if /$exclude_r/o;
s/\#.*$//o;
- next unless m/update-rc\.d\s+(?:$opts_r)*($name_r)\s+($action_r)/o;
+ next unless m/update-rc\.d \s+
+ (?:$opts_r)*($PKGNAME_REGEX) \s+
+ ($action_r)/ox;
my ($name,$opt) = ($1,$2);
next if $opt eq 'remove';
tag 'preinst-calls-updaterc.d', $name;
@@ -120,7 +122,7 @@ if (open(IN, '<', $postrm)) {
while (<IN>) {
next if /$exclude_r/o;
s/\#.*$//o;
- next unless m/update-rc\.d\s+($opts_r)*($name_r)/o;
+ next unless m/update-rc\.d\s+($opts_r)*($PKGNAME_REGEX)/o;
if ($initd_postrm{$2}++ == 1) {
tag 'duplicate-updaterc.d-calls-in-postrm', $2;
next;
@@ -137,7 +139,7 @@ if (open(IN, '<', $prerm)) {
while (<IN>) {
next if /$exclude_r/o;
s/\#.*$//o;
- next unless m/update-rc\.d\s+($opts_r)*($name_r)/o;
+ next unless m/update-rc\.d\s+($opts_r)*($PKGNAME_REGEX)/o;
tag 'prerm-calls-updaterc.d', $2;
}
close(IN);
diff --git a/debian/changelog b/debian/changelog
index f8325b4..30d79c0 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -16,6 +16,10 @@ lintian (2.5.9) UNRELEASED; urgency=low
+ [NT] Rename run-parts-cron-filename-contains-full-stop and
have it catch "+" in the filename as well. Add reference
to policy 9.5.1 in the tag description.
+ * checks/init.d:
+ + [NT] Use the proper regex for matching package names rather
+ than an ad-hoc regex. Thanks to Thorsten Alteholz for the
+ report and suggested patch. (Closes: #677142)
* checks/shared-libs:
+ [NT] Reverse order of two subst expressions to prevent
dev-pkg-without-shlib-symlink false positives. Thanks to
@@ -55,6 +59,8 @@ lintian (2.5.9) UNRELEASED; urgency=low
no packages are given and debian/changelog exists. Thanks
to Gilles Filippini for the suggestion. (Closes: #676799)
+ * lib/Lintian/Check.pm:
+ + [NT] Add regex to match valid package names.
* lib/Lintian/Collect/Package.pm:
+ [NT] sorted_index now returns a list rather than a list ref.
+ [NT] Represent files (from index) as Lintian::Path objects.
diff --git a/lib/Lintian/Check.pm b/lib/Lintian/Check.pm
index 5fd3785..7a04859 100644
--- a/lib/Lintian/Check.pm
+++ b/lib/Lintian/Check.pm
@@ -31,7 +31,10 @@ use Lintian::Tags qw(tag);
our $KNOWN_BOUNCE_ADDRESSES = Lintian::Data->new('fields/bounce-addresses');
our @ISA = qw(Exporter);
-our @EXPORT = qw(check_maintainer check_spelling check_spelling_picky $known_shells_regex);
+our @EXPORT = qw(check_maintainer check_spelling check_spelling_picky $known_shells_regex
+ $PKGNAME_REGEX
+);
+
=head1 NAME
@@ -336,12 +339,21 @@ sub check_spelling_picky {
=item $known_shells_regex
-Regular expression that maches names of any known shell.
+Regular expression that matches names of any known shell.
=cut
our $known_shells_regex = qr'(?:[bd]?a|t?c|(?:pd|m)?k|z)?sh';
+=item $PKGNAME_REGEX
+
+Regular expressions that matches valid package names. The regression is
+not anchored and does not enforce any "boundry" characters.
+
+=cut
+
+our $PKGNAME_REGEX = qr/[a-z0-9][-+\.a-z0-9]+/o;
+
=back
=head1 AUTHOR
--
Debian package checker
Reply to: