summaryrefslogtreecommitdiff
path: root/tar
diff options
context:
space:
mode:
authorEmil Velikov <emil.l.velikov@gmail.com>2021-11-21 18:05:19 +0000
committerEmil Velikov <emil.l.velikov@gmail.com>2021-11-21 18:40:47 +0000
commit29fd0178a8861af36ab60407cd718b3f262dda15 (patch)
tree4e7a8f543e10d57139f0aea6310e27fc3c6a6fd2 /tar
parent4f598ce28aa370e945103eb9a17f03c7c820c1e8 (diff)
downloadlibarchive-29fd0178a8861af36ab60407cd718b3f262dda15.tar.gz
tar: demote -xa from error to a warning
It's fairly common for people to use caf and xaf on Linux. The former in itself being GNU tar specific - libarchive tar does not allow xa. While it makes little sense to use xaf with libarchive tar, that is implementation detail which gets in the way when trying to write trivial tooling/scripts. For the sake of compatibility, reduce the error to a warning and augment the message itself. Making it clear that the option makes little sense. Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Diffstat (limited to 'tar')
-rw-r--r--tar/bsdtar.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/tar/bsdtar.c b/tar/bsdtar.c
index df0930ae..8a88f882 100644
--- a/tar/bsdtar.c
+++ b/tar/bsdtar.c
@@ -804,8 +804,14 @@ main(int argc, char **argv)
"Must specify one of -c, -r, -t, -u, -x");
/* Check boolean options only permitted in certain modes. */
- if (bsdtar->flags & OPTFLAG_AUTO_COMPRESS)
- only_mode(bsdtar, "-a", "c");
+ if (bsdtar->flags & OPTFLAG_AUTO_COMPRESS) {
+ only_mode(bsdtar, "-a", "cx");
+ if (bsdtar->mode == 'x') {
+ bsdtar->flags &= ~OPTFLAG_AUTO_COMPRESS;
+ lafe_warnc(0,
+ "Ignoring option -a in mode -x");
+ }
+ }
if (bsdtar->readdisk_flags & ARCHIVE_READDISK_NO_TRAVERSE_MOUNTS)
only_mode(bsdtar, "--one-file-system", "cru");
if (bsdtar->flags & OPTFLAG_FAST_READ)