cp --preserve doesn't work as expected under ubuntu 11.10

Bug #901724 reported by e-xiaoy
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
coreutils (Ubuntu)
New
Undecided
Unassigned

Bug Description

I have been struggling with a very strong issue after upgraded to Ubuntu 11.10 (Oneiric Ocelot), and finally found out this is from a low level error from ubuntu - the root cause is because cp command with the switch of -a when copy a folder doesn't work as expected of "-dR --preserve=all" from cp --help.
    #cp --help
    ...

    Mandatory arguments to long options are mandatory for short options too.
      -a, --archive same as -dR --preserve=all
           --backup[=CONTROL] make a backup of each existing destination file
    ...

Under Ubuntu 11.04, when copy folders, all the attributes will be preserved with the --preserve option, but with Ubuntu 11.10, some attributes will be lost.

Here is a simple test procedure.

Note: exiaoy is below to administrator group.
1. Create a folder say test
     #mkdir test
     #ls -all
       drwxr-xr-x 2 exiaoy exiaoy 4096 2011-12-08 23:14 test
2. Trying to cp it with -a.
     #cp -a test test1

Under Ubuntu 11.10,
     #ls -all
       drwx------ 2 exiaoy exiaoy 4096 2011-12-08 23:14 test1

Yes, with the --preserve=all option, you are still losing all attributes not owned by owner.
Not sure if this is from any policy changes from ubuntu due to security concern, please let me know if this is work as designed.

[Workaround]
1. Use "--backup -R" options
2. Use "-dR" only without "--preserve" option

bash is used for the case.

e-xiaoy (e-xiaoy)
description: updated
description: updated
Julian Taylor (jtaylor)
affects: bash (Ubuntu) → coreutils (Ubuntu)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.