pcp
[Top] [All Lists]

Which which?

To: Ken McDonell <kenj@xxxxxxxxxxxxxxxx>, Mark Goodwin <mgoodwin@xxxxxxxxxx>, Max Matveev <makc@xxxxxxxxx>
Subject: Which which?
From: Nathan Scott <nathans@xxxxxxxxxx>
Date: Thu, 4 Sep 2014 18:16:00 -0400 (EDT)
Cc: PCP <pcp@xxxxxxxxxxx>
Delivered-to: pcp@xxxxxxxxxxx
In-reply-to: <401941929.44268989.1409868371415.JavaMail.zimbra@xxxxxxxxxx>
Reply-to: Nathan Scott <nathans@xxxxxxxxxx>
Thread-index: utyTPR/QtU7KygzZCtrMIVVBxnRaYA==
Thread-topic: Which which?
Hi guys,

Does anyone remember what the story behind PCP_WHICH_PROG is?
I have a platform here where the default setting (ie "type") is
giving "xxx is hashed (/usr/bin/xxx)" instead of "/usr/bin/xxx"
as output ... which is making for a broken diagnostic from rc
scripts.

There's a comment in _which() at the head of rc-proc.sh that is
probably highly relevant:

# some versions of which(1) have historically not reflected the
# correct exit status ... but it appears that all modern platforms
# get this correct

I'd like to make the change below but I'm a little unsure about
its potential impact...  (hopefully this was an IRIX-ism?)

diff --git a/configure.ac b/configure.ac
index 520879c..b66ff56 100644
--- a/configure.ac
+++ b/configure.ac
@@ -917,6 +917,11 @@ if test -z "$ECHO"; then
 fi
 echo=$ECHO
 AC_SUBST(echo)
+if test -z "$WHICH"; then
+    AC_PATH_PROG(WHICH, which, /usr/bin/which)
+fi
+which=$WHICH
+AC_SUBST(which)
 
 dnl check we don't get the Windows sort ...
 AC_MSG_CHECKING([where unix-like sort(1) lives])
@@ -1064,17 +1069,6 @@ then
 fi
 AC_SUBST(grep)
 
-if test -n "$WHICH"
-then
-    which=$WHICH
-elif sh -c 'type -p sh' >/dev/null 2>&1 
-then
-    which=type
-else
-    which=which
-fi
-AC_SUBST(which)
-
 dnl checks for /proc pseudo file system
 AC_MSG_CHECKING([for /proc ])
 if test "$cross_compiling" = "yes"; then


Thanks.

ps: How much which could a which which which if a which which
could which which?

--
Nathan

<Prev in Thread] Current Thread [Next in Thread>
  • Which which?, Nathan Scott <=