From d201dc097fa6920b37c16dd83ca7e52575223d2f Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sat, 8 Feb 2020 08:47:44 -0800 Subject: chmod: ugo perms sees effects from same clause. This is Coreutils chmod behavior. * sysif.c (chmod_wrap): Sample cmode into oldm at the start of every assigment before punching the masked hole into cmode. * tests/018/chmod.tl: Breaking test case added. --- sysif.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sysif.c') diff --git a/sysif.c b/sysif.c index 444f8326..638f9642 100644 --- a/sysif.c +++ b/sysif.c @@ -673,6 +673,7 @@ static val chmod_wrap(val target, val mode) case chm_sub: cmode &= ~bits; break; case chm_set: if (cs == chm_perm) { + oldm = cmode; cmode &= ~mask; if (implicit_all || (who & CHM_O) != 0) cmode &= ~S_ISVTX; /* GNU Coreutils 8.28 chmod behavior */ -- cgit v1.2.3