Skip to content

ls: show the ACL '+' on macOS - #15344

Merged
sylvestre merged 3 commits into
uutils:mainfrom
ozenyunus35:ls-macos-acl-plus
Oct 15, 2026
Merged

sylvestre merged 3 commits into
uutils:mainfrom
ozenyunus35:ls-macos-acl-plus

Conversation

@ozenyunus35

Copy link
Copy Markdown
Contributor

Fixes #15273

On macOS ls -l hard-coded is_acl_set = false, because has_acl counts xattrs and most macOS files have some (com.apple.provenance), while the ACL itself isn't a listed xattr. has_acl now asks the ACL API on macOS: acl_get_file (or acl_get_link_np without dereference) with ACL_TYPE_EXTENDED, and it reports an ACL only when the first entry exists. The check is enabled in ls for macOS like on Linux/FreeBSD/NetBSD.

This is a per-file check like the other platforms. It doesn't copy GNU's "stop checking after the first file without an ACL on this filesystem" behavior described in the issue.

Tests: a new macOS test in test_ls.rs that sets an ACL with chmod +a and checks + shows up only on that file (it fails without the change). In fsxattr.rs the existing test_file_has_acl now expects an xattr alone not to count on macOS, plus a macOS test with a real ACL. The ls tests (184) and the fsxattr tests pass, and clippy and fmt are clean.

I used an AI assistant to help draft parts of the code and tests; I reviewed the changes and ran the tests myself.

On macOS the ACL isn't stored as a listed xattr, and most files carry some
xattr (e.g. com.apple.provenance), so ls -l hard-coded is_acl_set = false.
Check for an extended ACL with acl_get_file / acl_get_link_np instead and
enable the check on macOS.

Fixes uutils#15273
An xattr alone is no longer reported as an ACL on macOS, so expect false
there, and add a macOS test that sets a real ACL with chmod +a.
@codspeed

codspeed Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Merging this PR will degrade performance by 1.49%

⚠️ 124 benchmarks spent significant time in system calls

System calls cannot be consistently instrumented, so they are not included in the measure, which understates the real cost. Please switch to the Walltime instrument to accurately measure system calls.

Measurement and system calls

ℹ️ 1 benchmark has no flame graph

The flamegraph could not be generated because too much time was spent in runtime internals, making the visualization not useful for performance analysis.

⚡ 1 improved benchmark
❌ 1 regressed benchmark
✅ 399 untouched benchmarks
⏩ 70 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
❌ Simulation factor_five_38_bit_primes 1.6 s 1.8 s -8.82%
⚡ Simulation factor_thirteen_39_bit_primes 9.5 s 8.9 s +6.41%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing ozenyunus35:ls-macos-acl-plus (3642a86) with main (c1565db)

Open in CodSpeed

Footnotes

  1. 70 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

Comment thread src/uucore/src/lib/features/fsxattr.rs Outdated
@@ -258,19 +258,70 @@ pub fn apply_xattrs_fd_ignore_unsupported(
///
/// `true` if the file has extended attributes (indicating an ACL), `false` otherwise.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this doc is no longer true on macOS, could you please update it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated, the doc now says macOS asks the ACL API and other platforms look at the xattrs.

Comment thread src/uucore/src/lib/features/fsxattr.rs Outdated
#[cfg(not(target_os = "macos"))]
assert!(has_acl(&file_path, true));
#[cfg(target_os = "macos")]
assert!(!has_acl(&file_path, true));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could be assert_eq!(has_acl(&file_path, true), cfg!(not(target_os = "macos")));, no?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, changed.

Comment thread tests/by-util/test_ls.rs Outdated
.args(["+a", "everyone allow read", &at.plus_as_string("with_acl")])
.status();
if !status.is_ok_and(|s| s.success()) {
println!("test skipped: chmod +a failed");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

macOS CI supports chmod +a, do we need the skip? i would rather see it fail

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the skip, it now asserts that chmod +a succeeded.

@sylvestre
sylvestre merged commit 0982bd1 into uutils:main Oct 15, 2026
192 of 193 checks passed
@sylvestre

Copy link
Copy Markdown
Contributor

Thanks for your PR

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: -l never shows the ACL '+' on macOS

2 participants