GNU bug report logs -
#14249
mkdir --parents --mode XXX incorrect mode for parents
Previous Next
Reported by: rich <at> flatcap.org
Date: Tue, 23 Apr 2013 16:43:03 UTC
Severity: normal
Tags: notabug
Done: Eric Blake <eblake <at> redhat.com>
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 14249 in the body.
You can then email your comments to 14249 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-coreutils <at> gnu.org
:
bug#14249
; Package
coreutils
.
(Tue, 23 Apr 2013 16:43:04 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
rich <at> flatcap.org
:
New bug report received and forwarded. Copy sent to
bug-coreutils <at> gnu.org
.
(Tue, 23 Apr 2013 16:43:04 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Description of problem:
mkdir doesn't honour the mode option when the parents option is used.
The leaf directories have their permissions set correctly, but the
parent directory has the permissions according to your umask.
How reproducible:
Always
Steps to Reproduce:
1. umask 077
2. mkdir --parents --mode 755 project/subproject
3. ls -ld project project/subproject
Actual results:
drwx------. 3 flatcap flatcap 60 Apr 23 14:17 project
drwxr-xr-x. 2 flatcap flatcap 40 Apr 23 14:17 project/subproject
Expected results:
drwxr-xr-x. 3 flatcap flatcap 60 Apr 23 14:17 project
drwxr-xr-x. 2 flatcap flatcap 40 Apr 23 14:17 project/subproject
Additional info:
mkdir (GNU coreutils) 8.17
fedora 18
Added tag(s) notabug.
Request was from
Eric Blake <eblake <at> redhat.com>
to
control <at> debbugs.gnu.org
.
(Tue, 23 Apr 2013 17:49:01 GMT)
Full text and
rfc822 format available.
Reply sent
to
Eric Blake <eblake <at> redhat.com>
:
You have taken responsibility.
(Tue, 23 Apr 2013 17:49:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
rich <at> flatcap.org
:
bug acknowledged by developer.
(Tue, 23 Apr 2013 17:49:02 GMT)
Full text and
rfc822 format available.
Message #12 received at 14249-done <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
tag 14249 notabug
thanks
On 04/23/2013 07:22 AM, Richard Russon wrote:
> Description of problem:
> mkdir doesn't honour the mode option when the parents option is used.
> The leaf directories have their permissions set correctly, but the
> parent directory has the permissions according to your umask.
Thanks for the report. However, this is the behavior required by POSIX,
so it is correct:
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/mkdir.html
... the mkdir utility shall create any pathname components of the path
prefix of dir that do not name an existing directory by performing
actions equivalent to first calling the mkdir() function with the
following arguments:
A pathname naming the missing pathname component, ending with a
trailing <slash> character, as the path argument
The value zero as the mode argument
and then calling the chmod() function with the following arguments:
The same path argument as in the mkdir() call
The value (S_IWUSR|S_IXUSR| ̃filemask)&0777[1] as the mode argument,
where filemask is the file mode creation mask of the process (see XSH
umask).
...For intermediate pathname components created by mkdir, the mode is
the default modified by u+ wx so that the subdirectories can always be
created regardless of the file mode creation mask; if different ultimate
permissions are desired for the intermediate directories, they can be
changed afterwards with chmod.
[1]Shoot - there's a bug in the html rendition of the POSIX 2013
document, just released this month. The pdf version has the correct
text; I'll chase down getting the omitted portion of the html version fixed.
> Steps to Reproduce:
> 1. umask 077
> 2. mkdir --parents --mode 755 project/subproject
> 3. ls -ld project project/subproject
>
> Actual results:
> drwx------. 3 flatcap flatcap 60 Apr 23 14:17 project
> drwxr-xr-x. 2 flatcap flatcap 40 Apr 23 14:17 project/subproject
This behavior is what POSIX mandates.
>
> Expected results:
> drwxr-xr-x. 3 flatcap flatcap 60 Apr 23 14:17 project
> drwxr-xr-x. 2 flatcap flatcap 40 Apr 23 14:17 project/subproject
If you want that, then you have to either (temporarily) clear your
umask, or call multiple mkdir invocations yourself, instead of letting
-p do it for you.
I'm closing out this bug report, although you may continue to comment if
you have further questions.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[signature.asc (application/pgp-signature, attachment)]
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#14249
; Package
coreutils
.
(Tue, 23 Apr 2013 17:54:01 GMT)
Full text and
rfc822 format available.
Message #15 received at 14249 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On 04/23/2013 11:43 AM, Eric Blake wrote:
> The value (S_IWUSR|S_IXUSR| ̃filemask)&0777[1] as the mode argument,
> where filemask is the file mode creation mask of the process (see XSH
> umask).
>
> [1]Shoot - there's a bug in the html rendition of the POSIX 2013
> document, just released this month. The pdf version has the correct
> text; I'll chase down getting the omitted portion of the html version fixed.
http://austingroupbugs.net/view.php?id=682
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[signature.asc (application/pgp-signature, attachment)]
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Wed, 22 May 2013 11:24:02 GMT)
Full text and
rfc822 format available.
This bug report was last modified 12 years and 29 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.