Skip to content

fix(ls): ensure ACL and capability markers respect dereference config#13368

Open
sachinskss wants to merge 1 commit into
uutils:mainfrom
sachinskss:my-new-fix
Open

fix(ls): ensure ACL and capability markers respect dereference config#13368
sachinskss wants to merge 1 commit into
uutils:mainfrom
sachinskss:my-new-fix

Conversation

@sachinskss

Copy link
Copy Markdown

The bug stems from ACL and capability detection always probing the target of a symlink, even when ls is intentionally displaying the link itself (e.g., ls -ld). This PR ensures that extended attribute checks respect the same dereference configuration that ls uses 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 the ls -dl <link> edge case to prevent future regressions.

##Verifications

  • Verified bug-for-bug compatibility with GNU ls.
  • Ran full test suite via cargo test --test tests test_ls.

@sachinskss

Copy link
Copy Markdown
Author

Fixes #13234

1 similar comment
@sachinskss

Copy link
Copy Markdown
Author

Fixes #13234

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.

ls fails to dereference path for ACL output (showing the referenced path's ACL)

1 participant