From 3d53e7fe1c31aa440cc9708c7c51db6b78c07653 Mon Sep 17 00:00:00 2001 From: Pádraig Brady Date: Thu, 12 Apr 2012 12:47:30 +0100 Subject: 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. --- doc/coreutils.texi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'doc') diff --git a/doc/coreutils.texi b/doc/coreutils.texi index 510abb903..1fbf05116 100644 --- a/doc/coreutils.texi +++ b/doc/coreutils.texi @@ -7649,9 +7649,9 @@ Equivalent to @option{-dR --preserve=all} with the reduced diagnostics. @itemx --attributes-only @opindex --attributes-only -Preserve the specified attributes of the original files in the copy, -but do not copy any data. See the @option{--preserve} option for -controlling which attributes to copy. +Copy only the specified attributes of the source file to the destination. +If the destination already exists, do not alter its contents. +See the @option{--preserve} option for controlling which attributes to copy. @item -b @itemx @w{@kbd{--backup}[=@var{method}]} -- cgit v1.2.3-70-g09d2