bugGNU tar - Bugs: bug #59184, GNU tar fails to extract read-only...

 
 

bug #59184: GNU tar fails to extract read-only files with --xattrs unless run as root

Submitter:  Dennis Filder <dfilder>
Submitted:  Sat 26 Sep 2020 02:17:55 PM UTC
Votes: 50
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  None
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 29 Aug 2023 04:40:20 PM UTC, comment #2: 
Sergey Poznyakoff <gray>
Group administrator
Sun 21 Nov 2021 10:24:50 AM UTC, comment #1: 


original submission:

> Version: 1.32
>
> == Description ==
>
> I tried extracting an archive with read-only files that had extended attributes, and it failed.  The bug is present in 1.32, but also 1.30 (Debian Buster), and I faintly recall running into this a few years ago, so it was probably not recently introduced.
>
> == Reproducer ==
>


> mkdir foo
> echo bar > foo/bar
> setfattr -n user.description -v bar foo/bar
> chmod a-w foo/bar
> tar --xattrs -cf foo.tar foo
> mv foo foo-orig
> tar --xattrs -xf foo.tar # fails
> tar: setxattrat: Cannot set 'user.description' extended attribute for file 'foo/bar': Permission denied
> tar: foo/bar: Cannot open: Permission denied
> tar: Exiting with failure status due to previous errors
> tar -xf foo.tar # without --xattrs it works, but discards the xattrs


>
> == Workaround ==
>


> find foo -printf 'chmod %m %p\n' > foo/restore-perms.sh
> tar --xattrs --mode=u+w -cf foo.tar foo
> ...
> tar --xattrs -xf foo.tar
> source foo/restore-perms.sh
> rm foo/restore-perms.sh


>
> Let me know how I can help with this any further.

Anonymous
Sat 26 Sep 2020 02:17:55 PM UTC, original submission:  

Version: 1.32

Description


I tried extracting an archive with read-only files that had extended attributes, and it failed.  The bug is present in 1.32, but also 1.30 (Debian Buster), and I faintly recall running into this a few years ago, so it was probably not recently introduced.

Reproducer



mkdir foo
echo bar > foo/bar
setfattr -n user.description -v bar foo/bar
chmod a-w foo/bar
tar --xattrs -cf foo.tar foo
mv foo foo-orig
tar --xattrs -xf foo.tar # fails
tar: setxattrat: Cannot set 'user.description' extended attribute for file 'foo/bar': Permission denied
tar: foo/bar: Cannot open: Permission denied
tar: Exiting with failure status due to previous errors
tar -xf foo.tar # without --xattrs it works, but discards the xattrs


Workaround



find foo -printf 'chmod %m %p\n' > foo/restore-perms.sh
tar --xattrs --mode=u+w -cf foo.tar foo
...
tar --xattrs -xf foo.tar
source foo/restore-perms.sh
rm foo/restore-perms.sh


Let me know how I can help with this any further.

Dennis Filder <dfilder>

 

(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 gray (Posted a comment)
  • -email is unavailable- added by wmanley (Voted in favor of this item)
  • -email is unavailable- added by dfilder (Submitted the item)
  •  

    There are 50 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.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-08-29 gray StatusNone Fixed
        Open/ClosedOpen Closed
    2020-10-19 wmanley Carbon-Copy- Added wmanley

    Back to the top

    Powered by Savane 3.12.
    Corresponding source code