bug-autoconf
[Top][All Lists]
Advanced

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

Re: [PATCH] up_to_date_p: treat equal mtime as outdated.


From: Harald van Dijk
Subject: Re: [PATCH] up_to_date_p: treat equal mtime as outdated.
Date: Sat, 11 Apr 2020 21:35:15 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:75.0) Gecko/20100101 Thunderbird/75.0

On 11/04/2020 21:07, Paul Eggert wrote:
On 4/11/20 12:28 PM, Harald van Dijk wrote:
The up_to_date_p function uses mtime, which returns timestamps with
second precision. Even if it were capable of returning higher precision
timestamps, the file system might not support it.

These days file systems typically do support it, so can't we use higher-resolution file timestamps when they're available?

Yes, that is possible. It doesn't avoid the need for this patch and makes it harder to test this patch though, so I would suggest doing that separately after this one if it's worthwhile. It can be done by making mtime return fractional results and making sure callers handle that, which is mainly just a matter of adding use Time::HiRes qw(stat); to avoid using perl's built-in stat function which does not support sub-second precision, and use Time::HiRes's version instead which does.

I notice now though in the header of this file:

###############################################################
# The main copy of this file is in Automake's git repository. #
# Updates should be sent to address@hidden.         #
###############################################################

Sorry for missing this the first time. Adjusted to modify automake's copy, and that address added to the CC.

---

The up_to_date_p function uses mtime, which returns timestamps with
second precision. Even if it were capable of returning higher precision
timestamps, the file system might not support it.

With second precision timestamps, when two timestamps are equal, we do
not know which is newer and need to account for the worst case scenario.

This caused intermittent failures in automake's t/subobj.sh test, which
runs aclocal+automake, modifies configure.ac, and immediately re-runs
aclocal+automake. On sufficiently fast computers, this would not update
the cache files.
---
 lib/Automake/FileUtils.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/Automake/FileUtils.pm b/lib/Automake/FileUtils.pm
index 7ebf547e0..2c8cfc52f 100644
--- a/lib/Automake/FileUtils.pm
+++ b/lib/Automake/FileUtils.pm
@@ -195,7 +195,7 @@ sub up_to_date_p ($@)

   foreach my $dep (@dep)
     {
-      if ($mtime < mtime ($dep))
+      if ($mtime <= mtime ($dep))
        {
          verb "up_to_date ($file): outdated: $dep";
          return 0;
--
2.25.2



reply via email to

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