* tests/defs (is_newest): Call `find' with the `-prune' option,
so that it won't descend in the directories (which could cause
spurious results).
* tests/self-check-is_newest: Extend accordingly.
From a report by Jim Meyering, see automake bug#9147.
+2011-07-23 Stefano Lattarini <stefano.lattarini@gmail.com>
+
+ test defs: function 'is_newest' now works also with directories
+ * tests/defs (is_newest): Call `find' with the `-prune' option,
+ so that it won't descend in the directories (which could cause
+ spurious results).
+ * tests/self-check-is_newest: Extend accordingly.
+ From a report by Jim Meyering, see automake bug#9147.
+
2011-07-15 Benoit Sigoure <tsunanet@gmail.com>
docs: add references between the 2 sections on java support
# Resolve ties in favor of FILE.
is_newest ()
{
- is_newest_files=`find "$@" -newer "$1"`
+ is_newest_files=`find "$@" -prune -newer "$1"`
test -z "$is_newest_files"
}
is_newest c d
+# Should work on directories too, both empty and not-empty. An older
+# implementation of `is_newest' failed if the first argument was a
+# directory containing files newer than itself (see automake bug#9147).
+mkdir u x
+touch x/foo
+$sleep
+touch x/foo
+$sleep
+mkdir v y
+touch y/foo
+$sleep
+touch y/foo
+
+stat u v x y x/foo y/foo || : # For debugging.
+
+for older in u x; do
+ for newer in v y; do
+ is_newest $newer $older
+ is_newest $older $newer && Exit 1
+ done
+done
+
+is_newest x/foo x
+is_newest x x/foo && Exit 1
+
+touch -r x u
+is_newest x u
+is_newest u x
+
+# A couple of mild "stress" tests.
+is_newest y x u v
+is_newest y u x/foo a b c
+
: