Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

import/export-tar: support xattrs, ACLs and such via PAX format #2521

Open
enkore opened this issue May 16, 2017 · 6 comments
Open

import/export-tar: support xattrs, ACLs and such via PAX format #2521

enkore opened this issue May 16, 2017 · 6 comments

Comments

@enkore
Copy link
Contributor

enkore commented May 16, 2017

PAX/POSIX format basically means one gets to put arbitrary key/value parts into file metadata in a backwards-compatible fashion.

GNU tar supports a proprietary extension for xattrs, apparently invented by Jörg Schilling: Just put them into the SCHILY.xattr.<xattr>key. (Source: GNU tar 1.29 source, file src/xheader.c, xhdr_tab)

https://www.gnu.org/software/tar/manual/html_node/Extended-File-Attributes.html

@ThomasWaldmann
Copy link
Member

ThomasWaldmann commented Jan 25, 2021

@ThomasWaldmann
Copy link
Member

ThomasWaldmann commented Apr 2, 2022

update from #5830: PAX format support is now basically present.

@ThomasWaldmann ThomasWaldmann changed the title export-tar: support xattrs and such via PAX format import/export-tar: support xattrs and such via PAX format Apr 2, 2022
@ThomasWaldmann ThomasWaldmann changed the title import/export-tar: support xattrs and such via PAX format import/export-tar: support xattrs, ACLs and such via PAX format Sep 21, 2024
@borgbackup borgbackup deleted a comment from enkore Sep 21, 2024
@ThomasWaldmann
Copy link
Member

ThomasWaldmann commented Sep 21, 2024

Borg contributors could help with this, implementing this does not need too much knowledge of borg internals.

How this could be improved:

  • implement SCHILY-style xattrs in import-tar (search for "PAX" in the borg source)
  • do roundtrip testing, e.g. GNU tar c -> borg import-tar -> borg extract
  • implement SCHILY-style xattrs in export-tar
  • do roundtrip testing, e.g. GNU tar c -> borg import-tar -> borg export-tar -> GNU tar x
  • automate the roundtrip testing in our testsuite (we already use tar elsewhere in the tests)
  • after xattrs are done and merged into master, work on ACLs.

@ThomasWaldmann
Copy link
Member

Note: I didn't find clear docs about how the xattr keys and values need to be encoded. There is not just the "simple ascii text" case, but theoretically there could be also binary values or keys with "problematic" chars.

Thus, solving this likely needs some digging into gnu tar or star C sources to find out how exactly this needs to get done.

@ThomasWaldmann
Copy link
Member

ThomasWaldmann commented Oct 8, 2024

Found something: https://github.com/python/cpython/blob/3.9/Lib/tarfile.py#L1176

That tarfile code expects:

  • keys to be str and encodable to utf-8
  • values to be str and encodable to utf-8 or using "surrogateescape"

@ThomasWaldmann ThomasWaldmann self-assigned this Oct 8, 2024
ThomasWaldmann added a commit to ThomasWaldmann/borg that referenced this issue Oct 8, 2024
ThomasWaldmann added a commit to ThomasWaldmann/borg that referenced this issue Oct 8, 2024
ThomasWaldmann added a commit to ThomasWaldmann/borg that referenced this issue Oct 8, 2024
ThomasWaldmann added a commit to ThomasWaldmann/borg that referenced this issue Oct 8, 2024
ThomasWaldmann added a commit to ThomasWaldmann/borg that referenced this issue Oct 8, 2024
ThomasWaldmann added a commit to ThomasWaldmann/borg that referenced this issue Oct 8, 2024
@ThomasWaldmann
Copy link
Member

ThomasWaldmann commented Oct 8, 2024

xattrs are done, #8467.

ACLs still todo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants