Explorar o código

dpkg-gensymbols: Use the original template symbols file when diffing

We should not create a new template symbols file, because the output
might change (different sorting order for example) relative to the
original.

Closes: #773718
Guillem Jover %!s(int64=11) %!d(string=hai) anos
pai
achega
9251cc40db
Modificáronse 2 ficheiros con 12 adicións e 1 borrados
  1. 4 0
      debian/changelog
  2. 8 1
      scripts/dpkg-gensymbols.pl

+ 4 - 0
debian/changelog

@@ -52,6 +52,10 @@ dpkg (1.18.0) UNRELEASED; urgency=low
   * Update amd64 GNU cpu regex in cputable to match amd64 too, in addition
     to x86_64. This is required for FreeBSD.
   * Use badusage() instead of ohshit() for command-line errors.
+  * Use the original template symbols file when diffing in dpkg-gensymbols.
+    We should not create a new template symbols file, because the output
+    might change (different sorting order for example) relative to the
+    original. Closes: #773718
 
   * Perl modules:
     - Rename and deprecate Dpkg::Gettext _g function with new g_.

+ 8 - 1
scripts/dpkg-gensymbols.pl

@@ -21,6 +21,8 @@
 use strict;
 use warnings;
 
+use File::Copy;
+
 use Dpkg ();
 use Dpkg::Arch qw(get_host_arch);
 use Dpkg::Package;
@@ -281,7 +283,12 @@ unless ($quiet) {
     # Compare template symbols files before and after
     my $before = File::Temp->new(TEMPLATE=>'dpkg-gensymbolsXXXXXX');
     my $after = File::Temp->new(TEMPLATE=>'dpkg-gensymbolsXXXXXX');
-    $ref_symfile->output($before, package => $oppackage, template_mode => 1);
+    if ($ref_symfile->{file}) {
+        # If the original template symbols file exists, use it instead of
+        # trying to regenerate it, as the output might differ in sort order
+        # or similar.
+        copy($ref_symfile->{file}, $before);
+    }
     $symfile->output($after, package => $oppackage, template_mode => 1);
 
     seek $before, 0, 0;