GNU bug report logs - #8527
cp/mv in coreutils don't respect the default ACL of parent directories.

Previous Next

Package: coreutils;

Reported by: crocket <crockabiscuit <at> gmail.com>

Date: Wed, 20 Apr 2011 14:48:02 UTC

Severity: normal

Tags: fixed

Done: Assaf Gordon <assafgordon <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: "Linda A. Walsh" <coreutils <at> tlinx.org>
To: f0rhum <at> free.fr
Cc: 8527 <at> debbugs.gnu.org
Subject: bug#8527: cp/mv in coreutils don't respect the default ACL of parent
Date: Tue, 07 Oct 2014 03:08:54 -0700
f0rhum <at> free.fr wrote:
> I can confirm. Tests show that the parent folder ACL "Default mask" is not inherited as the ACL "Access mask" of the file|dir created by cp|mv. 
>

What file system and core utils are you using?

Are you using a file system that has alternate user-data forks
or extended attributes that have them included by default? 
Or are you using a file system where they were added on as a super-user 
control'd option?  Have you tried copying them as root?

The reason I ask, is that I just tried it and it appears to work:
1) First the dir:
>  cd /tmp
>  llg -d /tmp
drwxrwxrwt 25 root root 8192 Oct  7 02:21 /tmp/
>  lsacl /tmp
[u::rwx,g::rwx,o::rwx] /tmp               #default ACL from mode bits

2) Create file with 'touch'
>  touch x                                 # new file
Ishtar:/tmp> llg x
-rw-rw-r-- 1 law lawgroup 0 Oct  7 02:26 x
>  lsacl
[u::rw-,g::rw-,o::r--] x                  #default ACL
----
3) now I'll copy in a *directory* that has both types of ACL's on it, but
not specifying that any permissions be copied:

>  ll -d  /Media/Library/_artwork/test       #source
drwxrwsr-x+ 2 10 Oct  7 02:33 /Media/Library/_artwork/test/
Ishtar:/tmp> lsacl  /Media/Library/_artwork/test      
[u::rwx,u:Media:rwx,g::rwx,g:Media:rwx,m::rwx,o::r-x/u::rwx,u:Media:rwx,g::rwx,g:Media:rwx,m::rwx,o::r-x] 
/Media/Library/_artwork/test

(note, 2nd acl is default dir (lsacl uses "chacl -l")
Ishtar:/tmp> 'cp' -r /Media/Library/_artwork/test .  #recursive to tmp
Ishtar:/tmp> llg -d test
drwxrwxr-x 2 law lawgroup 6 Oct  7 02:34 test/
Ishtar:/tmp> lsacl test                              #no attr indicated
[u::rwx,g::rwx,o::r-x] test                          #default ACL shown
----
So far all seems fine.

4) Now lets copy the perms too:

Ishtar:/tmp> rd test
Ishtar:/tmp> 'cp' -a /Media/Library/_artwork/test .
Ishtar:/tmp> llg -d test
drwxrwsr-x+ 2 law Media 6 Oct  7 02:33 test/
Ishtar:/tmp> lsacl test                          #same ACL as source
[u::rwx,u:Media:rwx,g::rwx,g:Media:rwx,m::rwx,o::r-x/u::rwx,u:Media:rwx,g::rwx,g:Media:rwx,m::rwx,o::r-x] 
test

5) create file in that dir:

Ishtar:/tmp> cd test
Ishtar:/tmp/test> touch touched_file
Ishtar:/tmp/test> llg touched_file
-rw-rw-r--+ 1 law Media 0 Oct  7 02:42 touched_file
Ishtar:/tmp/test> lsacl touched_file
[u::rw-,u:Media:rwx,g::rwx,g:Media:rwx,m::rw-,o::r--] touched_file
---
File has expected inherited ACL.

6) Now ... lets use cp to copy a file w/o acls in:
(first create normal file under /tmp):

>  echo "perm test">/tmp/perm.txt
Ishtar:/tmp/test> llg /tmp/perm.txt
-rw-rw-r-- 1 law lawgroup 10 Oct  7 02:59 /tmp/perm.txt
Ishtar:/tmp/test> lsacl /tmp/perm.txt
[u::rw-,g::rw-,o::r--] /tmp/perm.txt
>  'cp' /tmp/perm.txt .
Ishtar:/tmp/test> llg perm.txt
-rw-rw-r--+ 1 law Media 10 Oct  7 03:01 perm.txt
Ishtar:/tmp/test> lsacl perm.txt
[u::rw-,u:Media:rwx,g::rwx,g:Media:rwx,m::rw-,o::r--] perm.txt

----
8) Looks the same to me...However, check this out:

Ishtar:/tmp/test> rm perm.txt
Ishtar:/tmp/test> cp /tmp/perm.txt . 
Ishtar:/tmp/test> llg /tmp/perm.txt
-rw-rw-r-- 1 law lawgroup 10 Oct  7 02:59 /tmp/perm.txt
Ishtar:/tmp/test> lsacl perm.txt

No acl this time, but same copy...or was it?

Note I was careful to use 'cp' most of the time when copying except
this last time, cuz:
>  alias cp
alias cp='cp --preserve=mode,timestamps'

my normal cp is an alias -- that says to preserve the mode. 
It wouldn't be able to do that if it allowed the default ACL
to be set on the file.

--------------
So, I don't know if this is related to your problem, but
cp appears to be working correctly here
filesystem = xfs (acls are always on as they came with the filesystem).
kernel=

Linux Ishtar 3.16.2-Isht-Van #1 SMP PREEMPT Tue Sep 9 18:26:43 PDT 2014 
x86_64 x86_64 x86_64 GNU/Linux


==================================

If this was any help -- great, if it was an annoyance,
just delete it and I can claim my dog ate my keyboard...
(funny things come out of dogs stomachs.... ;-))...







This bug report was last modified 6 years and 277 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.