illumos/Solaris: do not open device nodes to get their xattrs - #10468
Merged
ThomasWaldmann merged 1 commit intoSep 29, 2026
Merged
Conversation
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 Report❌ Patch coverage is
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:ENXIOif there is no such device,illumos has no
O_PATHto avoid this, so device nodes are now treated as not supporting extended attributes:_open_attrdir()checks the file type first and raisesENOTSUPfor block/char devices without opening them, whichxattr.get_all()already handles as "no xattrs".Found when running the test suite as root on OmniOS r151058: the archiver tests create
input/bdevandinput/cdevwith device numbers that have no driver, soborg creategotENXIOfrom the xattr code, retried each of them for ~15s and then finished with rc 104 (10 failures increate_cmd_test.py:test_basic_functionality,test_create_tags,test_create_archivename_with_placeholder,test_common_options,test_log_json, each forarchiverandremote_archiver).Testing (OmniOS r151058, Python 3.13, as root):
test_device_node_is_not_opened(block + char device) fails with errno 6 (ENXIO) without the fix, passes with it.🤖 Generated with Claude Code