From 6fa72ff42d95dfd883d59ce7cf6bdc74abebf015 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Mon, 26 May 2025 10:35:24 -0400 Subject: tests/posix: Add a test for POSIX bug 1859 ... which requires we process root paths strictly in-order. --- src/bftw.c | 3 ++- tests/posix/root_order.out | 4 ++++ tests/posix/root_order.sh | 6 ++++++ 3 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 tests/posix/root_order.out create mode 100644 tests/posix/root_order.sh diff --git a/src/bftw.c b/src/bftw.c index f822456..6d1475e 100644 --- a/src/bftw.c +++ b/src/bftw.c @@ -1485,7 +1485,8 @@ fail: /** Check if we should stat() a file asynchronously. */ static bool bftw_should_ioq_stat(struct bftw_state *state, struct bftw_file *file) { - // To avoid surprising users too much, process the roots in order + // POSIX wants the root paths to be processed in order + // See https://www.austingroupbugs.net/view.php?id=1859 if (file->depth == 0) { return false; } diff --git a/tests/posix/root_order.out b/tests/posix/root_order.out new file mode 100644 index 0000000..ea94276 --- /dev/null +++ b/tests/posix/root_order.out @@ -0,0 +1,4 @@ +basic/a +basic/b +basic/c/d +basic/e/f diff --git a/tests/posix/root_order.sh b/tests/posix/root_order.sh new file mode 100644 index 0000000..86adf20 --- /dev/null +++ b/tests/posix/root_order.sh @@ -0,0 +1,6 @@ +# Root paths must be processed in order +# https://www.austingroupbugs.net/view.php?id=1859 + +# -size forces a stat(), which we don't want to be async +invoke_bfs basic/{a,b,c/d,e/f} -size -1000 >"$OUT" +diff_output -- cgit v1.2.3