severity 10730 minor
tags 10730 patch
close 10730
thanks

On 02/05/2012 02:27 AM, Adam Sampson wrote:
> Hi,
>
Hi Adam, thanks for the report.

> In automake 1.11.3, the txinfo21 test uses is_newest to compare the
> timestamps of main.html (a directory) and main.texi (a file). This
> fails, because the find call inside is_newest also finds the files
> inside main.html.
>
Ouch.  We had already encountered and fixed this bug, but I applied
the fix to master only, so that the problem is still present in the
maintenance version :-(  I've now backported the patch from master,
which should fix the issue, and added you to THANKS.  See attached
patch.

> Adding -maxdepth 0 to the find invocation fixes this.
>
The '-maxdepth' option seems to be a GNU extensions, and not portable
to POSIX find(1); the attached fix uses the '-prune' option instead.

> A patch is attached, as is a log of it failing without the patch.
> 
Thanks,
  Stefano
>From ea4f1a91ac1c11a91a21169125b7ed931a4ab7fe Mon Sep 17 00:00:00 2001
Message-Id: <ea4f1a91ac1c11a91a21169125b7ed931a4ab7fe.1328479875.git.stefano.lattar...@gmail.com>
From: Stefano Lattarini <stefano.lattar...@gmail.com>
Date: Sat, 23 Jul 2011 13:55:20 +0200
Subject: [PATCH] test defs: function 'is_newest' now works also with
 directories

Reported by Jim Meyering against automake master (see bug#9147) and
by Adam Sampson against automake 1.11.3 (see bug#10730).

* tests/defs (is_newest): Call 'find' with the '-prune' option,
so that it won't descend in the directories (which could cause
spurious results).
* THANKS: Update.

Backported from commit v1.11-914-gb6a40fa (originally on master).
---
 THANKS        |    1 +
 tests/defs.in |    2 +-
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/THANKS b/THANKS
index fbb7eb4..e6730b4 100644
--- a/THANKS
+++ b/THANKS
@@ -3,6 +3,7 @@ It would not be what it is today without the invaluable help of these
 people:
 
 Adam J. Richter		a...@yggdrasil.com
+Adam Sampson		a...@offog.org
 Adrian Bunk		b...@fs.tum.de
 Akim Demaille		a...@freefriends.org
 Alan Modra		amo...@bigpond.net.au
diff --git a/tests/defs.in b/tests/defs.in
index 31426f2..4990e30 100644
--- a/tests/defs.in
+++ b/tests/defs.in
@@ -486,7 +486,7 @@ old_timestamp=198309271735.59
 # 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"
 }
 
-- 
1.7.7.3

Reply via email to