|
From: | GNU bug Tracking System |
Subject: | bug#45886: closed (mkdir -m argument does not work correctly, applies incorrect permissions) |
Date: | Fri, 15 Jan 2021 11:04:02 +0000 |
Your message dated Fri, 15 Jan 2021 03:03:03 -0800 with message-id <f67b411c-c89a-6e45-9fa1-64203afd74a3@cs.ucla.edu> and subject line Re: bug#45886: mkdir -m argument does not work correctly, applies incorrect permissions has caused the debbugs.gnu.org bug report #45886, regarding mkdir -m argument does not work correctly, applies incorrect permissions to be marked as done. (If you believe you have received this mail in error, please contact help-debbugs@gnu.org.) -- 45886: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=45886 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems
--- Begin Message ---Subject: 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.
--- End Message ---
--- Begin Message ---Subject: Re: bug#45886: mkdir -m argument does not work correctly, applies incorrect permissions Date: Fri, 15 Jan 2021 03:03:03 -0800 Thanks for the bug report. I reproduced the problem and installed the attached patch to fix it. User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 0001-mkdir-fix-bug-when-m-s-more-generous-than-umask.patch
Description: Text Data
--- End Message ---
[Prev in Thread] | Current Thread | [Next in Thread] |