bug-coreutils
[Top][All Lists]
Advanced

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

Re: mkdir -m and -p interaction


From: Paul Eggert
Subject: Re: mkdir -m and -p interaction
Date: Tue, 30 Jan 2007 13:28:35 -0800
User-agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux)

"Paul T. Darga" <address@hidden> writes:

> some sort of GNU --extra-flag might be in order, but cooking up a
> patch for that would be far more work than simply chmod-ing after
> mkdir-ing.

It's usually better to set the umask first.  Here's a proposed patch
to the documentation, to explain this a bit better.

2007-01-30  Paul Eggert  <address@hidden>

        * coreutils.texi (mkdir invocation): Say how to set the file
        permission bits of a parent directory with mkdir -p.

diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index ff049bc..4918352 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -8404,12 +8404,20 @@ overridden in this way.
 @opindex -p
 @opindex --parents
 @cindex parent directories, creating
-Make any missing parent directories for each argument.  The file permission
-bits of parent directories are set to the umask modified by @samp{u+wx}.
address@hidden Setuid and Setgid}, for how the set-user-ID and
-set-group-ID bits of parent directories are inherited.
-Ignore arguments corresponding to existing directories, and do not
-change their file mode bits.
+Make any missing parent directories for each argument, setting their
+file permission bits to the umask modified by @samp{u+wx}.  Ignore
+existing parent directories, and do not change their file permission
+bits.
+
+To set the file permission bits of any newly-created parent
+directories to a value that includes @samp{u+wx}, you can set the
+umask before invoking @command{mkdir}.  For example, if the shell
+command @samp{(umask u=rwx,go=rx; mkdir -p P/Q)} creates the parent
address@hidden it sets the parent's permission bits to @samp{u=rwx,go=rx}.
+To set a parent's special mode bits as well, you can invoke
address@hidden after @command{mkdir}.  @xref{Directory Setuid and
+Setgid}, for how the set-user-ID and set-group-ID bits of
+newly-created parent directories are inherited.

 @item -v
 @item --verbose
M doc/ChangeLog
M doc/coreutils.texi
Committed as cb8b13937cf92fe3b3fede6797dcbd3bbbd730fc




reply via email to

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