bugGNU tar - Bugs: bug #65397, GNU tar can't preserve file...

 
 

bug #65397: GNU tar can't preserve file immutable attribute set by "chattr +i" in Linux

Submitter:  dashing meng <littlebat>
Submitted:  Sat 02 Mar 2024 08:05:23 AM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 03 Mar 2024 01:53:59 AM UTC, comment #1: 

It seems not activated in this bug report site, so I post same report onto bug-tar@gnu.org. If this post is a bad duplicated one, please delete it.

dashing meng <littlebat>
Sat 02 Mar 2024 08:05:23 AM UTC, original submission:  

Kernel 5.15.* Linux, tested both ext4 and btrfs.

I want use tar(GNU tar 1.30) to backup files with immutable attribute set by "chattr +i" in Linux. Command lines below:

mdx@e5450:~$ touch test.txt
mdx@e5450:~$ sudo chattr +i test.txt
mdx@e5450:~$ lsattr test.txt
----i---------e---- test.txt
mdx@e5450:~$ sudo tar --acls --selinux --xattrs --xattrs-include='*' -cpvvzf test.tar.gz test.txt
-rw-r--r--  mdx/mdx           0 2024-03-01 16:30 test.txt
mdx@e5450:~$ mkdir test
mdx@e5450:~$ sudo tar --acls --selinux --xattrs --xattrs-include='*' -xpvvzf test.tar.gz -C test
-rw-r--r--  mdx/mdx           0 2024-03-01 16:30 test.txt
mdx@e5450:~$ lsattr test/test.txt
--------------e---- test/test.txt
mdx@e5450:~$


You see, the immutable attribute is gone after extracting.


I can use bsdtar 3.3.3 archive test.txt, the immutable attribute will be preserved. Detail below:

mdx@e5450:~$ sudo bsdtar -cvvzf test.btar.gz test.txt
a -rw-r--r--  1 mdx    mdx         0 Mar  1 16:30 test.txt
mdx@e5450:~$ mkdir btest
mdx@e5450:~$ sudo bsdtar -xvvzf test.btar.gz -C btest
x -rw-r--r--  0 mdx    mdx         0 Mar  1 16:30 test.txt
mdx@e5450:~$ lsattr btest/test.txt
----i---------e---- btest/test.txt

Is it possible preserve file immutable attribute set by "chattr +i" when using GNU tar in Linux? Or add this function into GNU tar?

dashing meng <littlebat>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by littlebat (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    No changes have been made to this item

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code