Bläddra i källkod

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 år sedan
förälder
incheckning
2fe0ba46aa
3 ändrade filer med 17 tillägg och 3 borttagningar
  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>
 
 	* 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 ]
   * Blacklist "__gnu_local_gp" symbol for dpkg-gensymbols. Closes: #500188
     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 ]
   * 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
 sub load {
-    my ($self, $file, $seen, $current_object) = @_;
+    my ($self, $file, $seen, $current_object_ref) = @_;
 
     if (defined($seen)) {
 	return if exists $seen->{$file}; # Avoid include loops
@@ -113,7 +113,11 @@ sub load {
 
     open(my $sym_file, "<", $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>)) {
 	chomp($_);
 	if (/^\s+(\S+)\s(\S+)(?:\s(\d+))?/) {
@@ -137,7 +141,7 @@ sub load {
 	    my $filename = $1;
 	    my $dir = $file;
 	    $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+))?/) {
 	    my $sym = {
 		minver => $3,