Sfoglia il codice sorgente

dpkg-deb: Set correct default compression value for control.tar.gz member

Regression introduced in commit f1f9887b8f96965d6046857d12fda24c053c6d4b.

The compressor independent way to denote the default value has been to
use -1, but that needs to be fixed up to the actual default value per
compressor, before the compressor specific setup.

When using the gzip command-line tool this is a fatal error as it does
not recognize the argument «-c-1». When using the zlib shared library
this makes the code always default to the compression level 1, as ‘-’
is ignored by gzdopen().

The current minimal fix is to call compressor_check_params() when
setting up the default control.tar compressor paramaters, although
that makes the API hard to use correctly. This will be improved in
the future.

Closes: #786654
Guillem Jover 11 anni fa
parent
commit
2ae3e07e43
2 ha cambiato i file con 6 aggiunte e 0 eliminazioni
  1. 4 0
      debian/changelog
  2. 2 0
      dpkg-deb/build.c

+ 4 - 0
debian/changelog

@@ -17,6 +17,10 @@ dpkg (1.18.1) UNRELEASED; urgency=low
     Thanks to Maximilian Schwerin <maximilian.schwerin@tigris.de>.
   * Sort dpkg-scansources output by package name and version.
     Thanks to Maximilian Schwerin <maximilian.schwerin@tigris.de>.
+  * Set the correct default compression value in dpkg-deb for control.tar.gz
+    member. This meant using compression level 1 when using the zlib shared
+    library to compress the control.tar member, and always failing when using
+    the gzip command. Regression introduced in dpkg 1.17.6. Closes: #786654
   * Perl modules:
     - Add missing strict and warnings pragmas for submodules.
     - Use non-destructive substitutions inside map.

+ 2 - 0
dpkg-deb/build.c

@@ -527,6 +527,8 @@ do_build(const char *const *argv)
     control_compress_params.type = COMPRESSOR_TYPE_GZIP;
     control_compress_params.strategy = COMPRESSOR_STRATEGY_NONE;
     control_compress_params.level = -1;
+    if (!compressor_check_params(&control_compress_params, &err))
+      internerr("invalid control member compressor params: %s", err.str);
   }
 
   c2 = subproc_fork();