automake-patches
[Top][All Lists]
Advanced

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

sub-second time stamp issues (was: [PATCH] Automake-git testsuite failur


From: Ralf Wildenhues
Subject: sub-second time stamp issues (was: [PATCH] Automake-git testsuite failures: aclocal9, acloca10, nodef)
Date: Wed, 9 Dec 2009 20:08:58 +0100
User-agent: Mutt/1.5.20 (2009-10-28)

Hello Peter,

thanks for the detailed feedback!

* Peter Breitenlohner wrote on Mon, Dec 07, 2009 at 03:08:34PM CET:
> On Fri, 4 Dec 2009, Ralf Wildenhues wrote:
> 
>  ~> 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.  That's even worse.  The text at 'Timestamps and Make' in the
Autoconf manual needs updating for this.

That can hurt user-written makefile rules that use `cp -p' or `touch
-r'.  sanity.m4 can't help it really, because this can at best cause
spurious rebuilds of all kinds of things, and at worst not cause
updating of some targets.

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

Yes.  I've applied the revert patch below on a new branch branched off
the bogus patch and merged it in branch-1.11 for now.  (The patch was
done with 'git revert' plus edits afterwards; sorry.  The new branch is
to allow me to decide later whether I want this revert in master, too.)

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

We can think about something smarter for master, yes.

Thanks,
Ralf

    Revert "Avoid sleeping for one second most of the time in sanity check."
    
    Not sleeping in the configure sanity check breaks several tests
    on systems that provide sub-second time stamps, when only some
    of the tools support them, some truncate them, and other round
    them.
    Report by Peter Breitenlohner and others.
    
    This reverts commit f6b3f7fb620580356865ebedfbaf76af3e534369.

diff --git a/m4/sanity.m4 b/m4/sanity.m4
index db87c8b..3d2f304 100644
--- a/m4/sanity.m4
+++ b/m4/sanity.m4
@@ -1,18 +1,21 @@
 # Check to make sure that the build environment is sane.    -*- Autoconf -*-
 
-# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008, 2009
+# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
 # Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 6
+# serial 5
 
 # AM_SANITY_CHECK
 # ---------------
 AC_DEFUN([AM_SANITY_CHECK],
 [AC_MSG_CHECKING([whether build environment is sane])
+# Just in case
+sleep 1
+echo timestamp > conftest.file
 # Reject unsafe characters in $srcdir or the absolute working directory
 # name.  Accept space and tab only in the latter.
 am_lf='
@@ -32,30 +35,23 @@ esac
 # (eg FreeBSD returns the mod time of the symlink's containing
 # directory).
 if (
-   for am_try in 1 2; do
-     echo timestamp > conftest.file
-     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
-     if test "$[*]" = "X"; then
-       # -L didn't work.
-       set X `ls -t "$srcdir/configure" conftest.file`
-     fi
-     rm -f conftest.file
-     if test "$[*]" != "X $srcdir/configure conftest.file" \
-       && test "$[*]" != "X conftest.file $srcdir/configure"; then
+   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
+   if test "$[*]" = "X"; then
+      # -L didn't work.
+      set X `ls -t "$srcdir/configure" conftest.file`
+   fi
+   rm -f conftest.file
+   if test "$[*]" != "X $srcdir/configure conftest.file" \
+      && test "$[*]" != "X conftest.file $srcdir/configure"; then
+
+      # If neither matched, then we have a broken ls.  This can happen
+      # if, for instance, CONFIG_SHELL is bash and it inherits a
+      # broken ls alias from the environment.  This has actually
+      # happened.  Such a system could not be considered "sane".
+      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
+alias in your environment])
+   fi
 
-       # If neither matched, then we have a broken ls.  This can happen
-       # if, for instance, CONFIG_SHELL is bash and it inherits a
-       # broken ls alias from the environment.  This has actually
-       # happened.  Such a system could not be considered "sane".
-       AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
-  alias in your environment])
-     fi
-     if test "$[2]" = conftest.file || test $am_try -eq 2; then
-       break
-     fi
-     # Just in case.
-     sleep 1
-   done
    test "$[2]" = conftest.file
    )
 then




reply via email to

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