fix(ls): ensure ACL and capability markers respect dereference config#13368
Open
sachinskss wants to merge 1 commit into
Open
fix(ls): ensure ACL and capability markers respect dereference config#13368sachinskss wants to merge 1 commit into
sachinskss wants to merge 1 commit into
Conversation
Author
|
Fixes #13234 |
1 similar comment
Author
|
Fixes #13234 |
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.
The bug stems from ACL and capability detection always probing the target of a symlink, even when
lsis intentionally displaying the link itself (e.g.,ls -ld). This PR ensures that extended attribute checks respect the same dereference configuration thatlsuses for the rest of its display logic.##Changes
uucore/src/lib/fsxattr.rs: Added dereference-aware ACL and capability helper variants (has_acl_link,has_capabilities_link) to query files without following symbolic links.src/uu/ls/src/display.rs: Updated the long-format ACL indicator and column padding calculation to switch behavior based on the current item’s dereference state.src/uu/ls/src/colors.rs: Updated capability-based file coloring to follow the exact same dereference rules, preventing symlinks from incorrectly inheriting the color profile of their targets.tests/by_program/test_ls.rs: Added a comprehensive regression test replicating thels -dl <link>edge case to prevent future regressions.##Verifications
ls.cargo test --test tests test_ls.