whether some arbitrary file exists. To do so, use @samp{test -f},
@samp{test -r}, or @samp{test -x}. Do not use @samp{test -e}, because
Solaris 10 @command{/bin/sh}
-lacks it. To test for symbolic links on systems that have them, use
+lacks it.
+
+To test for symbolic links on systems that have them, use
@samp{test -h} rather than @samp{test -L}; either form conforms to
POSIX 1003.1-2001, but @option{-h} has been around longer.
+The commands @samp{test A -ot B} and @samp{test A -nt B} are not reliable
+on macOS @command{sh} through at least macOS Sequoia 15.1.1 (2024),
+where @samp{test} ignores the subsecond part of file timestamps.
+To work around this bug, arrange for the timestamps to be at least one
+second apart.
+
For historical reasons, POSIX reluctantly allows implementations of
@samp{test -x} that will succeed for the root user, even if no execute
permissions are present. Furthermore, shells do not all agree on
: > a-stamp-file
AT_CHECK_CONFIGURE([], [], [stdout])
AT_CHECK([grep cache stdout], [1])
-AT_CHECK([LC_ALL=C ls -t config.cache a-stamp-file | sed 1q | grep config.cache], [1])
+AT_CHECK([test config.cache -ot a-stamp-file])
# Using a symlinked cache file works.
: > cache
fi
# 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.
+# that already exist; the *creation* timestamp is finer.
rm -f conftest.ts?
: > conftest.ts1
: > conftest.ts2
sleep $at_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.
- set X `ls -t conftest.ts?`
- if test "$[]2" = conftest.ts3 &&
- test "$[]3" = conftest.ts2 &&
- test "$[]4" = conftest.ts1; then
+ if test conftest.ts1 -ot conftest.ts2 &&
+ test conftest.ts2 -ot conftest.ts3; then
at_ts_resolution=$at_try_res
break
fi