From unknown Wed Aug 20 00:21:06 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#67670] [PATCH] Revise tests for file mtime resolution again. Resent-From: "Zack Weinberg" Original-Sender: "Debbugs-submit" Resent-CC: automake-patches@gnu.org Resent-Date: Wed, 06 Dec 2023 22:07:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 67670 X-GNU-PR-Package: automake-patches X-GNU-PR-Keywords: patch To: 67670@debbugs.gnu.org Cc: Mike Frysinger , Jacob Bachmeyer , Karl Berry X-Debbugs-Original-To: automake-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.170190039613977 (code B ref -1); Wed, 06 Dec 2023 22:07:02 +0000 Received: (at submit) by debbugs.gnu.org; 6 Dec 2023 22:06:36 +0000 Received: from localhost ([127.0.0.1]:40591 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rB02N-0003dM-II for submit@debbugs.gnu.org; Wed, 06 Dec 2023 17:06:36 -0500 Received: from lists.gnu.org ([2001:470:142::17]:35666) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rB02H-0003d3-6m for submit@debbugs.gnu.org; Wed, 06 Dec 2023 17:06:33 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rB01y-0004ZC-MP for automake-patches@gnu.org; Wed, 06 Dec 2023 17:06:10 -0500 Received: from wout4-smtp.messagingengine.com ([64.147.123.20]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rB01v-0005uc-KT for automake-patches@gnu.org; Wed, 06 Dec 2023 17:06:10 -0500 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 16F8E3200A6F; Wed, 6 Dec 2023 17:06:06 -0500 (EST) Received: from imap45 ([10.202.2.95]) by compute5.internal (MEProxy); Wed, 06 Dec 2023 17:06:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=owlfolio.org; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:message-id:mime-version:reply-to :sender:subject:subject:to:to; s=fm3; t=1701900365; x= 1701986765; bh=xPVy/O1h3wTmi1t2/IDMGyecoVHWK3TVi1A0gWU4vdM=; b=h WjwHZa6YU/WC9eSmQDLl40UKzfVJ9PdO4DGXOE1RYt3LKcOYH9vlQezcxv0Ul75/ /WKNSguZ3mRXHGDF9H8UE2eQIXUNYDtFGFRVwTg5f1pb+5f4lI+OWVGSkF0/MYxJ +Vb2SAjaZarvHaAauStWVRsPxAqESaJ1G/4s77QLy89u1WzZ2G/SKCfK1HURzwRL rDKrTnW8JU/bxIK0JtJQZhRBQ9HV4wG2xg/5z+687RH7ss1agphwyY7dS2qPiy18 ooYeZIyVs/KmopI40bB7e38trHZixG1S6IwjwIJHuc9bR4fFwRTE36LOu5s7fHtD QnozNqB+O0J+DbHExs5lQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:message-id:mime-version:reply-to:sender :subject:subject:to:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; t=1701900365; x=1701986765; bh=x PVy/O1h3wTmi1t2/IDMGyecoVHWK3TVi1A0gWU4vdM=; b=dG2PLUiwh33QskkCT KgjsLmx61H8kPhCx0Yc5NQfkxlkiRIeoMgBqQaxRn3Jh2jQUqGhActxxSH1Xw8eA 9Q2pJOfFgUzX5IOSv7FNbSETJmiyrA9/Uv6InTiev8v8Kwic2/OwEV5lTBkJ8+JN l/e982WZj8bHAO8z8I/4xGXlFFiBOz/CM0znD7nV8lqh0QLXh0GjmWoYg4oSTX06 ZBJQRPB/23KNfVMVNCun0gIBpiP9pvidA2FHS9Iz3kk/lVgsqqG/QePKjzbzPpsG Ag8vndIZke9lK+IhH2pPwiORKcyvbt3vcOqy9kpEi0vVY7l37l/+WWFwdSwfbKW3 sbrpg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudektddgudeitdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefofgggkfffhffvvefutgfgsehtqhertderreejnecuhfhrohhmpedfkggr tghkucghvghinhgsvghrghdfuceoiigrtghksehofihlfhholhhiohdrohhrgheqnecugg ftrfgrthhtvghrnhepvdevfeduvddtieefleevhfetfedtuefhieetlefhteetjedtkeeh udfgfeeijedvnecuffhomhgrihhnpehgnhhurdhorhhgpdhfihhlvghuthhilhhsrdhpmh enucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpeiirggt khesohiflhhfohhlihhordhorhhg X-ME-Proxy: Feedback-ID: i876146a2:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 59256272007B; Wed, 6 Dec 2023 17:06:05 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.9.0-alpha0-1178-geeaf0069a7-fm-20231114.001-geeaf0069 MIME-Version: 1.0 Message-Id: <40999a06-8d6b-49f1-9e82-e02f95e46938@app.fastmail.com> Date: Wed, 06 Dec 2023 17:04:21 -0500 From: "Zack Weinberg" Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=64.147.123.20; envelope-from=zack@owlfolio.org; helo=wout4-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.6 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.4 (/) In order for the Automake testsuite to be able to use sub-second delays = to control whether certain files are considered newer than others, five(!) separate pieces of software all need to cooperate: automake itself, autoconf=E2=80=99s internal =E2=80=9Cautom4te=E2=80=9D utility, the Perl= interpreter and its libraries, the sleep(1) shell utility, and finally the filesystem hosting the build directory. The existing tests for this are a combination of inadequate and incorrect. This patch, in conjunction with a patch just committed to Autoconf trunk https://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=3D39d96e6fff7c= eae63b823872602caf4d255a38c8 should make everything much more robust, as follows: - _AM_FILESYSTEM_TIMESTAMP_RESOLUTION is completely rewritten. It no longer looks for autom4te at all, because this macro is invoked unconditionally from AM_INIT, so *every* project that uses Automake would get this test that=E2=80=99s only relevant to Automake=E2=80=99s= own testsuite. Also, it tries sleeping for as little as one millisecond (smaller dela= ys consistently get rounded up to 1ms on my computer and I expect that=E2= =80=99s universal), it should accurately detect FAT=E2=80=99s two-second resol= ution now, and it should not be tripped up anymore by running at precisely the moment that will make a 0.1s sleep cross a 1s boundary (this may sound unlikely but it used to cause a couple of test failures *every time* I ran the automake testsuite on a network filesystem that only supported 1s resolution). - In support of the above, the test for working ls -t moved from AM_SANITY_CHECK to _AM_FILESYSTEM_TIMESTAMP_RESOLUTION. This allowed me to simplify the test for $srcdir/configure being older than a freshly created file. - If automake is capable of reading high-resolution file modification timestamps from the operating system, it prints =E2=80=9CFeatures: sub= second-mtime=E2=80=9D as the second line of --version output. (We can=E2=80=99t just assume= this works for sufficiently new automake, because it depends on whether the Perl interpreter provides this capability, and that=E2=80=99s not a si= mple question of which version of Perl you have either.) - The Autoconf patch mentioned above adds the same annotation to the output of autom4te --version. - Finally, t/ax/test-defs.in looks for the =E2=80=9CFeatures: subsecond-= mtime=E2=80=9D string from both automake and autom4te and resets the sleep time to one second if it=E2=80=99s not there. There might be a better place t= o put this, somewhere it=E2=80=99ll execute every time the *overall testsuite* is = invoked rather than once for each test, but I couldn=E2=80=99t find one. Tested on x86-64-linux with development automake and development autocon= f. Previous discussion: - https://lists.gnu.org/archive/html/automake/2023-03/msg00000.html - https://lists.gnu.org/archive/html/automake/2023-04/msg00002.html - https://lists.gnu.org/archive/html/automake/2023-12/msg00005.html - https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D64756 ChangeLog: * m4/sanity.m4 (_AM_FILESYSTEM_TIMESTAMP_RESOLUTION): Rewrite for greater reliability. Don=E2=80=99t probe autom4te at all here. Check for wor= king =E2=80=9Cls -t=E2=80=9D here. (AM_SANITY_CHECK): Do not cache the result. Do not check for working =E2=80=9Cls -t=E2=80=9D check here. Disentangle control flow in the l= oop probing the relative ages of build and source directory. * lib/Automake/FileUtils.pm: Sync from autoconf. * bin/automake.in (version): Include =E2=80=9CFeatures: subsecond-mtime=E2= =80=9D in the output if $Automake::FileUtils::subsecond_mtime is true. * configure.ac: Rename the substitution variable MODIFICATION_DELAY to MTIME_RESOLUTION. * t/ax/test-defs.in: Require both $AUTOMAKE and $AUTOM4TE to report support for high-resolution timestamps before setting $sleep to delay for less than one second. --- bin/automake.in | 17 ++-- configure.ac | 9 +- lib/Automake/FileUtils.pm | 71 +++++++++++----- m4/sanity.m4 | 171 ++++++++++++++++++++------------------ t/ax/test-defs.in | 26 ++++-- 5 files changed, 180 insertions(+), 114 deletions(-) diff --git a/bin/automake.in b/bin/automake.in index c0ffc1986..820d0d541 100644 --- a/bin/automake.in +++ b/bin/automake.in @@ -8271,16 +8271,19 @@ General help using GNU software: . =20 sub version () { - print < + print "automake (GNU $PACKAGE) $VERSION\n"; + print "Features: subsecond-mtime\n" + if $Automake::FileUtils::subsecond_mtime; + print "\nCopyright (C) $RELEASE_YEAR Free Software Foundation, Inc."; + print ' +License GPLv2+: GNU GPL version 2 or later + This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. =20 -Written by Tom Tromey - and Alexandre Duret-Lutz . -EOF +Written by Tom Tromey + and Alexandre Duret-Lutz . +'; # --version always returns 0 per GNU standards. exit 0; } diff --git a/configure.ac b/configure.ac index 5cda80a18..33aec7788 100644 --- a/configure.ac +++ b/configure.ac @@ -180,9 +180,6 @@ result=3Dno test "x$am_cv_prog_ln" =3D xln && result=3Dyes AC_MSG_RESULT([$result]) =20 -MODIFICATION_DELAY=3D$am_cv_filesystem_timestamp_resolution -AC_SUBST([MODIFICATION_DELAY]) - ## ------------------------------------------- ## ## Test for things needed by the test suite. ## ## ------------------------------------------- ## @@ -190,6 +187,12 @@ AC_SUBST([MODIFICATION_DELAY]) AC_PROG_EGREP AC_PROG_FGREP =20 +# The test suite needs to know the resolution of timestamps +# supported by the filesystem hosting the build. The value +# will be acceptable to 'sleep' on this system. +MTIME_RESOLUTION=3D$am_cv_filesystem_timestamp_resolution +AC_SUBST([MTIME_RESOLUTION]) + dnl FIXME: could we extract this in a simpler way through autoconf dnl FIXME: idioms or internals? AC_DEFUN( diff --git a/lib/Automake/FileUtils.pm b/lib/Automake/FileUtils.pm index 8d0b36802..553d5c6dc 100644 --- a/lib/Automake/FileUtils.pm +++ b/lib/Automake/FileUtils.pm @@ -38,24 +38,45 @@ use 5.006; use strict; use warnings FATAL =3D> 'all'; =20 -use Exporter; +BEGIN +{ + require Exporter; + our @ISA =3D qw (Exporter); + our @EXPORT =3D qw (&contents + &find_file &mtime + &update_file + &xsystem &xsystem_hint &xqx + &dir_has_case_matching_file &reset_dir_cache + &set_dir_cache_file); +} + +# Use sub-second resolution file timestamps if available, carry on +# with one-second resolution timestamps if Time::HiRes is not available. +# +# Unfortunately, even if Time::HiRes is available, we don't get +# timestamps to the full precision recorded by the operating system, +# because Time::HiRes converts timestamps to floating-point, and the +# rounding error is hundreds of nanoseconds for circa-2023 timestamps +# in IEEE double precision. But this is the best we can do without +# dropping down to C. +# +# $subsecond_mtime is not exported, but is intended for external +# consumption, as $Automake::FileUtils::subsecond_mtime. +BEGIN +{ + our $subsecond_mtime =3D 0; + eval + { + require Time::HiRes; + import Time::HiRes qw(stat); + $subsecond_mtime =3D 1; + } +} + use IO::File; - -# use sub-second resolution timestamps if available, -# carry on with one-second resolution timestamps if that is all we have -BEGIN { eval { require Time::HiRes; import Time::HiRes qw(stat) } } - use Automake::Channels; use Automake::ChannelDefs; =20 -our @ISA =3D qw (Exporter); -our @EXPORT =3D qw (&contents - &find_file &mtime - &update_file - &xsystem &xsystem_hint &xqx - &dir_has_case_matching_file &reset_dir_cache - &set_dir_cache_file); - =3Dover 4 =20 =3Ditem C @@ -122,11 +143,6 @@ sub mtime ($) $atime,$mtime,$ctime,$blksize,$blocks) =3D stat ($file) or fatal "cannot stat $file: $!"; =20 - # Unfortunately Time::HiRes converts timestamps to floating-point, an= d the - # rounding error can be hundreds of nanoseconds for circa-2023 timest= amps. - # Perhaps some day Perl will support accurate file timestamps. - # For now, do the best we can without going outside Perl. - return $mtime; } =20 @@ -394,3 +410,20 @@ sub set_dir_cache_file ($$) =3Dcut =20 1; # for require + +### Setup "GNU" style for perl-mode and cperl-mode. +## Local Variables: +## perl-indent-level: 2 +## perl-continued-statement-offset: 2 +## perl-continued-brace-offset: 0 +## perl-brace-offset: 0 +## perl-brace-imaginary-offset: 0 +## perl-label-offset: -2 +## cperl-indent-level: 2 +## cperl-brace-offset: 0 +## cperl-continued-brace-offset: 0 +## cperl-label-offset: -2 +## cperl-extra-newline-before-brace: t +## cperl-merge-trailing-else: nil +## cperl-continued-statement-offset: 2 +## End: diff --git a/m4/sanity.m4 b/m4/sanity.m4 index 8887a0c98..93c4854b9 100644 --- a/m4/sanity.m4 +++ b/m4/sanity.m4 @@ -15,66 +15,87 @@ AS_IF([sleep 0.001 2>/dev/null], [am_cv_sleep_fracti= onal_seconds=3Dtrue], [am_cv_s =20 # _AM_FILESYSTEM_TIMESTAMP_RESOLUTION # ----------------------------------- -# Determine the filesystem timestamp resolution. Modern systems are -# nanosecond capable, but historical systems could have millisecond, -# second, or even 2-second resolution. +# Determine the filesystem's resolution for file modification +# timestamps. The coarsest we know of is FAT, with a resolution +# of only two seconds, even with the most recent "exFAT" extensions. +# The finest (e.g. ext4 with large inodes, XFS, ZFS) is one +# nanosecond, matching clock_gettime. However, it is probably not +# possible to delay execution of a shell script for less than one +# millisecond, due to process creation overhead and scheduling +# granularity, so we don't check for anything finer than that. AC_DEFUN([_AM_FILESYSTEM_TIMESTAMP_RESOLUTION], [dnl AC_REQUIRE([_AM_SLEEP_FRACTIONAL_SECONDS]) -# -# Check if Autom4te uses Time::HiRes. If not, we cannot use fractional = sleep, -# because this sanity test and automated tests will be unreliable due to -# Autom4te's caching of results and comparing timestamps. -# More info: long thread around -# https://lists.gnu.org/archive/html/automake/2023-04/msg00002.html -# and https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D64756. -# By the way, we cannot use Perl to see if %INC{q[Time/HiRes.pm]} is -# defined, because Time::HiRes might get pulled in from other system -# modules even when not used directly. (An idea suggested in that thr= ead.) -AC_PATH_PROG([AUTOM4TE], [autom4te]) -if test x"$autom4te_perllibdir" =3D x; then - autom4te_perllibdir=3D`sed -n \ - '/autom4te_perllibdir/{s/^.*|| //;s/;$//;s/^.//;s/.$//;p;q}' <$AUTOM= 4TE` -fi -if grep HiRes "$autom4te_perllibdir"/Autom4te/FileUtils.pm >/dev/null; = then - : -else - am_cv_sleep_fractional_seconds=3Dfalse +AC_CACHE_CHECK([the filesystem timestamp resolution], am_cv_filesystem_= timestamp_resolution, [dnl +# Default to the worst case. +am_cv_filesystem_timestamp_resolution=3D2 + +# Only try to go finer than 1s if sleep can do it. +am_try_resolutions=3D1 +if $am_cv_sleep_fractional_seconds; then + am_try_resolutions=3D"0.001 0.01 0.1 $am_try_resolutions" fi =20 -AC_CACHE_CHECK([the filesystem timestamp resolution], am_cv_filesystem_= timestamp_resolution, [dnl -# Use names that lexically sort older-first when the timestamps are equ= al. -rm -f conftest.file.a conftest.file.b -: > conftest.file.a -AS_IF([$am_cv_sleep_fractional_seconds], [dnl - am_try_sleep=3D0.1 am_try_loops=3D20 -], [dnl - am_try_sleep=3D1 am_try_loops=3D2 -]) -am_try=3D0 -while :; do - AS_VAR_ARITH([am_try], [$am_try + 1]) - echo "timestamp $am_try" > conftest.file.b - set X `ls -t conftest.file.a conftest.file.b` - if test "$[2]" =3D conftest.file.b || test $am_try -eq $am_try_loops;= then +# In order to catch current-generation FAT out, we must *modify* files +# that already exist; the *creation* timestamp is finer. Use names +# that make ls -t sort them differently when they have equal +# timestamps than when they have distinct timestamps, keeping +# in mind that ls -t prints the *newest* file first. +rm -f conftest.ts? +: > conftest.ts1 +: > conftest.ts2 +: > conftest.ts3 + +# Make sure ls -t actually works. Do 'set' in a subshell so we don't +# clobber the current shell's arguments. +if ( + set X `[ls -t conftest.ts[12]]` && + { + test "$[*]" !=3D "X conftest.ts1 conftest.ts2" || + test "$[*]" !=3D "X conftest.ts2 conftest.ts1"; + } +); then :; else + # 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". + _AS_ECHO_UNQUOTED( + ["Bad output from ls -t: \"`[ls -t conftest.ts[12]]`\""], + [AS_MESSAGE_LOG_FD]) + AC_MSG_FAILURE([ls -t produces unexpected output. +Make sure there is not a broken alias in your environment.]) +fi + +for am_try_res in $am_try_resolutions; do + # Any one fine-grained sleep might happen to cross the boundary + # between two values of a coarser actual resolution, but if we do + # two fine-grained sleeps in a row, at least one of them will fall + # entirely within a coarse interval. + echo alpha > conftest.ts1 + sleep $am_try_res + echo beta > conftest.ts2 + sleep $am_try_res + echo gamma > conftest.ts3 + + # We assume that 'ls -t' will make use of high-resolution + # timestamps if the operating system supports them at all. + if (set X `ls -t conftest.ts?` && + test "$[]2" =3D conftest.ts3 && + test "$[]3" =3D conftest.ts2 && + test "$[]4" =3D conftest.ts1); then + am_cv_filesystem_timestamp_resolution=3D$am_try_res break fi - sleep $am_try_sleep done -rm -f conftest.file.a conftest.file.b -am_cv_filesystem_timestamp_resolution=3D$am_try -AS_IF([$am_cv_sleep_fractional_seconds], [dnl - AS_VAR_ARITH([am_cv_filesystem_timestamp_resolution], [$am_try / 10]) - AS_VAR_ARITH([am_fraction], [$am_try % 10]) - AS_VAR_APPEND([am_cv_filesystem_timestamp_resolution], [.$am_fraction= ]) -]) +rm -f conftest.ts? ])]) =20 # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_REQUIRE([_AM_FILESYSTEM_TIMESTAMP_RESOLUTION]) -rm -f conftest.file -AC_CACHE_CHECK([whether build environment is sane], am_cv_build_env_is_= sane, [dnl +# This check should not be cached, as it may vary across builds of +# different projects. +AC_MSG_CHECKING([whether build environment is sane]) # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=3D' @@ -93,41 +114,33 @@ esac # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). -if ( - am_has_slept=3Dno - for am_try in 1 2; do - echo "timestamp, slept: $am_has_slept" > conftest.file - set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` - if test "$[*]" =3D "X"; then - # -L didn't work. - set X `ls -t "$srcdir/configure" conftest.file` - fi - if test "$[*]" !=3D "X $srcdir/configure conftest.file" \ - && test "$[*]" !=3D "X conftest.file $srcdir/configure"; then +am_build_env_is_sane=3Dno +am_has_slept=3Dno +rm -f conftest.file +for am_try in 1 2; do + echo "timestamp, slept: $am_has_slept" > conftest.file + if ( + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$[*]" =3D "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + test "$[2]" =3D conftest.file + ); then + am_build_env_is_sane=3Dyes + break + fi + # Just in case. + sleep $am_cv_filesystem_timestamp_resolution + am_has_slept=3Dyes +done =20 - # 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]" =3D conftest.file || test $am_try -eq 2; then - break - fi - # Just in case. - sleep $am_cv_filesystem_timestamp_resolution - am_has_slept=3Dyes - done - test "$[2]" =3D conftest.file - ) -then - am_cv_build_env_is_sane=3Dyes -else - AC_MSG_ERROR([newly created file is older than distributed files! +AC_MSG_RESULT([$am_build_env_is_sane]) +if test $am_build_env_is_sane =3D no; then + AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi -]) + # If we didn't sleep, we still need to ensure time stamps of config.sta= tus and # generated files are strictly newer. am_sleep_pid=3D diff --git a/t/ax/test-defs.in b/t/ax/test-defs.in index e09a387cd..696403ee0 100644 --- a/t/ax/test-defs.in +++ b/t/ax/test-defs.in @@ -177,12 +177,26 @@ GNU_GCJFLAGS=3D${AM_TESTSUITE_GNU_GCJFLAGS-${GNU_G= CJFLAGS-'@GNU_GCJFLAGS@'}} # this variable. TEX=3D${AM_TESTSUITE_TEX-'@TEX@'} =20 -# The amount we should wait after modifying files depends on the platfo= rm. -# For instance, Windows '95, '98 and ME have 2-second granularity -# and can be up to 3 seconds in the future w.r.t. the system clock. -# The creative quoting is to avoid spuriously triggering a failure in -# the maintainer checks, -sleep=3D'sleep ''@MODIFICATION_DELAY@' +# The time we should wait after modifying files depends on the platform= , and +# also the capabilities of the 'automake' and 'autom4te' programs, whic= h in +# turn depend on the capabilities of the Perl interpreter. configure h= as +# detected the platform's resolution for file modification times; we st= ill +# need to check automake and autom4te. +MTIME_RESOLUTION=3D'@MTIME_RESOLUTION@' +case $MTIME_RESOLUTION in + 1 | 2) ;; # Can assume these values are usable as is. + *) + if $AUTOMAKE --version 2>&1 | + grep 'Features:.*subsecond-mtime' > /dev/null 2>&1 && + $AUTOM4TE --version 2>&1 | + grep 'Features:.*subsecond-mtime' > /dev/null 2>&1; then + : + else + MTIME_RESOLUTION=3D1 + fi + ;; +esac +sleep=3D"sleep $MTIME_RESOLUTION" =20 # An old timestamp that can be given to a file, in "touch -t" format. # The time stamp should be portable to all file systems of interest. --=20 2.41.0 From unknown Wed Aug 20 00:21:06 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#67670] [PATCH] Revise tests for file mtime resolution again. References: <40999a06-8d6b-49f1-9e82-e02f95e46938@app.fastmail.com> Resent-From: Karl Berry Original-Sender: "Debbugs-submit" Resent-CC: automake-patches@gnu.org Resent-Date: Thu, 07 Dec 2023 20:40:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67670 X-GNU-PR-Package: automake-patches X-GNU-PR-Keywords: patch To: zack@owlfolio.org Cc: vapier@gentoo.org, jcb62281@gmail.com, 67670@debbugs.gnu.org X-Debbugs-Original-Cc: vapier@gentoo.org, jcb62281@gmail.com, automake-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.17019815718023 (code B ref -1); Thu, 07 Dec 2023 20:40:01 +0000 Received: (at submit) by debbugs.gnu.org; 7 Dec 2023 20:39:31 +0000 Received: from localhost ([127.0.0.1]:43240 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rBL9e-00025L-Qw for submit@debbugs.gnu.org; Thu, 07 Dec 2023 15:39:31 -0500 Received: from lists.gnu.org ([2001:470:142::17]:54778) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rBL9c-00024q-U8 for submit@debbugs.gnu.org; Thu, 07 Dec 2023 15:39:29 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rBL9G-00067n-TH for automake-patches@gnu.org; Thu, 07 Dec 2023 15:39:08 -0500 Received: from frenzy.freefriends.org ([198.99.81.75] helo=freefriends.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rBL9F-000684-Ai for automake-patches@gnu.org; Thu, 07 Dec 2023 15:39:06 -0500 X-Envelope-From: karl@freefriends.org Received: from freefriends.org (localhost [127.0.0.1]) by freefriends.org (8.14.7/8.14.7) with ESMTP id 3B7Kd1Rw020170 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 7 Dec 2023 13:39:01 -0700 Received: (from apache@localhost) by freefriends.org (8.14.7/8.14.7/Submit) id 3B7Kd07R020169; Thu, 7 Dec 2023 13:39:00 -0700 Date: Thu, 7 Dec 2023 13:39:00 -0700 Message-Id: <202312072039.3B7Kd07R020169@freefriends.org> From: Karl Berry In-Reply-To: <40999a06-8d6b-49f1-9e82-e02f95e46938@app.fastmail.com> Received-SPF: pass client-ip=198.99.81.75; envelope-from=karl@freefriends.org; helo=freefriends.org X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Thanks so much, Zack. I will review and apply, most likely tomorrow. -k From unknown Wed Aug 20 00:21:06 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#67670] [PATCH] Revise tests for file mtime resolution again. References: <40999a06-8d6b-49f1-9e82-e02f95e46938@app.fastmail.com> Resent-From: Karl Berry Original-Sender: "Debbugs-submit" Resent-CC: automake-patches@gnu.org Resent-Date: Sun, 10 Dec 2023 17:52:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67670 X-GNU-PR-Package: automake-patches X-GNU-PR-Keywords: patch To: zack@owlfolio.org Cc: 67670@debbugs.gnu.org, vapier@gentoo.org, jcb62281@gmail.com Received: via spool by 67670-submit@debbugs.gnu.org id=B67670.1702230717374 (code B ref 67670); Sun, 10 Dec 2023 17:52:02 +0000 Received: (at 67670) by debbugs.gnu.org; 10 Dec 2023 17:51:57 +0000 Received: from localhost ([127.0.0.1]:51745 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rCNy9-00005t-8y for submit@debbugs.gnu.org; Sun, 10 Dec 2023 12:51:57 -0500 Received: from frenzy.freefriends.org ([198.99.81.75]:35408 helo=freefriends.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rCNy7-00005N-8O for 67670@debbugs.gnu.org; Sun, 10 Dec 2023 12:51:55 -0500 X-Envelope-From: karl@freefriends.org Received: from freefriends.org (localhost [127.0.0.1]) by freefriends.org (8.14.7/8.14.7) with ESMTP id 3BAHpenl005004 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 10 Dec 2023 10:51:40 -0700 Received: (from apache@localhost) by freefriends.org (8.14.7/8.14.7/Submit) id 3BAHpdGJ005003; Sun, 10 Dec 2023 10:51:39 -0700 Date: Sun, 10 Dec 2023 10:51:39 -0700 Message-Id: <202312101751.3BAHpdGJ005003@freefriends.org> From: Karl Berry In-Reply-To: <40999a06-8d6b-49f1-9e82-e02f95e46938@app.fastmail.com> X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) In order for the Automake testsuite to be able to use sub-second delays [...] I installed the patch (plus a tweak to NEWS). (make check and distcheck ran fine for me, including using the subsecond feature.) I included all the commentary from your message, Zack, since I thought it would likely be helpful to anyone looking at this in the future. There might be a better place to put this, somewhere it'll execute every time the *overall testsuite* is invoked rather than once for each test, but I couldn't find one. Maybe am__check_pre in lib/am/check.am, where other such things are done, like handling sh -e, vpath, etc. But I will leave this for another time. Thanks Zack. Fingers crossed that this resolves this thorny issue once and for all ... -k From unknown Wed Aug 20 00:21:06 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#67670] [PATCH] Revise tests for file mtime resolution again. References: <40999a06-8d6b-49f1-9e82-e02f95e46938@app.fastmail.com> Resent-From: Karl Berry Original-Sender: "Debbugs-submit" Resent-CC: automake-patches@gnu.org Resent-Date: Mon, 25 Dec 2023 23:40:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67670 X-GNU-PR-Package: automake-patches X-GNU-PR-Keywords: patch To: zack@owlfolio.org, 67670@debbugs.gnu.org Received: via spool by 67670-submit@debbugs.gnu.org id=B67670.17035475506674 (code B ref 67670); Mon, 25 Dec 2023 23:40:02 +0000 Received: (at 67670) by debbugs.gnu.org; 25 Dec 2023 23:39:10 +0000 Received: from localhost ([127.0.0.1]:55533 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rHuXO-0001jV-9L for submit@debbugs.gnu.org; Mon, 25 Dec 2023 18:39:10 -0500 Received: from frenzy.freefriends.org ([198.99.81.75]:45304 helo=freefriends.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rHuXL-0001jB-To for 67670@debbugs.gnu.org; Mon, 25 Dec 2023 18:39:08 -0500 X-Envelope-From: karl@freefriends.org Received: from freefriends.org (localhost [127.0.0.1]) by freefriends.org (8.14.7/8.14.7) with ESMTP id 3BPNd0SO031912 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 25 Dec 2023 16:39:00 -0700 Received: (from apache@localhost) by freefriends.org (8.14.7/8.14.7/Submit) id 3BPNd0EY031895; Mon, 25 Dec 2023 16:39:00 -0700 Date: Mon, 25 Dec 2023 16:39:00 -0700 Message-Id: <202312252339.3BPNd0EY031895@freefriends.org> From: Karl Berry In-Reply-To: <202312101751.3BAHpdGJ005003@freefriends.org> X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) One more follow-up on this. As we saw from the bug reports for the 1.16i pretest (67894, 67918), the random parallelization failures were back after this, when autom4te did not support subsecond-mtimes. As far as I could tell, what was needed was to add am_cv_sleep_fractional_seconds=false which is what the previous sanity.m4 code did when a non-subsecond autom4te was detected. With this, my make (dist)check then started reliably succeeding again. (Though vastly more slowly, of course.) --- a/t/ax/test-defs.in +++ b/t/ax/test-defs.in @@ -193,6 +193,10 @@ case $MTIME_RESOLUTION in : else MTIME_RESOLUTION=1 + # we must not sleep for fractional seconds when autom4te does not + # support subsecond-mtimes, even when sleep supports it. See bug#67670. + am_cv_sleep_fractional_seconds=false + export am_cv_sleep_fractional_seconds fi ;; esac My actual commit has a lot of related verbiage, but that additional assignment is the only substantive change. Nothing to do here (comments welcome of course), but just wanted to get this into the bug archive ... --thanks, karl. From unknown Wed Aug 20 00:21:06 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#67670] [PATCH] Revise tests for file mtime resolution again. References: <40999a06-8d6b-49f1-9e82-e02f95e46938@app.fastmail.com> In-Reply-To: <40999a06-8d6b-49f1-9e82-e02f95e46938@app.fastmail.com> Resent-From: Karl Berry Original-Sender: "Debbugs-submit" Resent-CC: automake-patches@gnu.org Resent-Date: Tue, 23 Jan 2024 21:50:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67670 X-GNU-PR-Package: automake-patches X-GNU-PR-Keywords: patch To: 67670@debbugs.gnu.org Received: via spool by 67670-submit@debbugs.gnu.org id=B67670.170604659715061 (code B ref 67670); Tue, 23 Jan 2024 21:50:01 +0000 Received: (at 67670) by debbugs.gnu.org; 23 Jan 2024 21:49:57 +0000 Received: from localhost ([127.0.0.1]:44068 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rSOea-0003uk-Og for submit@debbugs.gnu.org; Tue, 23 Jan 2024 16:49:57 -0500 Received: from frenzy.freefriends.org ([198.99.81.75]:33682 helo=freefriends.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rSOeZ-0003uZ-7T; Tue, 23 Jan 2024 16:49:55 -0500 X-Envelope-From: karl@freefriends.org Received: from freefriends.org (localhost [127.0.0.1]) by freefriends.org (8.14.7/8.14.7) with ESMTP id 40NLnnDe028357 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 23 Jan 2024 14:49:49 -0700 Received: (from apache@localhost) by freefriends.org (8.14.7/8.14.7/Submit) id 40NLnni6028356; Tue, 23 Jan 2024 14:49:49 -0700 Date: Tue, 23 Jan 2024 14:49:49 -0700 Message-Id: <202401232149.40NLnni6028356@freefriends.org> From: Karl Berry X-Spam-Score: 2.1 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Guess it's time to close this one about the subsecond mtimes, and we'll see what happens next time. (For reference: see also https://bugs.gnu.org/68325 where we don't try for a millisecond any more .. [...] Content analysis details: (2.1 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 T_SCC_BODY_TEXT_LINE No description available. 2.1 SCC_BODY_URI_ONLY No description available. X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.1 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Guess it's time to close this one about the subsecond mtimes, and we'll see what happens next time. (For reference: see also https://bugs.gnu.org/68325 where we don't try for a millisecond any more .. [...] Content analysis details: (1.1 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 T_SCC_BODY_TEXT_LINE No description available. 2.1 SCC_BODY_URI_ONLY No description available. -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager Guess it's time to close this one about the subsecond mtimes, and we'll see what happens next time. (For reference: see also https://bugs.gnu.org/68325 where we don't try for a millisecond any more ...) From unknown Wed Aug 20 00:21:06 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: "Zack Weinberg" Subject: bug#67670: closed ([PATCH] Revise tests for file mtime resolution again.) Message-ID: References: <202401232149.40NLnni6028356@freefriends.org> <40999a06-8d6b-49f1-9e82-e02f95e46938@app.fastmail.com> X-Gnu-PR-Message: they-closed 67670 X-Gnu-PR-Package: automake-patches X-Gnu-PR-Keywords: patch Reply-To: 67670@debbugs.gnu.org Date: Tue, 23 Jan 2024 21:50:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1706046602-15098-1" This is a multi-part message in MIME format... ------------=_1706046602-15098-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #67670: [PATCH] Revise tests for file mtime resolution again. which was filed against the automake-patches package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 67670@debbugs.gnu.org. --=20 67670: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D67670 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1706046602-15098-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 67670-done) by debbugs.gnu.org; 23 Jan 2024 21:49:57 +0000 Received: from localhost ([127.0.0.1]:44070 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rSOeb-0003us-2Q for submit@debbugs.gnu.org; Tue, 23 Jan 2024 16:49:57 -0500 Received: from frenzy.freefriends.org ([198.99.81.75]:33682 helo=freefriends.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rSOeZ-0003uZ-7T; Tue, 23 Jan 2024 16:49:55 -0500 X-Envelope-From: karl@freefriends.org Received: from freefriends.org (localhost [127.0.0.1]) by freefriends.org (8.14.7/8.14.7) with ESMTP id 40NLnnDe028357 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 23 Jan 2024 14:49:49 -0700 Received: (from apache@localhost) by freefriends.org (8.14.7/8.14.7/Submit) id 40NLnni6028356; Tue, 23 Jan 2024 14:49:49 -0700 Date: Tue, 23 Jan 2024 14:49:49 -0700 Message-Id: <202401232149.40NLnni6028356@freefriends.org> From: Karl Berry To: 67670@debbugs.gnu.org Subject: [PATCH] Revise tests for file mtime resolution again. X-Spam-Score: 2.1 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Guess it's time to close this one about the subsecond mtimes, and we'll see what happens next time. (For reference: see also https://bugs.gnu.org/68325 where we don't try for a millisecond any more .. [...] Content analysis details: (2.1 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 T_SCC_BODY_TEXT_LINE No description available. 2.1 SCC_BODY_URI_ONLY No description available. X-Debbugs-Envelope-To: 67670-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.1 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Guess it's time to close this one about the subsecond mtimes, and we'll see what happens next time. (For reference: see also https://bugs.gnu.org/68325 where we don't try for a millisecond any more .. [...] Content analysis details: (1.1 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 T_SCC_BODY_TEXT_LINE No description available. 2.1 SCC_BODY_URI_ONLY No description available. -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager Guess it's time to close this one about the subsecond mtimes, and we'll see what happens next time. (For reference: see also https://bugs.gnu.org/68325 where we don't try for a millisecond any more ...) ------------=_1706046602-15098-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 6 Dec 2023 22:06:36 +0000 Received: from localhost ([127.0.0.1]:40591 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rB02N-0003dM-II for submit@debbugs.gnu.org; Wed, 06 Dec 2023 17:06:36 -0500 Received: from lists.gnu.org ([2001:470:142::17]:35666) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rB02H-0003d3-6m for submit@debbugs.gnu.org; Wed, 06 Dec 2023 17:06:33 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rB01y-0004ZC-MP for automake-patches@gnu.org; Wed, 06 Dec 2023 17:06:10 -0500 Received: from wout4-smtp.messagingengine.com ([64.147.123.20]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rB01v-0005uc-KT for automake-patches@gnu.org; Wed, 06 Dec 2023 17:06:10 -0500 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 16F8E3200A6F; Wed, 6 Dec 2023 17:06:06 -0500 (EST) Received: from imap45 ([10.202.2.95]) by compute5.internal (MEProxy); Wed, 06 Dec 2023 17:06:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=owlfolio.org; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:message-id:mime-version:reply-to :sender:subject:subject:to:to; s=fm3; t=1701900365; x= 1701986765; bh=xPVy/O1h3wTmi1t2/IDMGyecoVHWK3TVi1A0gWU4vdM=; b=h WjwHZa6YU/WC9eSmQDLl40UKzfVJ9PdO4DGXOE1RYt3LKcOYH9vlQezcxv0Ul75/ /WKNSguZ3mRXHGDF9H8UE2eQIXUNYDtFGFRVwTg5f1pb+5f4lI+OWVGSkF0/MYxJ +Vb2SAjaZarvHaAauStWVRsPxAqESaJ1G/4s77QLy89u1WzZ2G/SKCfK1HURzwRL rDKrTnW8JU/bxIK0JtJQZhRBQ9HV4wG2xg/5z+687RH7ss1agphwyY7dS2qPiy18 ooYeZIyVs/KmopI40bB7e38trHZixG1S6IwjwIJHuc9bR4fFwRTE36LOu5s7fHtD QnozNqB+O0J+DbHExs5lQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:message-id:mime-version:reply-to:sender :subject:subject:to:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; t=1701900365; x=1701986765; bh=x PVy/O1h3wTmi1t2/IDMGyecoVHWK3TVi1A0gWU4vdM=; b=dG2PLUiwh33QskkCT KgjsLmx61H8kPhCx0Yc5NQfkxlkiRIeoMgBqQaxRn3Jh2jQUqGhActxxSH1Xw8eA 9Q2pJOfFgUzX5IOSv7FNbSETJmiyrA9/Uv6InTiev8v8Kwic2/OwEV5lTBkJ8+JN l/e982WZj8bHAO8z8I/4xGXlFFiBOz/CM0znD7nV8lqh0QLXh0GjmWoYg4oSTX06 ZBJQRPB/23KNfVMVNCun0gIBpiP9pvidA2FHS9Iz3kk/lVgsqqG/QePKjzbzPpsG Ag8vndIZke9lK+IhH2pPwiORKcyvbt3vcOqy9kpEi0vVY7l37l/+WWFwdSwfbKW3 sbrpg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudektddgudeitdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefofgggkfffhffvvefutgfgsehtqhertderreejnecuhfhrohhmpedfkggr tghkucghvghinhgsvghrghdfuceoiigrtghksehofihlfhholhhiohdrohhrgheqnecugg ftrfgrthhtvghrnhepvdevfeduvddtieefleevhfetfedtuefhieetlefhteetjedtkeeh udfgfeeijedvnecuffhomhgrihhnpehgnhhurdhorhhgpdhfihhlvghuthhilhhsrdhpmh enucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpeiirggt khesohiflhhfohhlihhordhorhhg X-ME-Proxy: Feedback-ID: i876146a2:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 59256272007B; Wed, 6 Dec 2023 17:06:05 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.9.0-alpha0-1178-geeaf0069a7-fm-20231114.001-geeaf0069 MIME-Version: 1.0 Message-Id: <40999a06-8d6b-49f1-9e82-e02f95e46938@app.fastmail.com> Date: Wed, 06 Dec 2023 17:04:21 -0500 From: "Zack Weinberg" To: automake-patches@gnu.org Subject: [PATCH] Revise tests for file mtime resolution again. Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=64.147.123.20; envelope-from=zack@owlfolio.org; helo=wout4-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.6 (/) X-Debbugs-Envelope-To: submit Cc: Mike Frysinger , Jacob Bachmeyer , Karl Berry X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.4 (/) In order for the Automake testsuite to be able to use sub-second delays = to control whether certain files are considered newer than others, five(!) separate pieces of software all need to cooperate: automake itself, autoconf=E2=80=99s internal =E2=80=9Cautom4te=E2=80=9D utility, the Perl= interpreter and its libraries, the sleep(1) shell utility, and finally the filesystem hosting the build directory. The existing tests for this are a combination of inadequate and incorrect. This patch, in conjunction with a patch just committed to Autoconf trunk https://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=3D39d96e6fff7c= eae63b823872602caf4d255a38c8 should make everything much more robust, as follows: - _AM_FILESYSTEM_TIMESTAMP_RESOLUTION is completely rewritten. It no longer looks for autom4te at all, because this macro is invoked unconditionally from AM_INIT, so *every* project that uses Automake would get this test that=E2=80=99s only relevant to Automake=E2=80=99s= own testsuite. Also, it tries sleeping for as little as one millisecond (smaller dela= ys consistently get rounded up to 1ms on my computer and I expect that=E2= =80=99s universal), it should accurately detect FAT=E2=80=99s two-second resol= ution now, and it should not be tripped up anymore by running at precisely the moment that will make a 0.1s sleep cross a 1s boundary (this may sound unlikely but it used to cause a couple of test failures *every time* I ran the automake testsuite on a network filesystem that only supported 1s resolution). - In support of the above, the test for working ls -t moved from AM_SANITY_CHECK to _AM_FILESYSTEM_TIMESTAMP_RESOLUTION. This allowed me to simplify the test for $srcdir/configure being older than a freshly created file. - If automake is capable of reading high-resolution file modification timestamps from the operating system, it prints =E2=80=9CFeatures: sub= second-mtime=E2=80=9D as the second line of --version output. (We can=E2=80=99t just assume= this works for sufficiently new automake, because it depends on whether the Perl interpreter provides this capability, and that=E2=80=99s not a si= mple question of which version of Perl you have either.) - The Autoconf patch mentioned above adds the same annotation to the output of autom4te --version. - Finally, t/ax/test-defs.in looks for the =E2=80=9CFeatures: subsecond-= mtime=E2=80=9D string from both automake and autom4te and resets the sleep time to one second if it=E2=80=99s not there. There might be a better place t= o put this, somewhere it=E2=80=99ll execute every time the *overall testsuite* is = invoked rather than once for each test, but I couldn=E2=80=99t find one. Tested on x86-64-linux with development automake and development autocon= f. Previous discussion: - https://lists.gnu.org/archive/html/automake/2023-03/msg00000.html - https://lists.gnu.org/archive/html/automake/2023-04/msg00002.html - https://lists.gnu.org/archive/html/automake/2023-12/msg00005.html - https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D64756 ChangeLog: * m4/sanity.m4 (_AM_FILESYSTEM_TIMESTAMP_RESOLUTION): Rewrite for greater reliability. Don=E2=80=99t probe autom4te at all here. Check for wor= king =E2=80=9Cls -t=E2=80=9D here. (AM_SANITY_CHECK): Do not cache the result. Do not check for working =E2=80=9Cls -t=E2=80=9D check here. Disentangle control flow in the l= oop probing the relative ages of build and source directory. * lib/Automake/FileUtils.pm: Sync from autoconf. * bin/automake.in (version): Include =E2=80=9CFeatures: subsecond-mtime=E2= =80=9D in the output if $Automake::FileUtils::subsecond_mtime is true. * configure.ac: Rename the substitution variable MODIFICATION_DELAY to MTIME_RESOLUTION. * t/ax/test-defs.in: Require both $AUTOMAKE and $AUTOM4TE to report support for high-resolution timestamps before setting $sleep to delay for less than one second. --- bin/automake.in | 17 ++-- configure.ac | 9 +- lib/Automake/FileUtils.pm | 71 +++++++++++----- m4/sanity.m4 | 171 ++++++++++++++++++++------------------ t/ax/test-defs.in | 26 ++++-- 5 files changed, 180 insertions(+), 114 deletions(-) diff --git a/bin/automake.in b/bin/automake.in index c0ffc1986..820d0d541 100644 --- a/bin/automake.in +++ b/bin/automake.in @@ -8271,16 +8271,19 @@ General help using GNU software: . =20 sub version () { - print < + print "automake (GNU $PACKAGE) $VERSION\n"; + print "Features: subsecond-mtime\n" + if $Automake::FileUtils::subsecond_mtime; + print "\nCopyright (C) $RELEASE_YEAR Free Software Foundation, Inc."; + print ' +License GPLv2+: GNU GPL version 2 or later + This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. =20 -Written by Tom Tromey - and Alexandre Duret-Lutz . -EOF +Written by Tom Tromey + and Alexandre Duret-Lutz . +'; # --version always returns 0 per GNU standards. exit 0; } diff --git a/configure.ac b/configure.ac index 5cda80a18..33aec7788 100644 --- a/configure.ac +++ b/configure.ac @@ -180,9 +180,6 @@ result=3Dno test "x$am_cv_prog_ln" =3D xln && result=3Dyes AC_MSG_RESULT([$result]) =20 -MODIFICATION_DELAY=3D$am_cv_filesystem_timestamp_resolution -AC_SUBST([MODIFICATION_DELAY]) - ## ------------------------------------------- ## ## Test for things needed by the test suite. ## ## ------------------------------------------- ## @@ -190,6 +187,12 @@ AC_SUBST([MODIFICATION_DELAY]) AC_PROG_EGREP AC_PROG_FGREP =20 +# The test suite needs to know the resolution of timestamps +# supported by the filesystem hosting the build. The value +# will be acceptable to 'sleep' on this system. +MTIME_RESOLUTION=3D$am_cv_filesystem_timestamp_resolution +AC_SUBST([MTIME_RESOLUTION]) + dnl FIXME: could we extract this in a simpler way through autoconf dnl FIXME: idioms or internals? AC_DEFUN( diff --git a/lib/Automake/FileUtils.pm b/lib/Automake/FileUtils.pm index 8d0b36802..553d5c6dc 100644 --- a/lib/Automake/FileUtils.pm +++ b/lib/Automake/FileUtils.pm @@ -38,24 +38,45 @@ use 5.006; use strict; use warnings FATAL =3D> 'all'; =20 -use Exporter; +BEGIN +{ + require Exporter; + our @ISA =3D qw (Exporter); + our @EXPORT =3D qw (&contents + &find_file &mtime + &update_file + &xsystem &xsystem_hint &xqx + &dir_has_case_matching_file &reset_dir_cache + &set_dir_cache_file); +} + +# Use sub-second resolution file timestamps if available, carry on +# with one-second resolution timestamps if Time::HiRes is not available. +# +# Unfortunately, even if Time::HiRes is available, we don't get +# timestamps to the full precision recorded by the operating system, +# because Time::HiRes converts timestamps to floating-point, and the +# rounding error is hundreds of nanoseconds for circa-2023 timestamps +# in IEEE double precision. But this is the best we can do without +# dropping down to C. +# +# $subsecond_mtime is not exported, but is intended for external +# consumption, as $Automake::FileUtils::subsecond_mtime. +BEGIN +{ + our $subsecond_mtime =3D 0; + eval + { + require Time::HiRes; + import Time::HiRes qw(stat); + $subsecond_mtime =3D 1; + } +} + use IO::File; - -# use sub-second resolution timestamps if available, -# carry on with one-second resolution timestamps if that is all we have -BEGIN { eval { require Time::HiRes; import Time::HiRes qw(stat) } } - use Automake::Channels; use Automake::ChannelDefs; =20 -our @ISA =3D qw (Exporter); -our @EXPORT =3D qw (&contents - &find_file &mtime - &update_file - &xsystem &xsystem_hint &xqx - &dir_has_case_matching_file &reset_dir_cache - &set_dir_cache_file); - =3Dover 4 =20 =3Ditem C @@ -122,11 +143,6 @@ sub mtime ($) $atime,$mtime,$ctime,$blksize,$blocks) =3D stat ($file) or fatal "cannot stat $file: $!"; =20 - # Unfortunately Time::HiRes converts timestamps to floating-point, an= d the - # rounding error can be hundreds of nanoseconds for circa-2023 timest= amps. - # Perhaps some day Perl will support accurate file timestamps. - # For now, do the best we can without going outside Perl. - return $mtime; } =20 @@ -394,3 +410,20 @@ sub set_dir_cache_file ($$) =3Dcut =20 1; # for require + +### Setup "GNU" style for perl-mode and cperl-mode. +## Local Variables: +## perl-indent-level: 2 +## perl-continued-statement-offset: 2 +## perl-continued-brace-offset: 0 +## perl-brace-offset: 0 +## perl-brace-imaginary-offset: 0 +## perl-label-offset: -2 +## cperl-indent-level: 2 +## cperl-brace-offset: 0 +## cperl-continued-brace-offset: 0 +## cperl-label-offset: -2 +## cperl-extra-newline-before-brace: t +## cperl-merge-trailing-else: nil +## cperl-continued-statement-offset: 2 +## End: diff --git a/m4/sanity.m4 b/m4/sanity.m4 index 8887a0c98..93c4854b9 100644 --- a/m4/sanity.m4 +++ b/m4/sanity.m4 @@ -15,66 +15,87 @@ AS_IF([sleep 0.001 2>/dev/null], [am_cv_sleep_fracti= onal_seconds=3Dtrue], [am_cv_s =20 # _AM_FILESYSTEM_TIMESTAMP_RESOLUTION # ----------------------------------- -# Determine the filesystem timestamp resolution. Modern systems are -# nanosecond capable, but historical systems could have millisecond, -# second, or even 2-second resolution. +# Determine the filesystem's resolution for file modification +# timestamps. The coarsest we know of is FAT, with a resolution +# of only two seconds, even with the most recent "exFAT" extensions. +# The finest (e.g. ext4 with large inodes, XFS, ZFS) is one +# nanosecond, matching clock_gettime. However, it is probably not +# possible to delay execution of a shell script for less than one +# millisecond, due to process creation overhead and scheduling +# granularity, so we don't check for anything finer than that. AC_DEFUN([_AM_FILESYSTEM_TIMESTAMP_RESOLUTION], [dnl AC_REQUIRE([_AM_SLEEP_FRACTIONAL_SECONDS]) -# -# Check if Autom4te uses Time::HiRes. If not, we cannot use fractional = sleep, -# because this sanity test and automated tests will be unreliable due to -# Autom4te's caching of results and comparing timestamps. -# More info: long thread around -# https://lists.gnu.org/archive/html/automake/2023-04/msg00002.html -# and https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D64756. -# By the way, we cannot use Perl to see if %INC{q[Time/HiRes.pm]} is -# defined, because Time::HiRes might get pulled in from other system -# modules even when not used directly. (An idea suggested in that thr= ead.) -AC_PATH_PROG([AUTOM4TE], [autom4te]) -if test x"$autom4te_perllibdir" =3D x; then - autom4te_perllibdir=3D`sed -n \ - '/autom4te_perllibdir/{s/^.*|| //;s/;$//;s/^.//;s/.$//;p;q}' <$AUTOM= 4TE` -fi -if grep HiRes "$autom4te_perllibdir"/Autom4te/FileUtils.pm >/dev/null; = then - : -else - am_cv_sleep_fractional_seconds=3Dfalse +AC_CACHE_CHECK([the filesystem timestamp resolution], am_cv_filesystem_= timestamp_resolution, [dnl +# Default to the worst case. +am_cv_filesystem_timestamp_resolution=3D2 + +# Only try to go finer than 1s if sleep can do it. +am_try_resolutions=3D1 +if $am_cv_sleep_fractional_seconds; then + am_try_resolutions=3D"0.001 0.01 0.1 $am_try_resolutions" fi =20 -AC_CACHE_CHECK([the filesystem timestamp resolution], am_cv_filesystem_= timestamp_resolution, [dnl -# Use names that lexically sort older-first when the timestamps are equ= al. -rm -f conftest.file.a conftest.file.b -: > conftest.file.a -AS_IF([$am_cv_sleep_fractional_seconds], [dnl - am_try_sleep=3D0.1 am_try_loops=3D20 -], [dnl - am_try_sleep=3D1 am_try_loops=3D2 -]) -am_try=3D0 -while :; do - AS_VAR_ARITH([am_try], [$am_try + 1]) - echo "timestamp $am_try" > conftest.file.b - set X `ls -t conftest.file.a conftest.file.b` - if test "$[2]" =3D conftest.file.b || test $am_try -eq $am_try_loops;= then +# In order to catch current-generation FAT out, we must *modify* files +# that already exist; the *creation* timestamp is finer. Use names +# that make ls -t sort them differently when they have equal +# timestamps than when they have distinct timestamps, keeping +# in mind that ls -t prints the *newest* file first. +rm -f conftest.ts? +: > conftest.ts1 +: > conftest.ts2 +: > conftest.ts3 + +# Make sure ls -t actually works. Do 'set' in a subshell so we don't +# clobber the current shell's arguments. +if ( + set X `[ls -t conftest.ts[12]]` && + { + test "$[*]" !=3D "X conftest.ts1 conftest.ts2" || + test "$[*]" !=3D "X conftest.ts2 conftest.ts1"; + } +); then :; else + # 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". + _AS_ECHO_UNQUOTED( + ["Bad output from ls -t: \"`[ls -t conftest.ts[12]]`\""], + [AS_MESSAGE_LOG_FD]) + AC_MSG_FAILURE([ls -t produces unexpected output. +Make sure there is not a broken alias in your environment.]) +fi + +for am_try_res in $am_try_resolutions; do + # Any one fine-grained sleep might happen to cross the boundary + # between two values of a coarser actual resolution, but if we do + # two fine-grained sleeps in a row, at least one of them will fall + # entirely within a coarse interval. + echo alpha > conftest.ts1 + sleep $am_try_res + echo beta > conftest.ts2 + sleep $am_try_res + echo gamma > conftest.ts3 + + # We assume that 'ls -t' will make use of high-resolution + # timestamps if the operating system supports them at all. + if (set X `ls -t conftest.ts?` && + test "$[]2" =3D conftest.ts3 && + test "$[]3" =3D conftest.ts2 && + test "$[]4" =3D conftest.ts1); then + am_cv_filesystem_timestamp_resolution=3D$am_try_res break fi - sleep $am_try_sleep done -rm -f conftest.file.a conftest.file.b -am_cv_filesystem_timestamp_resolution=3D$am_try -AS_IF([$am_cv_sleep_fractional_seconds], [dnl - AS_VAR_ARITH([am_cv_filesystem_timestamp_resolution], [$am_try / 10]) - AS_VAR_ARITH([am_fraction], [$am_try % 10]) - AS_VAR_APPEND([am_cv_filesystem_timestamp_resolution], [.$am_fraction= ]) -]) +rm -f conftest.ts? ])]) =20 # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_REQUIRE([_AM_FILESYSTEM_TIMESTAMP_RESOLUTION]) -rm -f conftest.file -AC_CACHE_CHECK([whether build environment is sane], am_cv_build_env_is_= sane, [dnl +# This check should not be cached, as it may vary across builds of +# different projects. +AC_MSG_CHECKING([whether build environment is sane]) # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=3D' @@ -93,41 +114,33 @@ esac # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). -if ( - am_has_slept=3Dno - for am_try in 1 2; do - echo "timestamp, slept: $am_has_slept" > conftest.file - set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` - if test "$[*]" =3D "X"; then - # -L didn't work. - set X `ls -t "$srcdir/configure" conftest.file` - fi - if test "$[*]" !=3D "X $srcdir/configure conftest.file" \ - && test "$[*]" !=3D "X conftest.file $srcdir/configure"; then +am_build_env_is_sane=3Dno +am_has_slept=3Dno +rm -f conftest.file +for am_try in 1 2; do + echo "timestamp, slept: $am_has_slept" > conftest.file + if ( + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$[*]" =3D "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + test "$[2]" =3D conftest.file + ); then + am_build_env_is_sane=3Dyes + break + fi + # Just in case. + sleep $am_cv_filesystem_timestamp_resolution + am_has_slept=3Dyes +done =20 - # 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]" =3D conftest.file || test $am_try -eq 2; then - break - fi - # Just in case. - sleep $am_cv_filesystem_timestamp_resolution - am_has_slept=3Dyes - done - test "$[2]" =3D conftest.file - ) -then - am_cv_build_env_is_sane=3Dyes -else - AC_MSG_ERROR([newly created file is older than distributed files! +AC_MSG_RESULT([$am_build_env_is_sane]) +if test $am_build_env_is_sane =3D no; then + AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi -]) + # If we didn't sleep, we still need to ensure time stamps of config.sta= tus and # generated files are strictly newer. am_sleep_pid=3D diff --git a/t/ax/test-defs.in b/t/ax/test-defs.in index e09a387cd..696403ee0 100644 --- a/t/ax/test-defs.in +++ b/t/ax/test-defs.in @@ -177,12 +177,26 @@ GNU_GCJFLAGS=3D${AM_TESTSUITE_GNU_GCJFLAGS-${GNU_G= CJFLAGS-'@GNU_GCJFLAGS@'}} # this variable. TEX=3D${AM_TESTSUITE_TEX-'@TEX@'} =20 -# The amount we should wait after modifying files depends on the platfo= rm. -# For instance, Windows '95, '98 and ME have 2-second granularity -# and can be up to 3 seconds in the future w.r.t. the system clock. -# The creative quoting is to avoid spuriously triggering a failure in -# the maintainer checks, -sleep=3D'sleep ''@MODIFICATION_DELAY@' +# The time we should wait after modifying files depends on the platform= , and +# also the capabilities of the 'automake' and 'autom4te' programs, whic= h in +# turn depend on the capabilities of the Perl interpreter. configure h= as +# detected the platform's resolution for file modification times; we st= ill +# need to check automake and autom4te. +MTIME_RESOLUTION=3D'@MTIME_RESOLUTION@' +case $MTIME_RESOLUTION in + 1 | 2) ;; # Can assume these values are usable as is. + *) + if $AUTOMAKE --version 2>&1 | + grep 'Features:.*subsecond-mtime' > /dev/null 2>&1 && + $AUTOM4TE --version 2>&1 | + grep 'Features:.*subsecond-mtime' > /dev/null 2>&1; then + : + else + MTIME_RESOLUTION=3D1 + fi + ;; +esac +sleep=3D"sleep $MTIME_RESOLUTION" =20 # An old timestamp that can be given to a file, in "touch -t" format. # The time stamp should be portable to all file systems of interest. --=20 2.41.0 ------------=_1706046602-15098-1--