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 automake-patches@gnu.org. #
###############################################################
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