cp -p loses precision on the timestamp of the copy
From:
Ray Liere
Subject:
cp -p loses precision on the timestamp of the copy
Date:
Thu, 31 Jan 2008 18:53:16 -0800
User-agent:
Mutt/1.5.4i
Consider the following use of cp -p to create an identical copy (identical
in content and in timestamps, etc.):
# echo xxx > jnk
# ls --full-time jnk
-rw------- 1 root root 4 2008-01-31 18:40:27.879358240 -0800 jnk
# cp -p jnk jnkcopy
# ls --full-time jnk*
-rw------- 1 root root 4 2008-01-31 18:40:27.879358240 -0800 jnk
-rw------- 1 root root 4 2008-01-31 18:40:27.879358000 -0800 jnkcopy
# ls --version
ls (coreutils) 5.2.1
Written by Richard Stallman and David MacKenzie.
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
Note that the timestamp values are NOT the same.
I ran into this when (trying) to use cp -p as a way of remembering when
the original version of a file was created (i.e., I later then compared
the timestamps of jnk and jnkcopy ... but due to the loss of precision
in the copy, they will rarely be equal).
Ray Liere