[SCM] Debian package checker branch, master, updated. 2.5.12-22-g3c6abb6
The following commit has been merged in the master branch:
commit 3c6abb6662d485fafbe13343ec0a037976fabdd9
Author: Niels Thykier <niels@thykier.net>
Date: Sat Apr 20 18:53:35 2013 +0200
L::Path: Rename link_resolved to link_normalized
"resolve" suggests the sub does more than it did, so rename it to
"normalize".
Signed-off-by: Niels Thykier <niels@thykier.net>
diff --git a/checks/changelog-file b/checks/changelog-file
index ef99339..e009a9c 100644
--- a/checks/changelog-file
+++ b/checks/changelog-file
@@ -60,7 +60,7 @@ for my $file ($info->sorted_index) {
if ($path->is_symlink) {
# A symlink; use its target info if available.
- my $target = $path->link_resolved;
+ my $target = $path->link_normalized;
my $tinfo = $info->file_info ($target);
$file_info{$file} = $tinfo if defined $tinfo;
}
diff --git a/checks/files b/checks/files
index 049d12c..9c0f3dc 100644
--- a/checks/files
+++ b/checks/files
@@ -925,7 +925,7 @@ foreach my $file ($info->sorted_index) {
my ($dwidth, $dheight) = ($1, $2);
my $path;
if ($index_info->is_symlink) {
- $path = $index_info->link_resolved;
+ $path = $index_info->link_normalized;
} else {
$path = $file;
}
diff --git a/checks/scripts b/checks/scripts
index 2cbd3c4..5604f52 100644
--- a/checks/scripts
+++ b/checks/scripts
@@ -424,7 +424,7 @@ foreach (keys %executable) {
if ($index_info->is_hardlink) {
# We don't collect script information for hardlinks, so check
# if the target is a script.
- my $target = $index_info->link_resolved;
+ my $target = $index_info->link_normalized;
if (exists $info->scripts->{$target}) {
$ok = 1;
}
diff --git a/checks/symlinks b/checks/symlinks
index 21b8087..d568707 100644
--- a/checks/symlinks
+++ b/checks/symlinks
@@ -40,7 +40,7 @@ foreach my $file ($info->sorted_index) {
my $path; # the target (from the pkg root)
# Should not happen (too often) - but just in case
next unless $target;
- $path = $index_info->link_resolved;
+ $path = $index_info->link_normalized;
if (not defined $path) {
# Unresolvable link
tag 'package-contains-unsafe-symlink', $file;
diff --git a/debian/changelog b/debian/changelog
index df1d906..fcb118f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -25,6 +25,8 @@ lintian (2.5.13) UNRELEASED; urgency=low
+ [NT] Fix a number of spelling mistakes in the POD.
* lib/Lintian/Collect/{Package,Binary}.pm:
+ [NT] Accept Lintian::Path objects to unpacked and control.
+ * lib/Lintian/Path.pm:
+ + [NT] Rename link_resolved to link_normalized.
* lib/Lintian/Util.pm:
+ [NT] Fix a race condition in touch_file.
+ [NT] Add sanity check in perm2oct for bad permission
diff --git a/lib/Lintian/Collect/Package.pm b/lib/Lintian/Collect/Package.pm
index c2cf2c3..8abe25d 100644
--- a/lib/Lintian/Collect/Package.pm
+++ b/lib/Lintian/Collect/Package.pm
@@ -114,7 +114,7 @@ The following code may be helpful in checking for path traversal:
}
Alternatively one can use normalize_pkg_path in L<Lintian::Util> or
-L<link_resolved|Lintian::Path/link_resolved>.
+L<link_normalized|Lintian::Path/link_normalized>.
To get a list of entries in the package or the file meta data of the
entries (as L<path objects|Lintian::Path>), see L</sorted_index> and
diff --git a/lib/Lintian/Path.pm b/lib/Lintian/Path.pm
index 945e183..e2a4242 100644
--- a/lib/Lintian/Path.pm
+++ b/lib/Lintian/Path.pm
@@ -45,10 +45,12 @@ Lintian::Path - Lintian representation of a path entry in a package
if ($path->owner eq 'root') { }
if ($path->group eq 'root') { }
} elsif ($path->is_symlink) {
- my $resolved = $path->link_resolved;
- if (defined $resolved) {
- # is a resolvable symlink (pointing to $target)
- my $more_info = $info->index($resolved);
+ my $normalized = $path->link_normalized;
+ if (defined($normalized)) {
+ my $more_info = $info->index($normalized);
+ if (defined($more_info)) {
+ # target exists in the package...
+ }
}
}
@@ -228,8 +230,14 @@ sub is_regular_file { return $_[0]->_is_type ('-'); }
=item link_resolved
-Resolve the link and return the resolved name. If the link cannot be
-resolved or it is unsafe to resolve, this method returns undef.
+Deprecated alias of link_normalized for << 2.5.13~. This will go away
+in >= 2.5.14~.
+
+=item link_normalized
+
+Returns the target of the link normalized against it's directory name.
+If the link cannot be normalized or normalized path might escape the
+package root, this method returns C<undef>.
NB: This method will return the empty string for links pointing to the
root dir of the package.
@@ -241,11 +249,19 @@ B<CAVEAT>: This method is I<not always sufficient> to test if it is
safe to open a given symlink. Use
L<is_ancestor_of|Lintian::Util/is_ancestor_of(PARENTDIR, PATH)> for
that. If you must use this method, remember to check that the target
-is not a symlink (or if it is, that it can be resolved).
+is not a symlink (or if it is, that it can be resolved safely).
+
+This method was named link_resolved in Lintian << 2.5.13~.
=cut
sub link_resolved {
+ warnings::warnif('deprecated',
+ 'link_resolved was renamed to link_normalized');
+ goto \&link_normalized;
+}
+
+sub link_normalized {
my ($self) = @_;
return $self->{'link_target'} if exists $self->{'link_target'};
my $name = $self->name;
--
Debian package checker
Reply to: