Просмотр исходного кода

Dpkg::Source::Package::V2: Do not exclude pre-existing symlinks for debian/

This effectively reverts commit 867c88dadccff6e285c48dadccb61f9001b50d9b.

There is no point in excluding pre-existing symlinks when unpacking the
packaging tarball, as GNU tar will make sure to unlink any symlink
before extracting an object replacing it. So there should be no danger
of escaping the directory.

Closes: #790073, #791535
Guillem Jover лет назад: 11
Родитель
Сommit
a779ef95e8
2 измененных файлов с 3 добавлено и 13 удалено
  1. 2 0
      debian/changelog
  2. 1 13
      scripts/Dpkg/Source/Package/V2.pm

+ 2 - 0
debian/changelog

@@ -21,6 +21,8 @@ dpkg (1.18.2) UNRELEASED; urgency=low
       Regression introduced in dpkg 1.18.0. Closes: #789957
     - Make the BinaryFiles subpackage self-contained by explicitly importing
       File::Spec in Dpkg::Source::Package::V2.
+    - Do not exclude pre-existing symlinks when unpacking the debian/ tarball
+      in Dpkg::Source::Package::V2. Closes: #790073, #791535
   * Documentation:
     - Fix grammar in dpkg-architecture(1).
       Thanks to Chris Lamb <lamby@debian.org>. Closes: #787616

+ 1 - 13
scripts/Dpkg/Source/Package/V2.pm

@@ -187,20 +187,8 @@ sub do_extract {
     # Extract debian tarball after removing the debian directory
     info(g_('unpacking %s'), $debianfile);
     erasedir("$newdirectory/debian");
-    # Exclude existing symlinks from extraction of debian.tar.gz as we
-    # don't want to overwrite something outside of $newdirectory due to a
-    # symlink
-    my @exclude_symlinks;
-    my $wanted = sub {
-        return if not -l;
-        my $fn = File::Spec->abs2rel($_, $newdirectory);
-        push @exclude_symlinks, '--exclude', $fn;
-    };
-    find({ wanted => $wanted, no_chdir => 1 }, $newdirectory);
     $tar = Dpkg::Source::Archive->new(filename => "$dscdir$debianfile");
-    $tar->extract($newdirectory, in_place => 1,
-                  options => [ '--anchored', '--no-wildcards',
-                  @exclude_symlinks ]);
+    $tar->extract($newdirectory, in_place => 1);
 
     # Apply patches (in a separate method as it might be overridden)
     $self->apply_patches($newdirectory, usage => 'unpack')