diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2020-02-08 07:50:07 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2020-02-08 08:43:23 -0800 |
commit | b8a5b08de163e80e1b72459c5c889bb70eef947b (patch) | |
tree | babbb8db9933a0c509c25e39cd52d74b359a6af4 /tests | |
parent | 158211060c413bcbdebba3f87478673cbee12dc0 (diff) | |
download | txr-b8a5b08de163e80e1b72459c5c889bb70eef947b.tar.gz txr-b8a5b08de163e80e1b72459c5c889bb70eef947b.tar.bz2 txr-b8a5b08de163e80e1b72459c5c889bb70eef947b.zip |
chmod: ugo must refer to unaltered perms.
Within the same clause, permissions given by ugo must refer to
the unaltered permissions, before the target bits were masked
out, otherwise self-assignment like o=o just clears the
permissions. The other self-referential perm is X: it checks
for existing x permissions. That works with the current
value.
* sysif.c (chmod_wrap): Keep the old permissions in a new loop
variable called oldm. The u, g and o perms refer to oldm
rather than to the updated value in cmode. When we hit a
comma, we update oldm to the current value. The code for
this is now in one place with a goto.
* tests/018/chmod.tl: New test case that fails in the
absence of this fix. Test cases confirming that X
refers to the current permissions.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/018/chmod.tl | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/018/chmod.tl b/tests/018/chmod.tl index a5494998..93739c48 100644 --- a/tests/018/chmod.tl +++ b/tests/018/chmod.tl @@ -41,3 +41,8 @@ (cht "---------rwx" "u=rwsx" "s--rwx---rwx") (cht "---------rwx" "u=rwsx,g=rwx,go-x" "s--rwxrw-rw-") (cht "---------rwx" "g=o,g-w+s,u=g,o-x" "-g-r-xr-xrw-") +(cht "---------rwx" "o=o" "---------rwx") +(cht "-----x------" "a+X" "-----x--x--x") +(cht "-----x------" "=,a+X" "------------") +(cht "-----x------" "a-x+X" "------------") +(cht "------------" "u+x-X" "------------") |