On 6/8/22 20:31, mg wrote:
# Note: There is a typo in the online HTML manual; missing f after -c

Thanks for reporting that. I fixed it by installing the attached patch.

mkdir t &&
     cd t &&
     echo foo > bar &&
     sudo chattr +i bar &&
     echo Can make bar immutable &&
     lsattr &&
     # sudo tar cf j.tar --xattrs --xattrs-include=user.* bar &&
     sudo tar --xattrs -cf j.tar bar &&
     mkdir t1 &&
     cd t1 &&
     echo "Cannot restore. Try 4 ways." &&
     sudo tar xf ../j.tar --xattrs --xattrs-include=user.* &&
     lsattr &&
     sudo tar xf ../j.tar --xattrs-include=user.* &&
     lsattr &&
     sudo tar xf ../j.tar --xattrs &&
     lsattr &&
     sudo tar xf ../j.tar &&
     lsattr

I don't have easy access to a file system that supports attributes, so the above is a bit cryptic to me. Perhaps you can help by running this command:

   sudo env LC_ALL=C strace -o /tmp/tar.trace tar xf ../j.tar --xattrs

and seeing which system calls fail in the trace. If it's not too large, please gzip -9 /tmp/tar.trace and email it as an attachment.

As a general comment, I will note that if I do backup (-c) and restore (-x), I 
would expect there would be no differences. Why wouldn't you make that strategy 
the default?

There is an argument for the current default: when you unpack a random tarball from someone you don't know, you don't get files with weird attributes. At this point it might be a bit late to change the default as people are most likely depending on it.
From 4eb9d052b21eea93d9030f1d34416af68a1f14f0 Mon Sep 17 00:00:00 2001
From: Paul Eggert <egg...@cs.ucla.edu>
Date: Sun, 12 Jun 2022 20:33:09 -0700
Subject: [PATCH] Fix doc -c typo

https://lists.gnu.org/r/bug-tar/2022-06/msg00006.html
* doc/tar.texi (Extended File Attributes): Fix typo.
---
 doc/tar.texi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/tar.texi b/doc/tar.texi
index 95de6328..dd565448 100644
--- a/doc/tar.texi
+++ b/doc/tar.texi
@@ -5667,7 +5667,7 @@ Here, the @var{pattern} is a globbing pattern.  For example, the
 following command:
 
 @example
-$ @kbd{tar --xattrs --xattrs-exclude='user.*' -c a.tar .}
+$ @kbd{tar --xattrs --xattrs-exclude='user.*' -cf a.tar .}
 @end example
 
 will include in the archive @file{a.tar} all attributes, except those
-- 
2.34.1

Reply via email to