Hi, is there possible to fail as early as possible during e.g. trying of --list & --verify the archive? Something like the patch attached?
If not, tar may fail hitting the abort() call: $ tar -czf /tmp/test.tgz FILE $ tar -tWvf /tmp/test.tgz tar: This does not look like a tar archive tar: Skipping to next header Aborted (core dumped) Original report is here: http://bugzilla.redhat.com/977807 Pavel
>From 6a5eb6b3a15be6649cff10a8978efc1a1747544c Mon Sep 17 00:00:00 2001 From: Pavel Raiskup <prais...@redhat.com> Date: Wed, 26 Jun 2013 16:03:01 +0200 Subject: [PATCH] tar: fail early when --verify & --list passed * src/tar.c (decode_options): Fail with USAGE_ERROR when -W and incompatible operation mode is passed. --- src/tar.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/tar.c b/src/tar.c index c29b4fa..d362865 100644 --- a/src/tar.c +++ b/src/tar.c @@ -2574,6 +2574,10 @@ decode_options (int argc, char **argv) USAGE_ERROR ((0, 0, _("Cannot verify multi-volume archives"))); if (use_compress_program_option) USAGE_ERROR ((0, 0, _("Cannot verify compressed archives"))); + if (subcommand_option != CREATE_SUBCOMMAND + && subcommand_option != APPEND_SUBCOMMAND + && subcommand_option != CAT_SUBCOMMAND) + USAGE_ERROR ((0, 0, _("Cannot verify, do you want --diff ?"))); } if (use_compress_program_option) -- 1.8.2.1