Subject: bug#68808: subsecond mtime discovery code insufficient

From: Erik A Johnson <[email-masked]>
Date: Tue, 30 Jan 2024 12:46:22 +0000

I found the problem!  The default GNU make on macOS (even Sonoma) is 3.81 from 2006!  The configure script for GNU make versions <4.0 did not have the right test for subsecond resolution in the macOS stat() function, so 3.81 was built with resolution only to the second, not subsecond, thus needing at least one second sleep.  (Why, then, does Apple continue to include 3.81 in the software 18 years later? Beyond me.)

Installing the most recent release of GNU make (4.4.1) fixes the problem.  Tests all run successfully.

Erik

----------------------------------------

Details ... With make 3.81, if I create a simple Makefile with

	foo: bar
		touch foo

then

	touch foo
	touch bar
	make

should make (touch) foo because bar is newer.  However, if these are done immediately after each other

	touch foo; touch bar; make

then, most of the time, make just responds with "make: `foo' is up to date."  The following

	n=0; while make | grep -q 'up to date'; do touch foo; touch bar; printf .; n=$(($n+1)); done; echo $n

varies from a handful of trials to several thousand trials before foo's mtime's integer is one less than bar's mtime's integer.