cp: change --attributes-only to not truncate existing files
authorPádraig Brady <P@draigBrady.com>
Thu, 12 Apr 2012 11:47:30 +0000 (12:47 +0100)
committerPádraig Brady <P@draigBrady.com>
Thu, 12 Apr 2012 17:35:17 +0000 (18:35 +0100)
commit3d53e7fe1c31aa440cc9708c7c51db6b78c07653
tree13fc2d863087f5a0e2664592aa4902308e6fb0f0
parent7e0ef7c035a4ef331dfd5019465ad00171a7b800
cp: change --attributes-only to not truncate existing files

* src/copy.c (copy_reg): Don't truncate an existing file,
to support copying attributes between existing files.
The original use case only considered creating new files,
and it would be a very unusual use case to be relying
on the truncating behavior.
* doc/coreutils.texi (cp invocation): Mention the non
truncating behavior.
* tests/cp/attr-existing: A new test to ensure O_TRUNC skipped.
* tests/Makefile.am: Reference the new test.
* NEWS: Mention the change in behavior.
NEWS
doc/coreutils.texi
src/copy.c
tests/Makefile.am
tests/cp/attr-existing [new file with mode: 0755]