Procházet zdrojové kódy

dpkg-gensymbols: skip directories accessed through a symlink

* scripts/dpkg-gensymbols.pl: It was already skipping symlinks
within the package build tree. Now it also skips real
directories accessed through a symlink contained in the package
build tree. Package like libc6-386 had symlinks usr/lib32
pointing to some directories outside of the build tree and
the LD_LIBRARY_PATH set by fakeroot led contained
/usr/lib32/libfakeroot which made dpkg-gensymbols scan this
directory and add libfakeroot to the libc6-386 symbols file!
Raphael Hertzog před 18 roky
rodič
revize
c1947e8002
3 změnil soubory, kde provedl 23 přidání a 1 odebrání
  1. 11 0
      ChangeLog
  2. 4 0
      debian/changelog
  3. 8 1
      scripts/dpkg-gensymbols.pl

+ 11 - 0
ChangeLog

@@ -1,3 +1,14 @@
+2008-08-29  Raphael Hertzog  <hertzog@debian.org>
+
+	* scripts/dpkg-gensymbols.pl: It was already skipping symlinks
+	within the package build tree. Now it also skips real
+	directories accessed through a symlink contained in the package
+	build tree. Package like libc6-386 had symlinks usr/lib32
+	pointing to some directories outside of the build tree and
+	the LD_LIBRARY_PATH set by fakeroot led contained
+	/usr/lib32/libfakeroot which made dpkg-gensymbols scan this
+	directory and add libfakeroot to the libc6-386 symbols file!
+
 2008-08-29  Raphael Hertzog  <hertzog@debian.org>
 2008-08-29  Raphael Hertzog  <hertzog@debian.org>
 
 
 	* scripts/Dpkg/Source/Package/V3/quilt.pm: run_quilt() can be run
 	* scripts/Dpkg/Source/Package/V3/quilt.pm: run_quilt() can be run

+ 4 - 0
debian/changelog

@@ -8,6 +8,10 @@ dpkg (1.14.22) UNRELEASED; urgency=low
   * Fix permissions of the automatically generated pacth in "2.0" and "3.0
   * Fix permissions of the automatically generated pacth in "2.0" and "3.0
     (quilt)" format. They were improperly set to 0600 due to tempfile()
     (quilt)" format. They were improperly set to 0600 due to tempfile()
     and were not reset to a sane value. Closes: #496925
     and were not reset to a sane value. Closes: #496925
+  * Fix dpkg-gensymbols to not scan (real) directories accessed through a
+    symlink contained in the build tree as they may well not be part of
+    the package (with absolute symlinks). It was already skipping symlinks
+    (since 1.14.16.6) for similar reasons.
 
 
   [ Updated dpkg translations ]
   [ Updated dpkg translations ]
   * Brazilian Portuguese (Felipe Augusto van de Wiel).
   * Brazilian Portuguese (Felipe Augusto van de Wiel).

+ 8 - 1
scripts/dpkg-gensymbols.pl

@@ -12,6 +12,7 @@ use Dpkg::Gettext;
 use Dpkg::ErrorHandling qw(warning error syserr usageerr);
 use Dpkg::ErrorHandling qw(warning error syserr usageerr);
 use Dpkg::Control;
 use Dpkg::Control;
 use Dpkg::Changelog qw(parse_changelog);
 use Dpkg::Changelog qw(parse_changelog);
+use Dpkg::Path qw(check_files_are_the_same);
 
 
 textdomain("dpkg-dev");
 textdomain("dpkg-dev");
 
 
@@ -137,12 +138,18 @@ foreach my $file ($input, $output, "debian/$oppackage.symbols.$host_arch",
 
 
 # Scan package build dir looking for libraries
 # Scan package build dir looking for libraries
 if (not scalar @files) {
 if (not scalar @files) {
-    foreach my $path (@librarypaths) {
+    PATH: foreach my $path (@librarypaths) {
 	my $libdir = "$packagebuilddir$path";
 	my $libdir = "$packagebuilddir$path";
 	$libdir =~ s{/+}{/}g;
 	$libdir =~ s{/+}{/}g;
 	lstat $libdir;
 	lstat $libdir;
 	next if not -d _;
 	next if not -d _;
 	next if -l _; # Skip directories which are symlinks
 	next if -l _; # Skip directories which are symlinks
+        # Skip any directory _below_ a symlink as well
+        my $updir = $libdir;
+        while (($updir =~ s{/[^/]*$}{}) and
+               not check_files_are_the_same($packagebuilddir, $updir)) {
+            next PATH if -l $updir;
+        }
 	opendir(DIR, "$libdir") ||
 	opendir(DIR, "$libdir") ||
 	    syserr(_g("Can't read directory %s: %s"), $libdir, $!);
 	    syserr(_g("Can't read directory %s: %s"), $libdir, $!);
 	push @files, grep {
 	push @files, grep {