On Fri, 4 Dec 2009, Ralf Wildenhues wrote:
One involved tool is perl: perl -e 'use File::stat; print (stat("README")->mtime . "\n");'
Hi Ralf, all my tests are for x86_64-linux (however, the utilities are 32Bit ones) on a jfs partition (I think ext2 doesn't have subsecond time stamps). ~> ls -l --fu README -rw-r--r-- 1 peb THEORY 0 2009-12-07 14:15:16.791586449 +0100 README ~> perl -e 'use File::stat; print (stat("README")->mtime . "\n");' 1260191716 ~> date -r README +%s 1260191716 This is perl, v5.10.0 built for ix86-linux-gnu touch (GNU coreutils) 7.4
Another is the shell/test, and ls: Create two files with same-second but different sub-second time stamps (try until this succeeds): echo stamp > file1 echo stamp > file2 ls -l --full-time file?
~> echo stamp > file1;sleep 0.5; echo stamp > file2; ls -l --fu 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
then test 'test' and 'ls': if test file2 -nt file1; then echo "shell test uses sub-second"; fi if /usr/bin/test file2 -nt file1; then echo "/usr/bin/test uses sub-second"; fi set X `ls -Lt file1 file2` if test $3 = file1; then echo "ls uses sub-second"; fi
~> if test file2 -nt file1; then echo "shell test uses sub-second" > else echo "no"; fi no ~> if /bin/test file2 -nt file1; then > echo "/bin/test uses sub-second"; else echo "no"; fi /bin/test uses sub-second ~> set X `ls -Lt file1 file2` ~> if test $3 = file1; then echo "ls uses sub-second"; else echo "no"; fi ls uses sub-second
For completeness let's also test 'make': echo 'file1: file2; echo "make uses sub-second"' > Makefile make
~> echo 'file1: file2; echo "make uses sub-second"' > Makefile ~> make echo "make uses sub-second" make uses sub-second
and whether 'touch -r' can generate sub-second stamps: : > foo touch -r foo bar ls -l --full-time foo bar
~> 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.
This shows that the second "autoconf" did not update configure. Can you post, for this same build, also ls -lrt --fu autom4te.cache
-rw-r--r-- 1 peb THEORY 66570 2009-12-04 11:57:00.858053547 +0100 output.0 -rw-r--r-- 1 peb THEORY 66570 2009-12-04 11:57:01.062638375 +0100 output.1 -rw-r--r-- 1 peb THEORY 66570 2009-12-04 11:57:01.505099509 +0100 output.2 -rw-r--r-- 1 peb THEORY 11851 2009-12-04 11:57:01.650015678 +0100 requests -rw-r--r-- 1 peb THEORY 32184 2009-12-04 11:57:00.858053547 +0100 traces.0 -rw-r--r-- 1 peb THEORY 14302 2009-12-04 11:57:01.062638375 +0100 traces.1 -rw-r--r-- 1 peb THEORY 32257 2009-12-04 11:57:01.505099509 +0100 traces.2
Let's see if your data confirms this. I just tried out my Cygwin install: tool sub-second? ----------------------------- file system yes
certainly depends on the file system (could this be vfat?)
perl no shell test no /usr/bin/test yes ls yes make yes touch -r yes
here our coreutils 7.4 differ
Ugh. If Cygwin weren't so slow, it would fall prey to this issue, too. I think we either need to reintroduce the 'sleep 1' in the build sanity check, or some other way to ensure that a file newly created by configure has a time stamp with a strictly larger integer part than the time stamp of the configure script. Any ideas of what the most portable way to achieve this could be?
In view of the fact demonstrated above that the sub-seconds could be honored, truncated, or rounded, the actual requirement might be somewhat more stringent, but of course 1sec difference should always suffice.
We may be able to get by with something like spawning off a ( sleep 1 ) & early in the configure script, and ensuring that it has completed before we get to config.status creation. I'm a bit afraid of introducing 'kill' into configure scripts, however. Any less dangerous ideas?
How about '( sleep 1; CREATE_A_FILE ) &' and later waiting until that file exists? Regards Peter Breitenlohner <p...@mppmu.mpg.de>