]> git.donarmstrong.com Git - debhelper.git/commitdiff
r2020: * dh_link: Skip self-links. Closes: #438572
authorjoeyh <joeyh>
Sat, 18 Aug 2007 00:42:06 +0000 (00:42 +0000)
committerjoeyh <joeyh>
Sat, 18 Aug 2007 00:42:06 +0000 (00:42 +0000)
debian/changelog
dh_link
t/dh_link

index 560be2d3cbb902ae4e9d2623c2a6915020f073d5..7cc099b5e94246badae92eb117d00c28477009ce 100644 (file)
@@ -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 f7a910a5a473cc483b9ce705174f08689092e47a..84e6ba359bef31bebec1746f2ba61cd2020f8f79 100755 (executable)
--- 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) {
index daeb209b9b3ad9a3d315e3f983b95db80ee7292d..c6be35be4020052536dc6153a795baf7667d4312 100755 (executable)
--- 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");