Page MenuHomeFreeBSD

getfacl: implement --skip-base (-s)
ClosedPublic

Authored by kevans on Jun 19 2023, 5:48 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Oct 19, 6:35 AM
Unknown Object (File)
Sun, Oct 19, 1:35 AM
Unknown Object (File)
Sat, Oct 18, 1:34 AM
Unknown Object (File)
Fri, Oct 3, 7:06 AM
Unknown Object (File)
Sep 21 2025, 6:13 PM
Unknown Object (File)
Sep 21 2025, 1:32 PM
Unknown Object (File)
Sep 9 2025, 3:16 PM
Unknown Object (File)
Aug 24 2025, 11:23 AM
Subscribers

Details

Summary

This skips files that only have a trivial ACL, which is useful for
callers that want to examine files with more unique ACLs.

While we're here, don't issue the file name/ownership header if we're
just going to error out on the file; this adds extra noise for little
gain.

Sponsored by: Klara, Inc.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

bin/getfacl/getfacl.c
136

Why clear errno here?

151

Perhaps warn or exit if acl_is_trivial_np() fails?

bin/getfacl/getfacl.c
136

I hadn't done any due diligence here, this is just moved from old line 147... that said, I'm not sure I see anything that should really be affected if we just didn't.

olce added inline comments.
bin/getfacl/getfacl.c
151

I concur.

That said, acl_is_trivial_np() can fail only on an unknown ACL type or on out of memory (only for NFSv4 ACLs). Assuming there is no bug, only the second could occur in practice, and in this case it may be best to warn but also continue to output ACLs.

Exiting with a message, e.g., indicating one to run getfacl again without -s, would work interactively. On the other hand, scripts gathering state at a given time would have to explicitly cope with this condition (e.g., getfacl -s <paths> || getfact <paths>).

So I have a slight bias in favor of a warning and continuing to print ACLs even if not trivial.

Thanks.

kevans marked 3 inline comments as done.
  • Stop resetting errno
  • Warn if acl_is_trivial_np failed (likely out of memory?), but proceed with both this ACL (err on the side of caution since we don't know if it's trivial) and following ACLs

This also plugs one leak of acl in this new code, but there's notably at least
one more in a later failure path.

This revision is now accepted and ready to land.Jun 23 2023, 12:36 PM
This revision was automatically updated to reflect the committed changes.