[SCM] Debian package checker branch, master, updated. 2.5.11-269-g4fa9095
The following commit has been merged in the master branch:
commit 5e5a915db99d025515fcb4d1c7c431aec3832ca8
Author: Niels Thykier <niels@thykier.net>
Date: Fri Apr 5 10:08:19 2013 +0200
coll/changelog-file: Check usr/share/doc/<pkg> is safe
At the same time, stop looking at files in usr/doc/<pkg>.
Signed-off-by: Niels Thykier <niels@thykier.net>
diff --git a/collection/changelog-file b/collection/changelog-file
index 416d6c1..6ec3fac 100755
--- a/collection/changelog-file
+++ b/collection/changelog-file
@@ -25,7 +25,7 @@ use strict;
use warnings;
use lib "$ENV{'LINTIAN_ROOT'}/lib";
-use Lintian::Util qw(fail gunzip_file);
+use Lintian::Util qw(fail gunzip_file is_ancestor_of);
sub collect {
my ($pkg, $type, $dir) = @_;
@@ -33,6 +33,12 @@ my ($pkg, $type, $dir) = @_;
unlink "$dir/changelog" or fail "cannot remove changelog file: $!"
if -e "$dir/changelog" or -l "$dir/changelog";
+# Extract NEWS.Debian files as well, with similar precautious. Ignore any
+# symlinks to other packages here; in that case, we just won't check the file.
+unlink "$dir/NEWS.Debian" or fail "cannot unlink NEWS.Debian: $!"
+ if -e "$dir/NEWS.Debian" or -l "$dir/NEWS.Debian";
+
+
# Pick the first of these files that exists.
my @changelogs = ("$dir/unpacked/usr/share/doc/$pkg/changelog.Debian.gz",
"$dir/unpacked/usr/share/doc/$pkg/changelog.Debian",
@@ -40,15 +46,17 @@ my @changelogs = ("$dir/unpacked/usr/share/doc/$pkg/changelog.Debian.gz",
"$dir/unpacked/usr/share/doc/$pkg/changelog.debian",
"$dir/unpacked/usr/share/doc/$pkg/changelog.gz",
"$dir/unpacked/usr/share/doc/$pkg/changelog",
- "$dir/unpacked/usr/doc/$pkg/changelog.Debian.gz",
- "$dir/unpacked/usr/doc/$pkg/changelog.Debian",
- "$dir/unpacked/usr/doc/$pkg/changelog.debian.gz",
- "$dir/unpacked/usr/doc/$pkg/changelog.debian",
- "$dir/unpacked/usr/doc/$pkg/changelog.gz",
- "$dir/unpacked/usr/doc/$pkg/changelog");
+ );
my $chl;
+if (-d "$dir/unpacked/usr/share/doc/$pkg"
+ && !is_ancestor_of("$dir/unpacked", "$dir/unpacked/usr/share/doc/$pkg")) {
+ # If the parent dir is outside this package, pretend we didn't find
+ # anything.
+ return;
+}
+
for (@changelogs) {
if (-l $_ || -f $_) {
$chl = $_;
@@ -112,10 +120,6 @@ if ($chl && $chl !~ m/changelog\.debian/i) {
unlink "$dir/changelog" unless $ok;
}
-# Extract NEWS.Debian files as well, with similar precautious. Ignore any
-# symlinks to other packages here; in that case, we just won't check the file.
-unlink "$dir/NEWS.Debian" or fail "cannot unlink NEWS.Debian: $!"
- if -e "$dir/NEWS.Debian" or -l "$dir/NEWS.Debian";
my $news = "$dir/unpacked/usr/share/doc/$pkg/NEWS.Debian.gz";
if (-f $news) {
if (-l $news) {
diff --git a/debian/changelog b/debian/changelog
index f85f712..5a4df73 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -159,6 +159,10 @@ lintian (2.5.12) UNRELEASED; urgency=low
+ [NT] New check written by Nicolas Boulenguez to catch some
mistakes with the new autopkgtest tests.
+ * collection/changelog-file:
+ + [NT] Ignore files in usr/doc/<pkg>.
+ + [NT] Skip collection if usr/share/doc/<pkg> is not contained
+ within the package root.
* collection/hardening-info{,-helper,.desc}:
+ [NT] Whitelist "memset" and "memmove" as "always safe"
functions. Thanks to Sebastian Ramacher for the suggestion
--
Debian package checker
Reply to: