Red Hat Bugzilla – Bug 801873
Behavior of "cp --backup" changed, not backing up individual files
Last modified: 2013-09-23 07:09:37 EDT
Description of problem:
With the previous version of "cp" (coreutils 5.97-23.el5_6.4), the behavior of the --backup against a directory was to take any existing files in the directory, rename with a backup suffix, and insert the new file With the newer coreutils (5.97-34.el5), the behavior is now that the destination directory is renamed with the backup suffix, and a new directory is created containing only files being copied in.
The version of "cp" is still 5.97, so I believe this is a bug rather than intended behavior, possible caused by other cp-related bugfixes.
Version-Release number of selected component (if applicable):
How reproducible: Always
Example, with structure
Steps to Reproduce:
From the "/source" directory, the following command would be run:
cp --backup --suffix=_old files /dest/
RedHat: See also Case 00611703
Thanks for report, confirmed (of course with -r option added). RHEL-6 cp behaves the expected way, so something probably went wrong in RHEL-5 update. I suspect the fix for #627285 (coreutils-5.97-mv-backupdirs.patch) .
Created attachment 569951 [details]
Patch for fixing broken backup for directory argument
Attached patch should fix this issue.
Technical note added. If any revisions are required, please edit the "Technical Notes" field
accordingly. All revisions will be proofread by the Engineering Content Services team.
An incomplete fix for behavior of the "mv --backup" command, that was released with the RHBA-2011:1074 errata advisory, caused the "cp --backup" command to work incorrectly. When used with a directory as a source argument, the "cp --backup" command did not backup individual files within the directory but whole directory. This update corrects this problem and the "--backup" feature of the "cp" utility now works as intended again.