[SCM] Debian package checker branch, master, updated. 2.5.1-11-g85b3d7f
The following commit has been merged in the master branch:
commit 85b3d7f518c3dffe1678f3897eaad6bf7b06bdab
Author: Niels Thykier <niels@thykier.net>
Date: Sat Jun 25 11:39:00 2011 +0200
Extended broken-symlink check to include relative symlinks
diff --git a/checks/symlinks b/checks/symlinks
index 28aa390..f5b6796 100644
--- a/checks/symlinks
+++ b/checks/symlinks
@@ -22,6 +22,7 @@ package Lintian::symlinks;
use strict;
use warnings;
+use File::Basename qw(dirname);
use Lintian::Relation ();
use Lintian::Tags qw(tag);
use Util;
@@ -43,35 +44,27 @@ foreach my $file (@{$info->sorted_index}) {
my $index_info = $index->{$file};
my $perm = $index_info->{type};
if ($perm =~ m/^l/o){
- my $target = $index_info->{link}//'';
- my $mylink = $target;
+ my $target = $index_info->{link}//''; # the link target
+ my $path; # the target (from the pkg root)
# Should not happen (too often) - but just in case
next unless $target;
- $mylink =~ s,//++,/,g;
- $mylink =~ s@/$@@o;
- next if $mylink eq ''; # skip links to "/"
-
- if ($target =~ m@^/@o){
- # absolute link - remove the initial slash
- $mylink = substr $mylink, 1;
- } else {
- # relative - break down the link
- # FIXME
- next;
- }
-
- # Check if the desstination is in the package itself
- next if $index->{$mylink} || $index->{"$mylink/"};
+ $path = resolve_pkg_path(dirname($file), $target);
+ next if $path eq ''; # skip links to "/"
+
+ # Check if the destination is in the package itself
+ next if $index->{$path} || $index->{"$path/"};
+
+ $target =~ s,^/++,,o; # strip leading slashes (for reporting)
# Ignore links pointing to common things that may exist
# even if they are not shipped by any binary from this
# source package.
- next if $mylink =~ m@man/man\d/undocumented@o or
- $mylink =~ m@^etc/alternatives/@o or
- $mylink eq 'lib/init/upstart-job';
+ next if $path =~ m@man/man\d/undocumented@o or
+ $path =~ m@^etc/alternatives/@o or
+ $path eq 'lib/init/upstart-job';
# Possibly broken symlink
- push @brokenlinks, [$file, $mylink, $target] unless $index->{$mylink};
+ push @brokenlinks, [$file, $path, $target] unless $index->{$path};
}
}
@@ -88,10 +81,10 @@ foreach my $depproc ($group->get_processables($type)){
BLINK:
foreach my $blink (@brokenlinks){
- my ($file, $mylink, $target) = @$blink;
+ my ($file, $path, $target) = @$blink;
foreach my $dindex (@dindexes){
# Is it in our dependency?
- next BLINK if $dindex->{$mylink} || $dindex->{"$mylink/"};
+ next BLINK if $dindex->{$path} || $dindex->{"$path/"};
}
# nope - not found in any of our direct dependencies.
tag 'package-contains-broken-symlink', $file, $target
diff --git a/debian/changelog b/debian/changelog
index 8ba4ccb..b8f8151 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -17,6 +17,9 @@ lintian (2.5.2) UNRELEASED; urgency=low
+ [NT] Removed a leading slash from the filename part of the
extra for python-debug-in-wrong-location. Thanks to
Jakub Wilk for the report and the patch. (Closes: #631530)
+ * checks/symlinks:
+ + [NT] Symlink checking extended to relative paths as well.
+ (Closes: #217023)
* frontend/lintian:
+ [NT] Ensure that all dependency collections of a check are
diff --git a/t/tests/symlinks-broken/debian/debian/broken-links.links b/t/tests/symlinks-broken/debian/debian/broken-links.links
index e4935e9..efcf9de 100644
--- a/t/tests/symlinks-broken/debian/debian/broken-links.links
+++ b/t/tests/symlinks-broken/debian/debian/broken-links.links
@@ -1,5 +1,7 @@
# broken links
+usr/share/broken-links/some.data usr/lib/broken-links/some.data
etc/some.conf usr/lib/broken-links/some.conf
# valid links
+usr/share/data-pkg/valid.data usr/lib/data-pkg/valid.data
etc/valid.conf usr/lib/data-pkg/valid.conf
diff --git a/t/tests/symlinks-broken/debian/debian/data-pkg.install b/t/tests/symlinks-broken/debian/debian/data-pkg.install
index 0268d93..e26c08b 100644
--- a/t/tests/symlinks-broken/debian/debian/data-pkg.install
+++ b/t/tests/symlinks-broken/debian/debian/data-pkg.install
@@ -1 +1,2 @@
valid.conf etc/
+valid.data usr/share/data-pkg/
diff --git a/t/tests/symlinks-broken/tags b/t/tests/symlinks-broken/tags
index 316eee6..d3dd1ab 100644
--- a/t/tests/symlinks-broken/tags
+++ b/t/tests/symlinks-broken/tags
@@ -1 +1,2 @@
-X: broken-links: package-contains-broken-symlink usr/lib/broken-links/some.conf /etc/some.conf
+X: broken-links: package-contains-broken-symlink usr/lib/broken-links/some.conf etc/some.conf
+X: broken-links: package-contains-broken-symlink usr/lib/broken-links/some.data ../../share/broken-links/some.data
--
Debian package checker
Reply to: