diff options
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | docs/CHANGELOG.md | 12 | ||||
-rw-r--r-- | src/bfstd.c | 2 | ||||
-rw-r--r-- | src/eval.c | 7 | ||||
-rw-r--r-- | tests/gnu/L_loops_continue.out | 1 | ||||
-rw-r--r-- | tests/gnu/ignore_readdir_race_loop.out | 1 | ||||
-rw-r--r-- | tests/gnu/xtype_l_loops.out | 3 | ||||
-rw-r--r-- | tests/gnu/xtype_l_loops.sh | 1 |
8 files changed, 25 insertions, 4 deletions
@@ -74,7 +74,7 @@ gen/version.c.new:: elif test -e src/../.git && command -v git >/dev/null 2>&1; then \ git -C src/.. describe --always --dirty; \ else \ - echo "3.3"; \ + echo "3.3.1"; \ fi | tr -d '\n' >>$@ @printf '";\n' >>$@ diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 1d4bdcf..db978b8 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,6 +1,18 @@ 3.* === +3.3.1 +----- + +**June 3, 2024** + +### Bug fixes + +- Reduced the scope of the symbolic link loop change in version 3.3. + `-xtype l` remains true for symbolic link loops, matching a change in GNU findutils 4.10.0. + However, `-L` will report an error, just like `bfs` prior to 3.3 and other `find` implementations, as required by POSIX. + + 3.3 --- diff --git a/src/bfstd.c b/src/bfstd.c index 1c5e289..44eda7c 100644 --- a/src/bfstd.c +++ b/src/bfstd.c @@ -44,7 +44,7 @@ bool error_is_like(int error, int category) { switch (category) { case ENOENT: - return error == ENOTDIR || error == ELOOP; + return error == ENOTDIR; case ENOSYS: // https://github.com/opencontainers/runc/issues/2151 @@ -999,6 +999,13 @@ bool eval_xtype(const struct bfs_expr *expr, struct bfs_eval *state) { const struct BFTW *ftwbuf = state->ftwbuf; enum bfs_stat_flags flags = ftwbuf->stat_flags ^ (BFS_STAT_NOFOLLOW | BFS_STAT_TRYFOLLOW); enum bfs_type type = bftw_type(ftwbuf, flags); + + // GNU find treats ELOOP as a broken symbolic link for -xtype l + // (but not -L -type l) + if ((flags & BFS_STAT_TRYFOLLOW) && type == BFS_ERROR && errno == ELOOP) { + type = BFS_LNK; + } + if (type == BFS_ERROR) { eval_report_error(state); return false; diff --git a/tests/gnu/L_loops_continue.out b/tests/gnu/L_loops_continue.out index faf33d3..a514555 100644 --- a/tests/gnu/L_loops_continue.out +++ b/tests/gnu/L_loops_continue.out @@ -4,7 +4,6 @@ loops/deeply loops/deeply/nested loops/deeply/nested/dir loops/file -loops/loop loops/notdir loops/skip loops/skip/dir diff --git a/tests/gnu/ignore_readdir_race_loop.out b/tests/gnu/ignore_readdir_race_loop.out index faf33d3..a514555 100644 --- a/tests/gnu/ignore_readdir_race_loop.out +++ b/tests/gnu/ignore_readdir_race_loop.out @@ -4,7 +4,6 @@ loops/deeply loops/deeply/nested loops/deeply/nested/dir loops/file -loops/loop loops/notdir loops/skip loops/skip/dir diff --git a/tests/gnu/xtype_l_loops.out b/tests/gnu/xtype_l_loops.out new file mode 100644 index 0000000..fdaccab --- /dev/null +++ b/tests/gnu/xtype_l_loops.out @@ -0,0 +1,3 @@ +loops/broken +loops/loop +loops/notdir diff --git a/tests/gnu/xtype_l_loops.sh b/tests/gnu/xtype_l_loops.sh new file mode 100644 index 0000000..6893134 --- /dev/null +++ b/tests/gnu/xtype_l_loops.sh @@ -0,0 +1 @@ +bfs_diff loops -xtype l |