Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bfs coloring all files as if they had a capability, on non-Linux systems #146

Merged

Conversation

jody-frankowski
Copy link
Contributor

On non-Linux systems, bfs_check_capabilities always returned -1, so cpath_has_capabilities would always return true. If bfs was called with an LS_COLORS containing the ca statement, e.g. ca=30;41, bfs would color ALL the files.
While including the ca statement in LS_COLORS on non-Linux systems is unusual, this is not an error and is a valid use-case (e.g. Using GNU ls or lsd).

Tested on macOS, and on Linux with files with or without capabilities.

…abilities

On non-Linux systems, bfs_check_capabilities always returned -1, so
cpath_has_capabilities would always return true. If bfs was called with
an LS_COLORS containing the `ca` statement, e.g. `ca=30;41`, bfs would
color ALL the files.  While including the `ca` statement in LS_COLORS
on non-Linux systems is unusual, this is not an error and is a valid
use-case (e.g. Using GNU ls or lsd).

Fixes: 1520d4d ("color: Don't color files like directories on ENOTDIR")
@tavianator
Copy link
Owner

Whoops, good catch! I'm embarrassed I didn't have any test cases for this. I added some to your commit and tweaked it a bit. Thanks for the quick fix!

@tavianator tavianator merged commit e831a39 into tavianator:main Oct 31, 2024
9 checks passed
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.

2 participants