bug-coreutils
[Top][All Lists]
Advanced

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

Re: cp -u vs. vfat's TWO seconds


From: Jim Meyering
Subject: Re: cp -u vs. vfat's TWO seconds
Date: Wed, 02 Apr 2008 08:54:09 +0200

address@hidden wrote:

> 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.

Yes, it's unfortunate that FAT does not allow for
higher resolution st_mtime, like it does for creation time.
Yet another reason to avoid FAT, whenever possible.

It'd be great if you would suggest wording to document this discrepancy.




reply via email to

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