From a662fda2642e17478bc8e78adb4c6642a8505cdb Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Tue, 1 Apr 2025 06:50:26 -0400 Subject: parse: Only process the last -files0-from GNU find intentionally makes later -files0-from options override earlier ones, for symmetry with similar features like du --files0-from. Change bfs to match. Link: https://savannah.gnu.org/bugs/?66965 --- tests/bfs/files0_from_stdin_twice.sh | 1 - tests/bfs/files0_from_twice.out | 4 --- tests/bfs/files0_from_twice.sh | 3 --- tests/gnu/files0_from_empty.sh | 2 +- tests/gnu/files0_from_file_file.out | 2 ++ tests/gnu/files0_from_file_file.sh | 3 +++ tests/gnu/files0_from_ok.sh | 1 - tests/gnu/files0_from_stdin_ok.sh | 1 + tests/gnu/files0_from_stdin_ok_file.out | 45 +++++++++++++++++++++++++++++++++ tests/gnu/files0_from_stdin_ok_file.sh | 4 +++ tests/gnu/files0_from_stdin_stdin.out | 45 +++++++++++++++++++++++++++++++++ tests/gnu/files0_from_stdin_stdin.sh | 2 ++ tests/gnu/ok_files0_from.sh | 1 - tests/gnu/ok_files0_from_stdin.sh | 1 + tests/gnu/ok_flush.sh | 2 +- 15 files changed, 105 insertions(+), 12 deletions(-) delete mode 100644 tests/bfs/files0_from_stdin_twice.sh delete mode 100644 tests/bfs/files0_from_twice.out delete mode 100644 tests/bfs/files0_from_twice.sh create mode 100644 tests/gnu/files0_from_file_file.out create mode 100644 tests/gnu/files0_from_file_file.sh delete mode 100644 tests/gnu/files0_from_ok.sh create mode 100644 tests/gnu/files0_from_stdin_ok.sh create mode 100644 tests/gnu/files0_from_stdin_ok_file.out create mode 100644 tests/gnu/files0_from_stdin_ok_file.sh create mode 100644 tests/gnu/files0_from_stdin_stdin.out create mode 100644 tests/gnu/files0_from_stdin_stdin.sh delete mode 100644 tests/gnu/ok_files0_from.sh create mode 100644 tests/gnu/ok_files0_from_stdin.sh (limited to 'tests') diff --git a/tests/bfs/files0_from_stdin_twice.sh b/tests/bfs/files0_from_stdin_twice.sh deleted file mode 100644 index 752e9de..0000000 --- a/tests/bfs/files0_from_stdin_twice.sh +++ /dev/null @@ -1 +0,0 @@ -! invoke_bfs -files0-from - -files0-from - "$TEST/in1" -printf 'basic/g\0' >"$TEST/in2" -bfs_diff -files0-from "$TEST/in1" -files0-from "$TEST/in2" diff --git a/tests/gnu/files0_from_empty.sh b/tests/gnu/files0_from_empty.sh index 85eee8f..7b42772 100644 --- a/tests/gnu/files0_from_empty.sh +++ b/tests/gnu/files0_from_empty.sh @@ -1 +1 @@ -! printf "\0" | invoke_bfs -files0-from - +! printf '\0' | invoke_bfs -files0-from - diff --git a/tests/gnu/files0_from_file_file.out b/tests/gnu/files0_from_file_file.out new file mode 100644 index 0000000..fb683c7 --- /dev/null +++ b/tests/gnu/files0_from_file_file.out @@ -0,0 +1,2 @@ +basic/g +basic/g/h diff --git a/tests/gnu/files0_from_file_file.sh b/tests/gnu/files0_from_file_file.sh new file mode 100644 index 0000000..1119952 --- /dev/null +++ b/tests/gnu/files0_from_file_file.sh @@ -0,0 +1,3 @@ +printf 'basic/c\0' >"$TEST/in1" +printf 'basic/g\0' >"$TEST/in2" +bfs_diff -files0-from "$TEST/in1" -files0-from "$TEST/in2" diff --git a/tests/gnu/files0_from_ok.sh b/tests/gnu/files0_from_ok.sh deleted file mode 100644 index 8e145ce..0000000 --- a/tests/gnu/files0_from_ok.sh +++ /dev/null @@ -1 +0,0 @@ -! printf "basic\0" | invoke_bfs -files0-from - -ok echo {} \; diff --git a/tests/gnu/files0_from_stdin_ok.sh b/tests/gnu/files0_from_stdin_ok.sh new file mode 100644 index 0000000..0283c8d --- /dev/null +++ b/tests/gnu/files0_from_stdin_ok.sh @@ -0,0 +1 @@ +! printf 'basic\0' | invoke_bfs -files0-from - -ok echo {} \; diff --git a/tests/gnu/files0_from_stdin_ok_file.out b/tests/gnu/files0_from_stdin_ok_file.out new file mode 100644 index 0000000..0f6b00d --- /dev/null +++ b/tests/gnu/files0_from_stdin_ok_file.out @@ -0,0 +1,45 @@ + + + + + + /j + /j +! +!- +!-/e +!-/e +!/d +!/d +( +(- +(-/c +(-/c +(/b +(/b +) +)/g +)/g +* +*/m +*/m +, +,/f +,/f +- +-/a +-/a +... +.../h +.../h +/n +/n +[ +[/k +[/k +\ +\/i +\/i +{ +{/l +{/l diff --git a/tests/gnu/files0_from_stdin_ok_file.sh b/tests/gnu/files0_from_stdin_ok_file.sh new file mode 100644 index 0000000..028df0c --- /dev/null +++ b/tests/gnu/files0_from_stdin_ok_file.sh @@ -0,0 +1,4 @@ +FILE="$TMP/$TEST.in" +cd weirdnames +invoke_bfs -mindepth 1 -fprintf "$FILE" "%P\0" +yes | bfs_diff -files0-from - -ok printf '%s\n' {} \; -files0-from "$FILE" diff --git a/tests/gnu/files0_from_stdin_stdin.out b/tests/gnu/files0_from_stdin_stdin.out new file mode 100644 index 0000000..0f6b00d --- /dev/null +++ b/tests/gnu/files0_from_stdin_stdin.out @@ -0,0 +1,45 @@ + + + + + + /j + /j +! +!- +!-/e +!-/e +!/d +!/d +( +(- +(-/c +(-/c +(/b +(/b +) +)/g +)/g +* +*/m +*/m +, +,/f +,/f +- +-/a +-/a +... +.../h +.../h +/n +/n +[ +[/k +[/k +\ +\/i +\/i +{ +{/l +{/l diff --git a/tests/gnu/files0_from_stdin_stdin.sh b/tests/gnu/files0_from_stdin_stdin.sh new file mode 100644 index 0000000..8f6368f --- /dev/null +++ b/tests/gnu/files0_from_stdin_stdin.sh @@ -0,0 +1,2 @@ +cd weirdnames +invoke_bfs -mindepth 1 -printf "%P\0" | bfs_diff -files0-from - -files0-from - diff --git a/tests/gnu/ok_files0_from.sh b/tests/gnu/ok_files0_from.sh deleted file mode 100644 index 0e2818b..0000000 --- a/tests/gnu/ok_files0_from.sh +++ /dev/null @@ -1 +0,0 @@ -! printf "basic\0" | invoke_bfs -ok echo {} \; -files0-from - diff --git a/tests/gnu/ok_files0_from_stdin.sh b/tests/gnu/ok_files0_from_stdin.sh new file mode 100644 index 0000000..2c4de7b --- /dev/null +++ b/tests/gnu/ok_files0_from_stdin.sh @@ -0,0 +1 @@ +! printf 'basic\0' | invoke_bfs -ok echo {} \; -files0-from - diff --git a/tests/gnu/ok_flush.sh b/tests/gnu/ok_flush.sh index 87c7298..a5dc0d0 100644 --- a/tests/gnu/ok_flush.sh +++ b/tests/gnu/ok_flush.sh @@ -1,4 +1,4 @@ # I/O streams should be flushed before -ok prompts -yes | invoke_bfs basic -printf '%p ? ' -ok echo found \; 2>&1 | tr '\0' ' ' | sed 's/?.*?/?/' >"$OUT" +yes | invoke_bfs basic -printf '%p ? ' -ok echo found \; 2>&1 | sed 's/?.*?/?/' >"$OUT" sort_output diff_output -- cgit v1.2.3