diff options
author | Guillem Jover <guillem@debian.org> | 2014-01-07 04:00:47 +0100 |
---|---|---|
committer | Guillem Jover <guillem@debian.org> | 2014-01-15 15:02:16 +0100 |
commit | c17be3cbfc58e5b54ae1d5ae4714460d7ae2e15c (patch) | |
tree | 5320508d5f1e73e9cbc532f0358d8c0ea534551d /dpkg-deb | |
parent | e7e052b462e794165411aa12b36324a66dcb6700 (diff) | |
download | dpkg-c17be3cbfc58e5b54ae1d5ae4714460d7ae2e15c.tar.gz |
dpkg-deb: Accept other compressions for control.tar .deb member
This includes no compression (control.tar) or xz compression
(control.tar.xz).
There's really no point allowing the deprecated lzma, or the inferior
bzip2 at this time, when gzip and xz are superior in either speed or
compression ratio.
Diffstat (limited to 'dpkg-deb')
-rw-r--r-- | dpkg-deb/build.c | 6 | ||||
-rw-r--r-- | dpkg-deb/dpkg-deb.h | 2 | ||||
-rw-r--r-- | dpkg-deb/extract.c | 13 |
3 files changed, 17 insertions, 4 deletions
diff --git a/dpkg-deb/build.c b/dpkg-deb/build.c index c49dbc0e3..e816e0ab6 100644 --- a/dpkg-deb/build.c +++ b/dpkg-deb/build.c @@ -552,10 +552,14 @@ do_build(const char *const *argv) debar, err.str); } else if (deb_format.major == 2) { const char deb_magic[] = ARCHIVEVERSION "\n"; + char adminmember[16 + 1]; + + sprintf(adminmember, "%s%s", ADMINMEMBER, + compressor_get_extension(compressor_type_gzip)); dpkg_ar_put_magic(debar, arfd); dpkg_ar_member_put_mem(debar, arfd, DEBMAGIC, deb_magic, strlen(deb_magic)); - dpkg_ar_member_put_file(debar, arfd, ADMINMEMBER, gzfd, -1); + dpkg_ar_member_put_file(debar, arfd, adminmember, gzfd, -1); } else { internerr("unknown deb format version %d.%d", deb_format.major, deb_format.minor); } diff --git a/dpkg-deb/dpkg-deb.h b/dpkg-deb/dpkg-deb.h index 13106be44..1238d1407 100644 --- a/dpkg-deb/dpkg-deb.h +++ b/dpkg-deb/dpkg-deb.h @@ -70,7 +70,7 @@ extern struct compress_params compress_params; #define OLDOLDDEBDIR ".DEBIAN" #define DEBMAGIC "debian-binary" -#define ADMINMEMBER "control.tar.gz" +#define ADMINMEMBER "control.tar" #define DATAMEMBER "data.tar" #define MAXFILENAME 2048 diff --git a/dpkg-deb/extract.c b/dpkg-deb/extract.c index 4b1e1f26d..55fdfcb19 100644 --- a/dpkg-deb/extract.c +++ b/dpkg-deb/extract.c @@ -178,9 +178,18 @@ extracthalf(const char *debar, const char *dir, if (fd_skip(arfd, memberlen + (memberlen & 1), &err) < 0) ohshit(_("cannot skip archive member from '%s': %s"), debar, err.str); } else { - if (strncmp(arh.ar_name, ADMINMEMBER, sizeof(arh.ar_name)) == 0) + if (strncmp(arh.ar_name, ADMINMEMBER, strlen(ADMINMEMBER)) == 0) { + const char *extension = arh.ar_name + strlen(ADMINMEMBER); + adminmember = 1; - else { + decompressor = compressor_find_by_extension(extension); + if (decompressor != compressor_type_none && + decompressor != compressor_type_gzip && + decompressor != compressor_type_xz) + ohshit(_("archive '%s' uses unknown compression for member '%.*s', " + "giving up"), + debar, (int)sizeof(arh.ar_name), arh.ar_name); + } else { if (adminmember != 1) ohshit(_("archive '%s' has premature member '%.*s' before '%s', " "giving up"), |