summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--parse.c6
-rwxr-xr-xtests.sh15
-rw-r--r--tests/test_perm_222_plus.out5
-rw-r--r--tests/test_perm_644_plus.out7
4 files changed, 28 insertions, 5 deletions
diff --git a/parse.c b/parse.c
index 2708b9a..6492412 100644
--- a/parse.c
+++ b/parse.c
@@ -1795,6 +1795,12 @@ static struct expr *parse_perm(struct parser_state *state, int field, int arg2)
expr->mode_cmp = MODE_ANY;
++mode;
break;
+ case '+':
+ if (mode[1] >= '0' && mode[1] <= '9') {
+ expr->mode_cmp = MODE_ANY;
+ ++mode;
+ }
+ break;
default:
expr->mode_cmp = MODE_EXACT;
break;
diff --git a/tests.sh b/tests.sh
index 9775292..387562b 100755
--- a/tests.sh
+++ b/tests.sh
@@ -263,6 +263,8 @@ bsd_tests=(
test_uid_name
test_mnewer
test_H_mnewer
+ test_perm_222_plus
+ test_perm_644_plus
test_size_T
test_quit
test_quit_child
@@ -389,7 +391,6 @@ bfs_tests=(
test_perm_symbolic_double_comma
test_perm_symbolic_missing_action
test_perm_leading_plus_symbolic
- test_perm_octal_plus
test_execdir_plus
test_hidden
test_nohidden
@@ -1000,6 +1001,10 @@ function test_perm_222_slash() {
bfs_diff perms -perm /222
}
+function test_perm_222_plus() {
+ bfs_diff perms -perm +222
+}
+
function test_perm_644() {
bfs_diff perms -perm 644
}
@@ -1012,6 +1017,10 @@ function test_perm_644_slash() {
bfs_diff perms -perm /644
}
+function test_perm_644_plus() {
+ bfs_diff perms -perm +644
+}
+
function test_perm_symbolic() {
bfs_diff perms -perm a+r,u=wX,g+wX-w
}
@@ -1048,10 +1057,6 @@ function test_perm_leading_plus_symbolic_slash() {
bfs_diff perms -perm /+rwx
}
-function test_perm_octal_plus() {
- ! invoke_bfs perms -perm +777 2>/dev/null
-}
-
function test_permcopy() {
bfs_diff perms -perm u+rw,g+u-w,o=g
}
diff --git a/tests/test_perm_222_plus.out b/tests/test_perm_222_plus.out
new file mode 100644
index 0000000..9a5b95a
--- /dev/null
+++ b/tests/test_perm_222_plus.out
@@ -0,0 +1,5 @@
+perms
+perms/rw
+perms/rwx
+perms/w
+perms/wx
diff --git a/tests/test_perm_644_plus.out b/tests/test_perm_644_plus.out
new file mode 100644
index 0000000..7e5ae98
--- /dev/null
+++ b/tests/test_perm_644_plus.out
@@ -0,0 +1,7 @@
+perms
+perms/r
+perms/rw
+perms/rwx
+perms/rx
+perms/w
+perms/wx