[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bug or Feature in mkdir(1)
From: |
Eric Blake |
Subject: |
Re: Bug or Feature in mkdir(1) |
Date: |
Fri, 21 Nov 2008 22:20:17 -0700 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.18) Gecko/20081105 Thunderbird/2.0.0.18 Mnenhy/0.7.5.666 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
According to Gordon Hamachi on 11/21/2008 1:58 PM:
> The problem is, when I use mkdir -p -m it only sets the mode of the
> last directory. All of the parent directories take the default mode,
> which is not what I want. It would be convenient if there were an
> option to apply the -m mode to all parents that get created.
Unfortunately for you, this is a feature and not a bug. POSIX requires
this behavior:
http://www.opengroup.org/onlinepubs/009695399/utilities/mkdir.html
"For each dir operand that does not name an existing directory, effects
equivalent to those caused by the following command shall occur:
mkdir -p -m $(umask -S),u+wx $(dirname dir) &&
mkdir [-m mode] dir"
Your only alternative is to create the directories in hierarchical order
yourself (although you should still use the -p option, in case some other
process is trying to create the directories in parallel).
- --
Don't work too hard, make some time for fun as well!
Eric Blake address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkknlpAACgkQ84KuGfSFAYCcCwCfbAY2085AXcjVmYFmm56pKGCP
8j0AoNZOkbmAwT32qqAH6O/Gr65esmiC
=07DG
-----END PGP SIGNATURE-----