From b89f22cbf250958a802915eb7b6bf0e5f38376ca Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Sun, 13 Oct 2024 20:42:58 -0400 Subject: color: Fix an infinite loop colorizing some invalid paths Previously, given $ touch file $ ln -s file/file notdir $ bfs notdir/file bfs would loop forever when printing the error message, since it expected stripping the trailing slash from "notdir/" to fix the ENOTDIR error, but the broken symlink still gave the same error. Fixes: b4c3201 ("color: Only highlight the trailing slash on ENOTDIR") --- tests/bfs/color_notdir_slash_error.out | 0 tests/bfs/color_notdir_slash_error.sh | 2 ++ 2 files changed, 2 insertions(+) create mode 100644 tests/bfs/color_notdir_slash_error.out create mode 100644 tests/bfs/color_notdir_slash_error.sh (limited to 'tests/bfs') diff --git a/tests/bfs/color_notdir_slash_error.out b/tests/bfs/color_notdir_slash_error.out new file mode 100644 index 0000000..e69de29 diff --git a/tests/bfs/color_notdir_slash_error.sh b/tests/bfs/color_notdir_slash_error.sh new file mode 100644 index 0000000..ca26d50 --- /dev/null +++ b/tests/bfs/color_notdir_slash_error.sh @@ -0,0 +1,2 @@ +# Regression test: infinite loop printing the error message for .../notdir/nowhere +! bfs_diff -color links/notdir/nowhere -- cgit v1.2.3