GNU bug report logs - #45886
mkdir -m argument does not work correctly, applies incorrect permissions

Previous Next

Package: coreutils;

Reported by: Davin McCall <davmac <at> davmac.org>

Date: Fri, 15 Jan 2021 07:46:01 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 45886 in the body.
You can then email your comments to 45886 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#45886; Package coreutils. (Fri, 15 Jan 2021 07:46:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Davin McCall <davmac <at> davmac.org>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Fri, 15 Jan 2021 07:46:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Davin McCall <davmac <at> davmac.org>
To: bug-coreutils <at> gnu.org
Subject: mkdir -m argument does not work correctly, applies incorrect
 permissions
Date: Fri, 15 Jan 2021 17:45:29 +1000
[Message part 1 (text/plain, inline)]
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.


[Message part 2 (text/html, inline)]

Reply sent to Paul Eggert <eggert <at> cs.ucla.edu>:
You have taken responsibility. (Fri, 15 Jan 2021 11:04:02 GMT) Full text and rfc822 format available.

Notification sent to Davin McCall <davmac <at> davmac.org>:
bug acknowledged by developer. (Fri, 15 Jan 2021 11:04:02 GMT) Full text and rfc822 format available.

Message #10 received at 45886-done <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Davin McCall <davmac <at> davmac.org>
Cc: 14371 <at> debbugs.gnu.org, 45886-done <at> debbugs.gnu.org
Subject: Re: bug#45886: mkdir -m argument does not work correctly, applies
 incorrect permissions
Date: Fri, 15 Jan 2021 03:03:03 -0800
[Message part 1 (text/plain, inline)]
Thanks for the bug report. I reproduced the problem and installed the 
attached patch to fix it.
[0001-mkdir-fix-bug-when-m-s-more-generous-than-umask.patch (text/x-patch, attachment)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 12 Feb 2021 12:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 66 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.