Fredrik Tolf wrote:
> Apparently, mkdir uses 0755 when used with the -p option to create
> multiple levels of directories in one go. Normally, 0777 would be,
> though masked to 0755 with the default umask.

I assume you are talking about directories above the target
directories getting created?  If so then you are incorrect.  The
permissions are that of umask.

  $ umask 0
  $ mkdir -p /tmp/1/2
  $ ls -ldog /tmp/1
  drwxrwxrwx 3 60 Feb  1 23:17 /tmp/1
  $ rm -rf /tmp/1
  $ umask 02
  $ mkdir -p /tmp/1/2
  $ ls -ldog /tmp/1
  drwxrwxr-x 3 60 Feb  1 23:18 /tmp/1
  $ rm -rf /tmp/1
  $ umask 027
  $ mkdir -p /tmp/1/2
  $ ls -ldog /tmp/1
  drwxr-x--- 3 60 Feb  1 23:19 /tmp/1

You can control the permissions of the parent directories by setting
your umask before running mkdir.  This is the way it has always been.

> I can't really imagine that this behavior is intended, and it seems
> to go against any reasonable principle of least surprise.

It is intended because that is the way traditional legacy Unix systems
have always behaved.  And because that is the legacy behavior it is
required by POSIX for reasons of legacy portability.

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

> (I discovered this specifically with directories that had been given
> an ACL with setfacl -m d:g::rwx to make directory trees group-writable
> by default, and this behavior makes mkdir "ignore" that ACL
> modification when -p is used.)

Can you produce a small test case that illustrates the ACL behavior?
The ACL behavior of the utilities isn't necessarily a done deal.  But
ACL behavior should mimic normal permission behavior.  I admit that I
am not well versed with the ACL behavior.

If you wish a behavior change with regards to ACLs would you be so
kind as to request it upstream at coreut...@gnu.org?

Bob


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to