From 7152645618fc22766f5c954d12e9489866633e26 Mon Sep 17 00:00:00 2001 From: Jody Frankowski Date: Thu, 31 Oct 2024 13:13:20 +0100 Subject: color: Handle bfs_check_capabilities error code (-1) in cpath_has_capabilities 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: 1520d4d3 ("color: Don't color files like directories on ENOTDIR") --- tests/bfs/color_ca.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 tests/bfs/color_ca.sh (limited to 'tests/bfs/color_ca.sh') diff --git a/tests/bfs/color_ca.sh b/tests/bfs/color_ca.sh new file mode 100644 index 0000000..3aaaaf1 --- /dev/null +++ b/tests/bfs/color_ca.sh @@ -0,0 +1,10 @@ +test "$UNAME" = "Linux" || skip +invoke_bfs . -quit -capable || skip + +cd "$TEST" + +"$XTOUCH" normal capable +bfs_sudo setcap all+ep capable || skip +ln -s capable link + +LS_COLORS="ca=30;41:" bfs_diff . -color -- cgit v1.2.3