aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorVidar Holen <spam@vidarholen.net>2019-03-25 14:44:58 -0700
committerRob Landley <rob@landley.net>2019-03-25 20:59:44 -0500
commit44dd6dd6520430b677ab97e886e8317490f04355 (patch)
tree36cecf467fc6da70e3103b547d67e8a9c720b19e /tests
parent79dc2434cb8d39213b24b89f6c618174d8e9cbd4 (diff)
downloadtoybox-44dd6dd6520430b677ab97e886e8317490f04355.tar.gz
find: fix inverted -exec exit status
The return value of -exec was the command's exit code, which did not account for the fact that an exit code of zero means success, while in C, zero means failure. From POSIX: > the primary shall evaluate as true if the utility returns a zero > value as exit status This commit flips the return value, and adds two tests.
Diffstat (limited to 'tests')
-rwxr-xr-xtests/find.test4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/find.test b/tests/find.test
index de48c5c8..6b0b0a8a 100755
--- a/tests/find.test
+++ b/tests/find.test
@@ -56,6 +56,10 @@ testing "-type f -user -exec" \
"find dir -type f -user $USER -exec ls {} \\;" "dir/file\n" "" ""
testing "-type l -newer -exec" \
"find dir -type l -newer dir/file -exec ls {} \\;" "dir/link\n" "" ""
+testing "-exec true \\; -print" \
+ "find dir/file -exec true \\; -print" "dir/file\n" "" ""
+testing "-exec false \\; -print" \
+ "find dir/file -exec false \\; -print" "" "" ""
testing "-perm (exact success)" \
"find perm -type f -perm 0444" "perm/all-read-only\n" "" ""
testing "-perm (exact failure)" \