bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#45886: mkdir -m argument does not work correctly, applies incorrect


From: Davin McCall
Subject: bug#45886: mkdir -m argument does not work correctly, applies incorrect permissions
Date: Fri, 15 Jan 2021 17:45:29 +1000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0

Coreutils 8.32 (and possibly earlier) "mkdir -m <mode> ..." appears to
ignore parts of the mode specification. POSIX suggests that with -m
specified, the mode is "relative" to a=rwx. That implies a mode of "o-w"
should yield a mode of "rwxrwxr-x", and a mode of "o+w" should yield
"rwxrwxrwx". Instead:

$ mkdir -m o-w t1
$ mkdir -m o+w t2
$ ls -l
total 8
drwxr-xr-x 2 davmac users 4096 Jan 15 17:27 t1
drwxrwxrwx 2 davmac users 4096 Jan 15 17:27 t2
$

So, the "o+w" or "o-w" selects the "other" permissions but also the
"group" permissions. This also happens with "g+w" and "g-w" (i.e. both
"group" and "other" permissions get set or cleared). This implies it's
not just a case of the initial mode not matching POSIX, but somehow "o"
and "g" are being applied incorrectly.

Setting POSIXLY_CORRECT makes no difference.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]