bug-fileutils
[Top][All Lists]
Advanced

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

[cp (GNU fileutils) 4.0] Timestamp rounding for cp -p


From: Vincent Lefevre
Subject: [cp (GNU fileutils) 4.0] Timestamp rounding for cp -p
Date: Thu, 12 Oct 2000 10:43:43 +0200
User-agent: Mutt/1.2.5i

Hi,

In cp.c (fileutils 4.0):

[...]
      if (x->preserve_timestamps)
        {
          struct utimbuf utb;

          /* There's currently no interface to set file timestamps with
             better than 1-second resolution, so discard any fractional
             part of the source timestamp.  */
[...]

You should round upwards, otherwise "cp -pu" doesn't work as expected:

$ touch blah2
$ touch blah1
zsh: correct 'blah1' to 'blah2' [nyae]? n
$ ls -l blah1 blah2
-rw-r--r--   1 vlefevre lip             0 Oct 11 14:23 blah1
-rw-r--r--   1 vlefevre lip             0 Oct 11 14:23 blah2
$ \cp -puv blah1 blah2
blah1 -> blah2
$ \cp -puv blah1 blah2
blah1 -> blah2
$ touch blah2
$ \cp -puv blah1 blah2
$ \cp --version
cp (GNU fileutils) 4.0
$ uname -a
SunOS vin 5.7 Generic_106541-12 sun4u sparc SUNW,Ultra-5_10

The second cp shouldn't have copied anything.

Regards,

-- 
Vincent Lefèvre <address@hidden> - Web: <http://www.vinc17.org/> - 100%
validated HTML - Acorn Risc PC, Yellow Pig 17, Championnat International des
Jeux Mathématiques et Logiques, TETRHEX, etc.
Work: CR INRIA - computer arithmetic / PolKA research team at LORIA



reply via email to

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