summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--opt.c4
-rwxr-xr-xtests.sh12
2 files changed, 14 insertions, 2 deletions
diff --git a/opt.c b/opt.c
index 8c516ea..50ad212 100644
--- a/opt.c
+++ b/opt.c
@@ -1,6 +1,6 @@
/****************************************************************************
* bfs *
- * Copyright (C) 2017-2019 Tavian Barnes <tavianator@tavianator.com> *
+ * Copyright (C) 2017-2020 Tavian Barnes <tavianator@tavianator.com> *
* *
* Permission to use, copy, modify, and/or distribute this software for any *
* purpose with or without fee is hereby granted. *
@@ -712,7 +712,7 @@ fail:
/** Infer data flow facts about a predicate. */
static void infer_pred_facts(struct opt_state *state, enum pred_type pred) {
constrain_pred(&state->facts_when_true.preds[pred], true);
- constrain_pred(&state->facts_when_false.preds[pred], true);
+ constrain_pred(&state->facts_when_false.preds[pred], false);
}
/** Infer data flow facts about an -{execut,read,writ}able expression. */
diff --git a/tests.sh b/tests.sh
index 7276672..673e155 100755
--- a/tests.sh
+++ b/tests.sh
@@ -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
}