[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: mkdir -p and Default ACLs
From: |
Paul Eggert |
Subject: |
Re: mkdir -p and Default ACLs |
Date: |
Mon, 28 Jul 2008 15:23:38 -0700 |
User-agent: |
Gnus/5.101 (Gnus v5.10.10) Emacs/22.2 (gnu/linux) |
Jan Engelhardt <address@hidden> writes:
>> $ umask
>> 0022
>> $ strace -e mkdir,umask mkdir test1
>> mkdir("test1", 0777) = 0
>> $ strace -e mkdir,umask mkdir -p test2
>> umask(0) = 022
>> mkdir("test2", 0755) = 0
>>
>>mkdir("test1", 0777) with umask 022 ought to be equivalent to
>>mkdir("test2", 0755) with umask 0. If it isn't equivalent, that
>>suggests something is dodgy with your ACL implementation.
>
> Your ACL implementation would then be just as dodgy,
I'm running Debian stable, without ACLs.
> umask specifies what bits to remove from the user, group and others. The
> mode parameter however modifies the final mode
Isn't that a bug? Although POSIX obviously doesn't specify ACLs, it
does say "The file permission bits of the new directory shall be
initialized from mode. These file permission bits of the mode argument
shall be modified by the process' file creation mask."
<http://www.opengroup.org/onlinepubs/009695399/functions/mkdir.html>
In other words, if the umask is 0022, and I execute mkdir("test1", 0777),
then the "file permission bits of the mode argument" (namely 0777)
"shall be modified by the process' file creation mask" (namely 0022),
yielding 0755. I don't see a lot of wiggle room here: any system that
conforms to POSIX must treat mkdir("test1", 0777) as if it were
mkdir("test1", 0755) when the umask is 0022.