bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

cp -u vs. vfat's TWO seconds


From: jidanni
Subject: cp -u vs. vfat's TWO seconds
Date: Mon, 31 Mar 2008 23:48:37 +0800

Bad news fellows, regarding:

    `-u'
    `--update'
     Do not copy a non-directory that has an existing destination with
     the same or newer modification time.  If time stamps are being
     preserved, the comparison is to the source time stamp truncated to
     the resolutions of the destination file system and of the system
     calls used to update time stamps; this avoids duplicate work if
     several `cp -pu' commands are executed with the same source and
     destination.

Well it just so happens that the resolution on all(?) vfat flash
cards, is TWO seconds,

$ w3m -dump http://en.wikipedia.org/wiki/File_Allocation_Table | grep 2\ sec
                 Note that the seconds is recorded only to a 2 second

$ cd some/directory/on/my/vfat/flash_card
$ stat *|perl -nwe 'm/^Modify:.*(\d\d)\.000/&&print " $1"'; echo
 04 02 02 02 24 04 04 58 00 24 16 58 58 02 34
--all TWO seconds, (so they are always even numbers above.)

This means that
set /non-vfat/file /vfat/file
$ cp -p $1 $2 #if done during an odd-numbered second of time,
$ cp -u $1 $2 #will cause this second line to wastefully fire again.

So please investigate your claim that
     the comparison is to the source time stamp truncated to
     the resolutions of the destination file system
I bet that you never dreamed that you had to consider more than
one second vs. fractional second differences.

cp (GNU coreutils) 6.10




reply via email to

[Prev in Thread] Current Thread [Next in Thread]