Hello,
please, could you consider applying the attached patch? The problem is
when tar is invoked with --format option, such that:
(format != posix && format != default)
In such case it is impossible to change file attributes while
extracting/listing by --pax-option, e.g.:
tar --format=gnu --pax-option="mtime:={now}" -xvf test.tar
Note: I tried to prepare macro in src/common.h rather then fixing it
directly in src/tar.c, because I'd like to reuse this macro later on (if
possible) in extended attributes proposal.
Pavel
diff --git a/src/common.h b/src/common.h
index c51ab11..54f6749 100644
--- a/src/common.h
+++ b/src/common.h
@@ -91,6 +91,11 @@ enum subcommand
GLOBAL enum subcommand subcommand_option;
+#define READ_LIKE_SUBCOMMAND \
+ (subcommand_option == EXTRACT_SUBCOMMAND \
+ || subcommand_option == DIFF_SUBCOMMAND \
+ || subcommand_option == LIST_SUBCOMMAND)
+
/* Selected format for output archive. */
GLOBAL enum archive_format archive_format;
diff --git a/src/tar.c b/src/tar.c
index 8c4f656..ccce615 100644
--- a/src/tar.c
+++ b/src/tar.c
@@ -2527,9 +2527,7 @@ decode_options (int argc, char **argv)
--gray */
if (args.pax_option
&& archive_format != POSIX_FORMAT
- && (subcommand_option != EXTRACT_SUBCOMMAND
- || subcommand_option != DIFF_SUBCOMMAND
- || subcommand_option != LIST_SUBCOMMAND))
+ && !READ_LIKE_SUBCOMMAND)
USAGE_ERROR ((0, 0, _("--pax-option can be used only on POSIX archives")));
/* If ready to unlink hierarchies, so we are for simpler files. */