[Bugme-new] [Bug 20832] New: cp --preserve mode argument is insufficiently granular

bugzilla-daemon at bugzilla.kernel.org bugzilla-daemon at bugzilla.kernel.org
Thu Oct 21 07:06:19 PDT 2010


https://bugzilla.kernel.org/show_bug.cgi?id=20832

           Summary: cp --preserve mode argument is insufficiently granular
           Product: IO/Storage
           Version: 2.5
          Platform: All
        OS/Version: Linux
              Tree: Mainline
            Status: NEW
          Severity: normal
          Priority: P1
         Component: Other
        AssignedTo: io_other at kernel-bugs.osdl.org
        ReportedBy: markjwebb at gmail.com
        Regression: No


This is the first bug I have submitted, so apologies if I get anything wrong
here.

Overview
I have two filesystems. One filesystem is mounted with the "acl" option and one
is not. I want to be able copy files containing ACLs from the filesystem that
supports ACLs over to the filesystem that doesn't. I want to preserve the file
ownership and permissions, but I want to NOT preserve the ACLs. At the moment
there the cp command can sort of achieve this, but it returns an error.

STEPS TO REPRODUCE
# touch test
# setfacl -m u:1234:rw- test
# # Assuming that /tmp is not mounted with option "acl"
# cp -p test /tmp
cp: preserving permissions for `/tmp/test': Operation not supported
# cp --preserve=mode test /tmp
cp: preserving permissions for `/tmp/test': Operation not supported
# # (Only by excluding mode will the operation return success)
#  cp --preserve=ownership,timestamps test /tmp

DESIRED BEHAVIOUR
I think it would be highly desirable for cp to offer more granularity on what
is preserved by the copy. I would suggest adding:
- acl
- x_attr

Note that rsync does a good job by providing the following options:
 -H, --hard-links            preserve hard links
 -p, --perms                 preserve permissions
 -E, --executability         preserve executability
     --chmod=CHMOD           affect file and/or directory permissions
 -A, --acls                  preserve ACLs (implies -p)
 -X, --xattrs                preserve extended attributes
 -o, --owner                 preserve owner (super-user only)
 -g, --group                 preserve group
     --devices               preserve device files (super-user only)
     --specials              preserve special files
 -D                          same as --devices --specials
 -t, --times                 preserve modification times

If only cp could be brought up to the same standard.

It is also perhaps worth mentioning that it seems bizarre (and very confusing)
that in order to preserve the file mode (e.g. 0644) you need to specify
preserve=ownership, not preserve=mode, and in order to preserve the file owner
(e.g. mark) you need to specify preserve=mode!!

BUILD & PLATFORM
I'm pretty sure this issue applied to all flavours of Linux, but I am testing
on a derivative of Debian Sarge running on a Sparc processor 
# uname -a
Linux tera 2.6.17.8ReadyNAS #1 Tue Jun 9 13:59:28 PDT 2009 padre unknown

-- 
Configure bugmail: https://bugzilla.kernel.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


More information about the Bugme-new mailing list