diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2020-11-09 17:01:33 -0500 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2020-11-09 17:06:31 -0500 |
commit | dd3bbb976be76325f4115f9f0ef51b3e6dde75c5 (patch) | |
tree | 3856f4c0ac2ad49fe3c9c2e89768e77f5e9192e6 /tests.sh | |
parent | 6495006b74655554b4d3d18f5c6221facaa8b67c (diff) | |
download | bfs-dd3bbb976be76325f4115f9f0ef51b3e6dde75c5.tar.xz |
opt: Predicates aren't true when they're false
This unfortunate typo was mostly harmless; since the predicates were
always assumed to be true, they wouldn't conflict. The exception is
-user/-group, which set -nouser/-nogroup to false for users/groups that
exist.
Even -O0 wasn't enough to suppress the bug, due to a missing optlevel
check fixed in the previous commit.
Fixes: 305ee902874b49351f4916e303c293523f11570b
Diffstat (limited to 'tests.sh')
-rwxr-xr-x | tests.sh | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -196,6 +196,7 @@ posix_tests=( test_group_name test_group_id + test_group_nogroup test_links test_links_plus @@ -244,6 +245,7 @@ posix_tests=( test_user_name test_user_id + test_user_nouser # Closed file descriptors test_closed_stdin @@ -1376,6 +1378,11 @@ function test_user_id() { bfs_diff basic -user "$(id -u)" } +function test_user_nouser() { + # Regression test: this was wrongly optimized to -false + bfs_diff basic -user "$(id -u)" \! -nouser +} + function test_group_name() { bfs_diff basic -group "$(id -gn)" } @@ -1384,6 +1391,11 @@ function test_group_id() { bfs_diff basic -group "$(id -g)" } +function test_group_nogroup() { + # Regression test: this was wrongly optimized to -false + bfs_diff basic -group "$(id -g)" \! -nogroup +} + function test_daystart() { bfs_diff basic -daystart -mtime 0 } |