The following commit has been merged in the stable branch:
commit 639d515a217ca2202b50ced736ce16478a7312cc
Author: Raphael Hertzog <[EMAIL PROTECTED]>
Date:   Sat Apr 12 14:21:06 2008 +0200

    dpkg-source: handle better symlinks to orig tarball
    
    * scripts/Dpkg/Path.pm (check_files_are_the_same): Add a new
    parameter so that we can use stat() instead of lstat() and
    compare if pointed files are the same.
    * scripts/Dpkg/Source/Package.pm: Resolve symlinks before deciding
    if both original tarballs are the same or not. Use the new
    parameter of check_files_are_the_same() for this.
    * scripts/Dpkg/Source/Package/V1_0.pm: Remove useless import of
    check_files_are_the_same.

diff --git a/ChangeLog b/ChangeLog
index 3b1c0fc..6ea7bff 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2008-04-12  Raphael Hertzog  <[EMAIL PROTECTED]>
+
+       * scripts/Dpkg/Path.pm (check_files_are_the_same): Add a new
+       parameter so that we can use stat() instead of lstat() and
+       compare if pointed files are the same.
+       * scripts/Dpkg/Source/Package.pm: Resolve symlinks before deciding
+       if both original tarballs are the same or not. Use the new
+       parameter of check_files_are_the_same() for this.
+       * scripts/Dpkg/Source/Package/V1_0.pm: Remove useless import of
+       check_files_are_the_same.
+
 2008-04-12  Sven Joachim  <[EMAIL PROTECTED]>
 
        * scripts/Dpkg/Source/Package.pm: Add missing import of
diff --git a/debian/changelog b/debian/changelog
index 7acc0cb..b1b1b38 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,8 @@ dpkg (1.14.18.1) UNRELEASED; urgency=low
 
   * Add missing import of subprocerr in Dpkg::Source::Package. Thanks to Sven
     Joachim for the patch.
+  * Handle symlinks better when deciding if dpkg-source has to copy the
+    original tarball in the current extraction directory. Closes: #475668
 
  -- Raphael Hertzog <[EMAIL PROTECTED]>  Sat, 12 Apr 2008 13:56:44 +0200
 
diff --git a/scripts/Dpkg/Path.pm b/scripts/Dpkg/Path.pm
index 30c7de9..2d04298 100644
--- a/scripts/Dpkg/Path.pm
+++ b/scripts/Dpkg/Path.pm
@@ -106,17 +106,24 @@ sub guess_pkg_root_dir($) {
     return undef;
 }
 
-=item check_files_are_the_same($file1, $file2)
+=item check_files_are_the_same($file1, $file2, $resolve_symlink)
 
 This function verifies that both files are the same by checking that the device
-numbers and the inode numbers returned by lstat() are the same.
+numbers and the inode numbers returned by stat()/lstat() are the same. If
+$resolve_symlink is true then stat() is used, otherwise lstat() is used.
 
 =cut
-sub check_files_are_the_same($$) {
-    my ($file1, $file2) = @_;
+sub check_files_are_the_same($$;$) {
+    my ($file1, $file2, $resolve_symlink) = @_;
     return 0 if ((! -e $file1) || (! -e $file2));
-    my @stat1 = lstat($file1);
-    my @stat2 = lstat($file2);
+    my (@stat1, @stat2);
+    if ($resolve_symlink) {
+        @stat1 = stat($file1);
+        @stat2 = stat($file2);
+    } else {
+        @stat1 = lstat($file1);
+        @stat2 = lstat($file2);
+    }
     my $result = ($stat1[0] == $stat2[0]) && ($stat1[1] == $stat2[1]);
     return $result;
 }
diff --git a/scripts/Dpkg/Source/Package.pm b/scripts/Dpkg/Source/Package.pm
index bfa00a8..ed87a66 100644
--- a/scripts/Dpkg/Source/Package.pm
+++ b/scripts/Dpkg/Source/Package.pm
@@ -305,7 +305,7 @@ sub extract {
         {
             my $src = File::Spec->catfile($self->{'basedir'}, $orig);
             my $dst = File::Spec->catfile($destdir, $orig);
-            if (not check_files_are_the_same($src, $dst)) {
+            if (not check_files_are_the_same($src, $dst, 1)) {
                 system('cp', '--', $src, $dst);
                 subprocerr("cp $src to $dst") if $?;
             }
diff --git a/scripts/Dpkg/Source/Package/V1_0.pm 
b/scripts/Dpkg/Source/Package/V1_0.pm
index 470242a..5ec2c2e 100644
--- a/scripts/Dpkg/Source/Package/V1_0.pm
+++ b/scripts/Dpkg/Source/Package/V1_0.pm
@@ -31,7 +31,6 @@ use Dpkg::Version qw(check_version);
 use Dpkg::Exit;
 use Dpkg::Source::Functions qw(erasedir);
 use Dpkg::Source::Package::V3_0::native;
-use Dpkg::Path qw(check_files_are_the_same);
 
 use POSIX;
 use File::Basename;

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to