summaryrefslogtreecommitdiffstats
path: root/tests.sh
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2017-07-29 19:10:03 -0400
committerTavian Barnes <tavianator@tavianator.com>2017-07-29 19:10:03 -0400
commitb5ebe959cca84101795ec29022af5fcbcb94ed78 (patch)
tree532d2e799f52d14297d60f3f4543aa40e66c84e7 /tests.sh
parent53612664740f3a31d93d2059f7d981da3ba565dc (diff)
downloadbfs-b5ebe959cca84101795ec29022af5fcbcb94ed78.tar.xz
exec: Don't allow anything between {} and +
POSIX explicitly forbids this extension: > Only a <plus-sign> that immediately follows an argument containing > only the two characters "{}" shall punctuate the end of the primary > expression. Other uses of the <plus-sign> shall not be treated as > special.
Diffstat (limited to 'tests.sh')
-rwxr-xr-xtests.sh58
1 files changed, 31 insertions, 27 deletions
diff --git a/tests.sh b/tests.sh
index 53d7189..dcecb01 100755
--- a/tests.sh
+++ b/tests.sh
@@ -187,6 +187,7 @@ posix_tests=(
test_size_bytes
test_exec
test_exec_plus
+ test_exec_plus_semicolon
test_flag_comma
test_perm_222
test_perm_222_minus
@@ -224,15 +225,15 @@ bsd_tests=(
test_size_big
test_exec_substring
test_execdir_pwd
+ test_execdir_slash
+ test_execdir_slash_pwd
+ test_execdir_slashes
test_double_dash
test_flag_double_dash
test_ok_stdin
test_okdir_stdin
test_delete
test_rm
- test_execdir_slash
- test_execdir_slash_pwd
- test_execdir_slashes
test_regex
test_iregex
test_regex_parens
@@ -301,7 +302,11 @@ gnu_tests=(
test_exec_substring
test_execdir
test_execdir_substring
+ test_execdir_plus_semicolon
test_execdir_pwd
+ test_execdir_slash
+ test_execdir_slash_pwd
+ test_execdir_slashes
test_weird_names
test_flag_weird_names
test_follow_comma
@@ -316,9 +321,6 @@ gnu_tests=(
test_perm_symbolic_slash
test_perm_leading_plus_symbolic_slash
test_delete
- test_execdir_slash
- test_execdir_slash_pwd
- test_execdir_slashes
test_regex
test_iregex
test_regex_parens
@@ -363,9 +365,7 @@ bfs_tests=(
test_perm_symbolic_missing_action
test_perm_leading_plus_symbolic
test_perm_octal_plus
- test_exec_plus_substring
test_execdir_plus
- test_execdir_plus_substring
test_hidden
test_nohidden
test_path_flag_expr
@@ -746,12 +746,16 @@ function test_exec_plus() {
bfs_diff basic -exec "$TESTS/sort-args.sh" '{}' +
}
-function test_exec_substring() {
- bfs_diff basic -exec echo '-{}-' ';'
+function test_exec_plus_semicolon() {
+ # POSIX says:
+ # Only a <plus-sign> that immediately follows an argument containing only the two characters "{}"
+ # shall punctuate the end of the primary expression. Other uses of the <plus-sign> shall not be
+ # treated as special.
+ bfs_diff basic -exec "$TESTS/sort-args.sh" foo '{}' bar + baz \;
}
-function test_exec_plus_substring() {
- bfs_diff basic -exec "$TESTS/sort-args.sh" a '-{}-' z +
+function test_exec_substring() {
+ bfs_diff basic -exec echo '-{}-' ';'
}
function test_execdir() {
@@ -766,8 +770,8 @@ function test_execdir_substring() {
bfs_diff basic -execdir echo '-{}-' ';'
}
-function test_execdir_plus_substring() {
- bfs_diff basic -execdir "$TESTS/sort-args.sh" a '-{}-' z +
+function test_execdir_plus_semicolon() {
+ bfs_diff basic -execdir "$TESTS/sort-args.sh" foo '{}' bar + baz \;
}
function test_execdir_pwd() {
@@ -776,6 +780,19 @@ function test_execdir_pwd() {
bfs_diff basic -execdir bash -c "pwd | cut -b$OFFSET-" ';'
}
+function test_execdir_slash() {
+ # Don't prepend ./ for absolute paths in -execdir
+ bfs_diff / -maxdepth 0 -execdir echo '{}' ';'
+}
+
+function test_execdir_slash_pwd() {
+ bfs_diff / -maxdepth 0 -execdir pwd ';'
+}
+
+function test_execdir_slashes() {
+ bfs_diff /// -maxdepth 0 -execdir echo '{}' ';'
+}
+
function test_weird_names() {
cd weirdnames
bfs_diff '-' '(-' '!-' ',' ')' './(' './!' \( \! -print , -print \)
@@ -938,19 +955,6 @@ function test_rm() {
bfs_diff scratch
}
-function test_execdir_slash() {
- # Don't prepend ./ for absolute paths in -execdir
- bfs_diff / -maxdepth 0 -execdir echo '{}' ';'
-}
-
-function test_execdir_slash_pwd() {
- bfs_diff / -maxdepth 0 -execdir pwd ';'
-}
-
-function test_execdir_slashes() {
- bfs_diff /// -maxdepth 0 -execdir echo '{}' ';'
-}
-
function test_regex() {
bfs_diff basic -regex 'basic/./.'
}