On 2013-04-27 22:38, Mike Frysinger wrote:
> On Saturday 27 April 2013 13:53:28 Peter Rosin wrote:
>> On 2013-04-27 07:58, Mike Frysinger wrote:
>>> The current code tries to locate a compatible nm tool.  It starts with
>>> a prefixed nm tool (great!) and includes a plain nm too (that's fine).
>>> The problem is that the code searches for the prefixed nm before the
>>> plain nm (normally fine), but doesn't break once it has found a valid
>>> match.  It does this so that it if it finds an "OK", but "not great",
>>> tool, it'll keep on searching.
>>
>> I agree this sounds like the wrong this to do, but isn't it better to
>> just break all the way out when a "great" nm is found?
> 
> for some reason i thought the [n] arg to break wasn't portable.  this should 
> work though.
> -mike

And on re-reading, my IFS changes are not very constructive. I removed
those. I will push the attached in a couple of days, if there are no
objections.

Cheers,
Peter

>From a4629ebff263dcb2e05feb9e41df649ea5ce3f78 Mon Sep 17 00:00:00 2001
From: Peter Rosin <p...@lysator.liu.se>
Date: Sun, 28 Apr 2013 09:16:56 +0200
Subject: [PATCH] libtool: break all the way out when a good nm is found

The current code tries to locate a compatible nm tool.  It starts with
a prefixed nm tool (great!) and includes a plain nm too (that's fine).
The problem is that the code searches for the prefixed nm before the
plain nm (normally fine), but doesn't break once it has found a valid
match, and the plain nm ends up the winner.

Report and analysis by Mike Frysinger.

* m4/libtool.m4 (LT_PATH_NM): Break all the way out on a good match.

Signed-off-by: Peter Rosin <p...@lysator.liu.se>
---
 m4/libtool.m4 |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/m4/libtool.m4 b/m4/libtool.m4
index 3f50b0c..d7013c5 100644
--- a/m4/libtool.m4
+++ b/m4/libtool.m4
@@ -3397,13 +3397,13 @@ else
 	case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
 	*/dev/null* | *'Invalid file or object type'*)
 	  lt_cv_path_NM="$tmp_nm -B"
-	  break
+	  break 2
 	  ;;
 	*)
 	  case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
 	  */dev/null*)
 	    lt_cv_path_NM="$tmp_nm -p"
-	    break
+	    break 2
 	    ;;
 	  *)
 	    lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
-- 
1.7.9

Reply via email to