Bladeren bron

dpkg-gensymbols: important bugfix concerning #includes of symbols files

* scripts/Dpkg/Shlibs/SymbolFile.pm (load): Let the recursively
nested calls to load() modify the name of the current object so
that the header can be set in an included file (like it's already
documented).

The example below didn't work but it was supposed to:
 #include "libsomething1.symbols.common"
  arch_specific_symbol@Base 1.0
Raphael Hertzog 17 jaren geleden
bovenliggende
commit
2fe0ba46aa
3 gewijzigde bestanden met toevoegingen van 17 en 3 verwijderingen
  1. 7 0
      ChangeLog
  2. 3 0
      debian/changelog
  3. 7 3
      scripts/Dpkg/Shlibs/SymbolFile.pm

+ 7 - 0
ChangeLog

@@ -1,3 +1,10 @@
+2008-10-20  Raphael Hertzog  <hertzog@debian.org>
+
+	* scripts/Dpkg/Shlibs/SymbolFile.pm (load): Let the recursively
+	nested calls to load() modify the name of the current object so
+	that the header can be set in an included file (like it's already
+	documented).
+
 2008-09-26  Thiemo Seufer  <ths@debian.org>
 2008-09-26  Thiemo Seufer  <ths@debian.org>
 
 
 	* scripts/Dpkg/Shlibs/SymbolFile.pm: add "__gnu_local_gp" symbol
 	* scripts/Dpkg/Shlibs/SymbolFile.pm: add "__gnu_local_gp" symbol

+ 3 - 0
debian/changelog

@@ -3,6 +3,9 @@ dpkg (1.14.23) UNRELEASED; urgency=low
   [ Raphael Hertzog ]
   [ Raphael Hertzog ]
   * Blacklist "__gnu_local_gp" symbol for dpkg-gensymbols. Closes: #500188
   * Blacklist "__gnu_local_gp" symbol for dpkg-gensymbols. Closes: #500188
     Thanks to Thiemo Seufer <ths@debian.org>.
     Thanks to Thiemo Seufer <ths@debian.org>.
+  * Important bugfix in dpkg-gensymbols for people using includes in symbol
+    files: the current object didn't flow back from the included file to
+    the including file.
 
 
   [ Updated dpkg translations ]
   [ Updated dpkg translations ]
   * Greek (Emmanuel Galatoulas). Closes: #498585
   * Greek (Emmanuel Galatoulas). Closes: #498585

+ 7 - 3
scripts/Dpkg/Shlibs/SymbolFile.pm

@@ -101,7 +101,7 @@ sub clear_except {
 
 
 # Parameter seen is only used for recursive calls
 # Parameter seen is only used for recursive calls
 sub load {
 sub load {
-    my ($self, $file, $seen, $current_object) = @_;
+    my ($self, $file, $seen, $current_object_ref) = @_;
 
 
     if (defined($seen)) {
     if (defined($seen)) {
 	return if exists $seen->{$file}; # Avoid include loops
 	return if exists $seen->{$file}; # Avoid include loops
@@ -113,7 +113,11 @@ sub load {
 
 
     open(my $sym_file, "<", $file)
     open(my $sym_file, "<", $file)
 	|| syserr(_g("cannot open %s"), $file);
 	|| syserr(_g("cannot open %s"), $file);
-    my $object = $current_object;
+    if (not ref($current_object_ref)) {
+        my $obj;
+        $current_object_ref = \$obj;
+    }
+    local *object = $current_object_ref;
     while (defined($_ = <$sym_file>)) {
     while (defined($_ = <$sym_file>)) {
 	chomp($_);
 	chomp($_);
 	if (/^\s+(\S+)\s(\S+)(?:\s(\d+))?/) {
 	if (/^\s+(\S+)\s(\S+)(?:\s(\d+))?/) {
@@ -137,7 +141,7 @@ sub load {
 	    my $filename = $1;
 	    my $filename = $1;
 	    my $dir = $file;
 	    my $dir = $file;
 	    $dir =~ s{[^/]+$}{}; # Strip filename
 	    $dir =~ s{[^/]+$}{}; # Strip filename
-	    $self->load("$dir$filename", $seen, $object);
+	    $self->load("$dir$filename", $seen, $current_object_ref);
 	} elsif (/^#(?:DEPRECATED|MISSING): ([^#]+)#\s*(\S+)\s(\S+)(?:\s(\d+))?/) {
 	} elsif (/^#(?:DEPRECATED|MISSING): ([^#]+)#\s*(\S+)\s(\S+)(?:\s(\d+))?/) {
 	    my $sym = {
 	    my $sym = {
 		minver => $3,
 		minver => $3,