This is an automated email from the git hooks/post-receive script. guillem pushed a commit to branch master in repository dpkg.
View the commit online: https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=683d5a21fb749d49873d04639732a69a3b41f59b commit 683d5a21fb749d49873d04639732a69a3b41f59b Author: Guillem Jover <guil...@debian.org> AuthorDate: Thu Nov 29 01:28:32 2018 +0100 libdpkg: Detect unsupported tar entry types to give better error messages We know what we do not support, let's detect and give better diagnostics so that users get even less confused. --- debian/changelog | 1 + lib/dpkg/tarfn.c | 23 +++++++++++++++++++++++ lib/dpkg/tarfn.h | 9 +++++++++ 3 files changed, 33 insertions(+) diff --git a/debian/changelog b/debian/changelog index 0cb18d8ed..f65ac0f9c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -51,6 +51,7 @@ dpkg (1.19.3) UNRELEASED; urgency=medium * libdpkg: Add proper tar error handling. This makes the tar extractor track and report back parse errors, so that we can give more descriptive messages. + * libdpkg: Detect unsupported tar entry types to give better error messages. * Perl modules: - Dpkg::Changelog::Debian: Preserve modelines at EOF. Closes: #916056 Thanks to Chris Lamb <la...@debian.org> for initial test cases. diff --git a/lib/dpkg/tarfn.c b/lib/dpkg/tarfn.c index 8e3b6e545..afcce0ee5 100644 --- a/lib/dpkg/tarfn.c +++ b/lib/dpkg/tarfn.c @@ -530,6 +530,29 @@ tar_extractor(struct tar_archive *tar) case TAR_FILETYPE_GNU_LONGNAME: status = tar_gnu_long(tar, &h, &next_long_name); break; + case TAR_FILETYPE_GNU_VOLUME: + case TAR_FILETYPE_GNU_MULTIVOL: + case TAR_FILETYPE_GNU_SPARSE: + case TAR_FILETYPE_GNU_DUMPDIR: + status = dpkg_put_error(&tar->err, + _("unsupported GNU tar header type '%c'"), + h.type); + errno = 0; + break; + case TAR_FILETYPE_SOLARIS_EXTENDED: + case TAR_FILETYPE_SOLARIS_ACL: + status = dpkg_put_error(&tar->err, + _("unsupported Solaris tar header type '%c'"), + h.type); + errno = 0; + break; + case TAR_FILETYPE_PAX_GLOBAL: + case TAR_FILETYPE_PAX_EXTENDED: + status = dpkg_put_error(&tar->err, + _("unsupported PAX tar header type '%c'"), + h.type); + errno = 0; + break; default: status = dpkg_put_error(&tar->err, _("unknown tar header type '%c'"), diff --git a/lib/dpkg/tarfn.h b/lib/dpkg/tarfn.h index 06685a720..0302fb8a9 100644 --- a/lib/dpkg/tarfn.h +++ b/lib/dpkg/tarfn.h @@ -54,8 +54,17 @@ enum tar_filetype { TAR_FILETYPE_BLOCKDEV = '4', TAR_FILETYPE_DIR = '5', TAR_FILETYPE_FIFO = '6', + TAR_FILETYPE_CONTIG = '7', TAR_FILETYPE_GNU_LONGLINK = 'K', TAR_FILETYPE_GNU_LONGNAME = 'L', + TAR_FILETYPE_GNU_VOLUME = 'V', + TAR_FILETYPE_GNU_MULTIVOL = 'M', + TAR_FILETYPE_GNU_DUMPDIR = 'D', + TAR_FILETYPE_GNU_SPARSE = 'S', + TAR_FILETYPE_PAX_GLOBAL = 'g', + TAR_FILETYPE_PAX_EXTENDED = 'x', + TAR_FILETYPE_SOLARIS_EXTENDED = 'X', + TAR_FILETYPE_SOLARIS_ACL = 'A', }; struct tar_entry { -- Dpkg.Org's dpkg