Skip to content

illumos/Solaris: do not open device nodes to get their xattrs - #10468

Merged
ThomasWaldmann merged 1 commit into
borgbackup:masterfrom
ThomasWaldmann:solaris-xattr-devices
Sep 29, 2026
Merged

ThomasWaldmann merged 1 commit into
borgbackup:masterfrom
ThomasWaldmann:solaris-xattr-devices

Conversation

@ThomasWaldmann

Copy link
Copy Markdown
Member

On illumos/Solaris, the extended attributes of a file live in a hidden attribute directory, which can only be reached via an fd of the file itself (O_XATTR, see fsattr(7)). So _open_attrdir() opened the file first — for a block or character device node, that runs the open routine of the device driver, which might:

  • fail: ENXIO if there is no such device,
  • block,
  • or have side effects (e.g. a tape rewinding on close).

illumos has no O_PATH to avoid this, so device nodes are now treated as not supporting extended attributes: _open_attrdir() checks the file type first and raises ENOTSUP for block/char devices without opening them, which xattr.get_all() already handles as "no xattrs".

Found when running the test suite as root on OmniOS r151058: the archiver tests create input/bdev and input/cdev with device numbers that have no driver, so borg create got ENXIO from the xattr code, retried each of them for ~15s and then finished with rc 104 (10 failures in create_cmd_test.py: test_basic_functionality, test_create_tags, test_create_archivename_with_placeholder, test_common_options, test_log_json, each for archiver and remote_archiver).

Testing (OmniOS r151058, Python 3.13, as root):

  • New test_device_node_is_not_opened (block + char device) fails with errno 6 (ENXIO) without the fix, passes with it.
  • Full test suite with the fix: 3264 passed, 1040 skipped, 0 failed.

🤖 Generated with Claude Code

Reaching the attribute directory of a file requires opening the file.
For a block or character device node, that runs the open routine of
its driver, which might fail (ENXIO if there is no such device, as
for the device nodes created by the archiver tests when run as root),
block or have side effects (e.g. a tape rewinding on close).

Treat device nodes as not supporting extended attributes instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 50.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.71%. Comparing base (4897f70) to head (b03b096).
⚠️ Report is 5 commits behind head on master.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/borg/platform/solaris.py 50.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #10468      +/-   ##
==========================================
- Coverage   88.72%   88.71%   -0.01%     
==========================================
  Files         103      103              
  Lines       19388    19392       +4     
  Branches     3023     3024       +1     
==========================================
+ Hits        17202    17204       +2     
  Misses       1518     1518              
- Partials      668      670       +2     

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

@ThomasWaldmann
ThomasWaldmann merged commit 1c5a3c3 into borgbackup:master Sep 29, 2026
23 of 25 checks passed
@ThomasWaldmann
ThomasWaldmann deleted the solaris-xattr-devices branch September 29, 2026 18:08
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.

1 participant