From 1f9776901b86b97bbb9c16dd814aeab27eea0e25 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Wed, 23 Oct 2024 11:34:49 -0400 Subject: tests/posix: Add a test for overly aggressive -exec {} + matching Link: https://savannah.gnu.org/bugs/?66365 --- tests/posix/exec_substring_plus.out | 19 +++++++++++++++++++ tests/posix/exec_substring_plus.sh | 14 ++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 tests/posix/exec_substring_plus.out create mode 100644 tests/posix/exec_substring_plus.sh (limited to 'tests') diff --git a/tests/posix/exec_substring_plus.out b/tests/posix/exec_substring_plus.out new file mode 100644 index 0000000..a7ccfe4 --- /dev/null +++ b/tests/posix/exec_substring_plus.out @@ -0,0 +1,19 @@ +basic +basic/a +basic/b +basic/c +basic/c/d +basic/e +basic/e/f +basic/g +basic/g/h +basic/i +basic/j +basic/j/foo +basic/k +basic/k/foo +basic/k/foo/bar +basic/l +basic/l/foo +basic/l/foo/bar +basic/l/foo/bar/baz diff --git a/tests/posix/exec_substring_plus.sh b/tests/posix/exec_substring_plus.sh new file mode 100644 index 0000000..90309b0 --- /dev/null +++ b/tests/posix/exec_substring_plus.sh @@ -0,0 +1,14 @@ +# https://pubs.opengroup.org/onlinepubs/9799919799/utilities/find.html +# +# Only a that immediately follows an argument containing only +# the two characters "{}" shall punctuate the end of the primary expression. +# Other uses of the shall not be treated as special. +# ... +# If a utility_name or argument string contains the two characters "{}", but +# not just the two characters "{}", it is implementation-defined whether +# find replaces those two characters or uses the string without change. + +invoke_bfs basic -exec printf '%s %s %s %s\n' {} {}+ +{} + \; | sed 's/ .*//' >"$OUT" +sort_output +diff_output + -- cgit v1.2.3