[Bug 901724] [NEW] cp --preserve doesn't work as expected under ubuntu 11.10

e-xiao 901724 at bugs.launchpad.net
Thu Dec 8 15:41:22 UTC 2011


Public bug reported:

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: e-xiao is below to administrator group.
1. Create a folder say test
     #mkdir test
     #ls -all
       drwxr-xr-x   2 e-xiao e-xiao     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 e-xiao e-xiao     4096 2011-12-08 23:14 test

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.

** Affects: bash (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to bash in Ubuntu.
https://bugs.launchpad.net/bugs/901724

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

Status in “bash” package in Ubuntu:
  New

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: e-xiao is below to administrator group.
  1. Create a folder say test
       #mkdir test
       #ls -all
         drwxr-xr-x   2 e-xiao e-xiao     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 e-xiao e-xiao     4096 2011-12-08 23:14 test

  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.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/bash/+bug/901724/+subscriptions




More information about the foundations-bugs mailing list