summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/changelog3
-rwxr-xr-xdh_link7
-rwxr-xr-xt/dh_link6
3 files changed, 13 insertions, 3 deletions
diff --git a/debian/changelog b/debian/changelog
index 560be2d..7cc099b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,8 +2,9 @@ debhelper (5.0.54) UNRELEASED; urgency=low
* dh_strip: Man page reference to policy section on DEB_BUILD_OPTIONS.
Closes: #437337
+ * dh_link: Skip self-links. Closes: #438572
- -- Joey Hess <joeyh@debian.org> Sat, 11 Aug 2007 19:27:55 -0400
+ -- Joey Hess <joeyh@debian.org> Fri, 17 Aug 2007 20:41:42 -0400
debhelper (5.0.53) unstable; urgency=low
diff --git a/dh_link b/dh_link
index f7a910a..84e6ba3 100755
--- a/dh_link
+++ b/dh_link
@@ -166,6 +166,11 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
$src=~s:^/::;
$dest=~s:^/::;
+
+ if ($src eq $dest) {
+ warning("skipping link from $src to self");
+ next;
+ }
# Make sure the directory the link will be in exists.
my $basedir=dirname("$tmp/$dest");
@@ -182,7 +187,7 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
# Figure out how much of a path $src and $dest
# share in common.
my $x;
- for ($x=0; $x<@src_dirs && $src_dirs[$x] eq $dest_dirs[$x]; $x++) {}
+ for ($x=0; $x < @src_dirs && $src_dirs[$x] eq $dest_dirs[$x]; $x++) {}
# Build up the new src.
$src="";
for (1..$#dest_dirs - $x) {
diff --git a/t/dh_link b/t/dh_link
index daeb209..c6be35b 100755
--- a/t/dh_link
+++ b/t/dh_link
@@ -1,6 +1,6 @@
#!/usr/bin/perl
use Test;
-plan(tests => 12);
+plan(tests => 13);
# It used to not make absolute links in this situation, and it should.
# #37774
@@ -34,6 +34,10 @@ ok(readlink("debian/debhelper/usr/lib/geant4/c"), "../..");
system("./dh_link","/","usr/lib/geant4/d");
ok(readlink("debian/debhelper/usr/lib/geant4/d"), "/");
+# Link to self.
+system("./dh_link usr/lib/foo usr/lib/foo 2>/dev/null");
+ok(! -l "debian/debhelper/usr/lib/foo");
+
# Make sure the link conversion didn't change any of the previously made
# links.
ok(readlink("debian/debhelper/usr/lib/bar"), "/etc/foo");