Subject: Re: bug#12130: Fwd: bug#12130: "sudo make install" applies umask to new directories
From: Eric Blake <[email-masked]>
To: Peter Johansson <[email-masked]>
Cc: [email-masked], [email-masked], didi <[email-masked]>
Date: Mon, 17 Sep 2012 06:44:00 -0600
List-Id: <debbugs-submit.debbugs.gnu.org>

tag 12130 notabug
thanks

On 09/16/2012 05:53 PM, Peter Johansson wrote:

> mkdir -p -m 700 /tmp/foo/bar
> 
> creates bar with permissions 700 and bar with 776 (my umask). I wonder
> is that behaviour is mandated by some standard

Yes - POSIX requires this:

http://pubs.opengroup.org/onlinepubs/9699919799/utilities/mkdir.html

-p
    Create any missing intermediate pathname components.

    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

    where the -m mode option represents that option supplied to the
original invocation of mkdir, if any.

> or if there is room for
> improvement in coreutils here (CC:ed).

Since POSIX requires the existing behavior, there's unfortunately no
room for improvement, and I'm closing this as not a bug in coreutils.

-- 
Eric Blake   [email-masked]    +1-919-301-3266
Libvirt virtualization library http://libvirt.org