Skip to content

import-tar: import Solaris tar extended attributes - #10147

Draft
ThomasWaldmann wants to merge 1 commit into
borgbackup:masterfrom
ThomasWaldmann:import-tar-solaris-ea-8479
Draft

import-tar: import Solaris tar extended attributes#10147
ThomasWaldmann wants to merge 1 commit into
borgbackup:masterfrom
ThomasWaldmann:import-tar-solaris-ea-8479

Conversation

@ThomasWaldmann

Copy link
Copy Markdown
Member

Fixes #8479.

Solaris/illumos tar and pax always archive extended attributes as pairs of type E members — a header member (Solaris xattr_hdr format: parent file path, attribute name) followed by a value member — regardless of the selected archive format, so importing any Solaris tar with EAs produced a warning per member ("Unsupported tarinfo type b'E'") and rc 1.

import-tar now parses these members and stores them as xattrs of the parent item, consistent with how borg create archives extended attributes on those platforms since #10102 (names used verbatim, SUNWattr_* system attributes excluded, 16 MiB value limit) — so a Solaris tar → borg → extract-on-Solaris round trip restores the EAs.

Implementation notes:

  • A parent's xattr members trail the parent member — for directories, only after the directory's whole subtree (verified against illumos tar.c putfile()/xattrs_put() and the sample archives from the issue). Since items become immutable once added, item storage is deferred with a pending stack: a directory stays pending while members inside it are processed, any other item only until the next item arrives, so memory use is bounded by directory nesting depth. As a consequence, a directory item is now stored after its subtree; extract, FUSE and diff handle that fine (extract defers directory attribute application anyway).
  • The value-member lookahead hands a consumed non-xattr member back for normal dispatching, so a mispaired header cannot drop a real member, and a lone header at the end of the tar is handled cleanly.
  • Not imported, each summarized in one warning at the end instead of per-member warnings: type E members of other origins (e.g. IBM i pax, which uses an incompatible proprietary payload), hard-linked attributes, attributes of attributes, oversized values and unsafe parent paths. The generic unknown-member-type warning is aggregated the same way.

Verified against the real archives from the issue: both Solaris samples import warning-free with all user EAs attached (binary values byte-exact, incl. the EAs of a directory whose pairs arrive after its subtree); the IBM i sample imports its items with a single summarizing warning and rc 1.

🤖 Generated with Claude Code

…8479

Solaris/illumos tar and pax archive extended attributes as pairs of
type E members (a header giving parent path and attribute name, then
the value), regardless of the selected archive format. Parse these
and store them as xattrs of the parent item, consistent with how
borg create archives extended attributes on those platforms (names
verbatim, SUNWattr_* system attributes excluded, 16 MiB value limit).

A parent's xattr members trail the parent member - for directories,
its whole subtree - so item storage is deferred via a pending stack
bounded by directory nesting depth. As a consequence, a directory
item is now stored after its subtree.

Type E members of other origins (e.g. IBM i pax), hard-linked
attributes, attributes of attributes, oversized values and unsafe
parent paths are skipped, summarized in one warning per reason
instead of the previous per-member warning spam.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@codecov

codecov Bot commented Aug 18, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.79279% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.01%. Comparing base (9547a53) to head (0a663a2).
⚠️ Report is 33 commits behind head on master.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/borg/archiver/tar_cmds.py 92.79% 3 Missing and 5 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #10147      +/-   ##
==========================================
+ Coverage   86.94%   87.01%   +0.06%     
==========================================
  Files         101      101              
  Lines       17984    18093     +109     
  Branches     2737     2762      +25     
==========================================
+ Hits        15637    15743     +106     
- Misses       1638     1640       +2     
- Partials      709      710       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@ThomasWaldmann
ThomasWaldmann marked this pull request as draft August 18, 2026 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Borg2 complains about extended attributes, when importing Solaris TAR archives

1 participant