Peter Breitenlohner <peb <at> mppmu.mpg.de> writes: > ~> touch -r file2 file3; cp -p file2 file4; ls -l --full-time file? > > -rw-r--r-- 1 peb THEORY 6 2009-12-07 14:20:04.460965546 +0100 file1 > > -rw-r--r-- 1 peb THEORY 6 2009-12-07 14:20:04.964956156 +0100 file2 > > -rw-r--r-- 1 peb THEORY 0 2009-12-07 14:20:05.000000000 +0100 file3 > > -rw-r--r-- 1 peb THEORY 6 2009-12-07 14:20:05.000000000 +0100 file4 > As I knew already from trying to understand a similar problem, 'cp -p' and > 'touch -r' both round sub-seconds, whereas tar and rsync truncate them.
Ouch. When a timestamp can't be written to full precision, POSIX requires truncation, not rounding. Is this coreutils cp? At any rate, we should report the bug that cp is rounding timestamps. -- Eric Blake