diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2025-06-20 09:37:11 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2025-06-20 09:47:22 -0400 |
commit | 666bd94f932ec6f1b031f3220bbc9f55ca83c409 (patch) | |
tree | f78a371bbd79fe7b906af5b688abb994ede4b91d /tests/posix | |
parent | c5becba7c522962cf3f0f8b6e02a771b217b26a2 (diff) | |
download | bfs-666bd94f932ec6f1b031f3220bbc9f55ca83c409.tar.xz |
opt: "Not me" doesn't imply "nobody"
We were making `-user <existing>` imply `! -nouser`, which is valid, but
we were also makeing `! -user <existing>` imply `-nouser`, which isn't.
Fix it by only constraining the `-nouser`/`-nogroup` predicates in the
true case.
While I'm here, fix a similar latent bug that would have triggered if we
ever merged `-readable -and -writable` into one `R_OK | W_OK` test.
Fixes: https://github.com/tavianator/bfs/issues/155
Fixes: 305ee902 ("opt: Track data flow information about predicates")
Diffstat (limited to 'tests/posix')
-rw-r--r-- | tests/posix/group_o_group.out | 19 | ||||
-rw-r--r-- | tests/posix/group_o_group.sh | 3 | ||||
-rw-r--r-- | tests/posix/user_o_user.out | 19 | ||||
-rw-r--r-- | tests/posix/user_o_user.sh | 3 |
4 files changed, 44 insertions, 0 deletions
diff --git a/tests/posix/group_o_group.out b/tests/posix/group_o_group.out new file mode 100644 index 0000000..a7ccfe4 --- /dev/null +++ b/tests/posix/group_o_group.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/group_o_group.sh b/tests/posix/group_o_group.sh new file mode 100644 index 0000000..917c450 --- /dev/null +++ b/tests/posix/group_o_group.sh @@ -0,0 +1,3 @@ +# Regression test for +# https://github.com/tavianator/bfs/issues/155 +bfs_diff basic -user 0 -o -user "$(id -g)" diff --git a/tests/posix/user_o_user.out b/tests/posix/user_o_user.out new file mode 100644 index 0000000..a7ccfe4 --- /dev/null +++ b/tests/posix/user_o_user.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/user_o_user.sh b/tests/posix/user_o_user.sh new file mode 100644 index 0000000..7c143ae --- /dev/null +++ b/tests/posix/user_o_user.sh @@ -0,0 +1,3 @@ +# Regression test for +# https://github.com/tavianator/bfs/issues/155 +bfs_diff basic -user 0 -o -user "$(id -u)" |