Sfoglia il codice sorgente

Dpkg::Source::Archive: Future-proof tar invocations

The function options should come before any other option. And at least
the --owner and --group options might become positional in the same way
--no-recursion did with tar > 1.28, according to upstream. Suffle
options around to make sure this does not cause any problems in the
future.
Guillem Jover 11 anni fa
parent
commit
02e2060504
2 ha cambiato i file con 8 aggiunte e 5 eliminazioni
  1. 3 0
      debian/changelog
  2. 5 5
      scripts/Dpkg/Source/Archive.pm

+ 3 - 0
debian/changelog

@@ -53,6 +53,9 @@ dpkg (1.18.2) UNRELEASED; urgency=low
     - Allow colons (:) in added filenames in Dpkg::Dist::Files, which can be
       present when the upstream version contains colons. Regression introduced
       in dpkg 1.18.0. Reported by Jakub Wilk <jwilk@debian.org>.
+    - Future-proof tar invocations in Dpkg::Source::Archive for options that
+      might become positional in the future, and by always placing function
+      options first.
   * Documentation:
     - Fix grammar in dpkg-architecture(1).
       Thanks to Chris Lamb <lamby@debian.org>. Closes: #787616

+ 5 - 5
scripts/Dpkg/Source/Archive.pm

@@ -48,9 +48,9 @@ sub create {
     $spawn_opts{from_pipe} = \*$self->{tar_input};
     # Call tar creation process
     $spawn_opts{delete_env} = [ 'TAR_OPTIONS' ];
-    $spawn_opts{exec} = [ 'tar', '--null', '-T', '-', '--numeric-owner',
-                            '--owner', '0', '--group', '0', '--format=gnu',
-                            @{$opts{options}}, '-cf', '-' ];
+    $spawn_opts{exec} = [ 'tar', '-cf', '-', '--format=gnu', '--null',
+                          '--numeric-owner', '--owner=0', '--group=0',
+                          @{$opts{options}}, '-T', '-' ];
     *$self->{pid} = spawn(%spawn_opts);
     *$self->{cwd} = getcwd();
 }
@@ -126,8 +126,8 @@ sub extract {
 
     # Call tar extraction process
     $spawn_opts{delete_env} = [ 'TAR_OPTIONS' ];
-    $spawn_opts{exec} = [ 'tar', '--no-same-owner', '--no-same-permissions',
-                            @{$opts{options}}, '-xf', '-' ];
+    $spawn_opts{exec} = [ 'tar', '-xf', '-', '--no-same-permissions',
+                          '--no-same-owner', @{$opts{options}} ];
     spawn(%spawn_opts);
     $self->close();