GNU bug report logs -
#8370
RFC: cp --no-preserve=contents
Previous Next
Reported by: Eric Blake <eblake <at> redhat.com>
Date: Mon, 28 Mar 2011 21:06:01 UTC
Severity: normal
Done: Eric Blake <eblake <at> redhat.com>
Bug is archived. No further changes may be made.
Full log
Message #25 received at 8370 <at> debbugs.gnu.org (full text, mbox):
I like this idea too. Some comments:
> 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.
> +but do not copy any data. Data in existing destination files is not
> +truncated. See the @option{--preserve} option for controlling which
> +attributes to copy.
The word "data" is plural. But there is no need to talk about
truncation: the point is that the file's contents aren't changed at
all. Something like this, maybe?
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.
> - dest_desc = open (dst_name, O_WRONLY | O_TRUNC | O_BINARY);
> + /* We don't truncate with --attributes-only to support
> + copying attributes to an existing file. */
> + dest_desc = open (dst_name, O_WRONLY | O_BINARY
> + | (x->data_copy_required ? O_TRUNC : 0));
The indentation of the flags expression isn't right, and the
comment is unnecessary clutter (the code is clear). Perhaps something
like this instead?
int open_flags =
O_WRONLY | O_BINARY | (x->data_copy_required ? O_TRUNC : 0);
dest_desc = open (dst_name, open_flags);
This bug report was last modified 13 years and 120 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.