Menu

#27 Star does not save empty linux extended attributes

1.0
closed
None
2021-07-31
2021-06-17
No

This affects the star archiver in schily-2021-06-07 for Linux.
Star does not save extended attributes when there is no value for the attribute. I consider this to be unexpected behaviour. Extended attributes can be useful as flags, even when there is no value stored in it, just a name. The presence/absence of the attribute itself is used as a flag, but at the moment, the attributes are not restored. I've confirmed that GNU tar stores these empty attributes.

From what I can see, the attribute is saved in the tar file.

I'm using Kernel 5.6.13 (32bit), Fedora 33 and an EXT4 filesystem.

To replicate.
$ echo "test" > testfile
$ setfattr -n user.archived -v "" testfile
$ getfattr -d testfile
file: testfile
user.archived=""

$ star -c -dump -xattr-linux -f test.tar testfile
$ rm testfile
$ star -x -xattr-linux -f test.tar
$ getfattr -d testfile

  • nothing. user.archived is gone.

Also interesting, is that if testfile is of size 0 bytes, the archive extraction process fails with the following message.

star: Numerical result out of range. Cannot setxattr for 'testfile'.
star: 1 blocks + 0 bytes (total of 10240 bytes = 10.00k).
star: The following problems occurred during archive processing:
star: Cannot: stat 0, open 0, read/write 0, chdir 0, iconv 0.
star: Size changed 0.
star: Missing links 0, Name too long 0, File too big 0, Not dumped 0.
star: Cannot get xattr: 0 set xattr: 1.
star: Processed all possible files, despite earlier errors.

If I store a second attribute as well, with a value, that will be restored, but the empty one not.


Discussion

  • Jörg Schilling

    Jörg Schilling - 2021-07-02

    This seems to be a corner case, since on Ubuntu 16.04,

    $ setfattr -n user.archived -v "" testfile

    is without effect, but does not give an error message.

    So I manually created a tar archive with a zeroed linux xattr.

    Please apply the attached patch to xheader.c and retry.

     
  • Jörg Schilling

    Jörg Schilling - 2021-07-02

    Sorry wrong file, here is the correct file.

     
  • Jörg Schilling

    Jörg Schilling - 2021-07-03
    • status: open --> accepted
     
  • Jörg Schilling

    Jörg Schilling - 2021-07-31
    • status: accepted --> closed
     
  • Jörg Schilling

    Jörg Schilling - 2021-07-31

    fixed in schilytools-2021-07-29

     

Log in to post a comment.

MongoDB Logo MongoDB