Subject: Re: m4 port: return program name as 'm4' not '/some/path/m4.exe' [PATCH] From: Tim Van Holder To: djgpp-workers AT delorie DOT com In-Reply-To: <3E1D3BDE.C5BDCF79@phekda.freeserve.co.uk> References: <3E1D3BDE DOT C5BDCF79 AT phekda DOT freeserve DOT co DOT uk> Content-Type: text/plain Organization: Message-Id: <1042113439.10441.21.camel@leeloo> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.1 Date: 09 Jan 2003 12:57:20 +0100 Content-Transfer-Encoding: 7bit Reply-To: djgpp-workers AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp-workers AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On Thu, 2003-01-09 at 10:07, Richard Dawe wrote: > Hello. > test -x doesn't seem to find directories on my RedHat 6.2 box: first check > whether it finds a directory off one of the directories in $PATH; then check > whether it finds a directory called 'bin' in the path (of which there are > several): > > iolanthe:~ =] ls -ld ~/bin/get-cvs > drwxrwxr-x 3 rich rich 4096 Dec 31 00:10 > /home/rich/bin/get-cvs/ > iolanthe:~ =] echo $PATH > /usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/home/rich/bin > iolanthe:~ =] test -x get-cvs && echo 'test -x finds a directory! Abandon > ship!' > iolanthe:~ =] cd src/ > iolanthe:~/src =] ls -ld bin > ls: bin: No such file or directory > iolanthe:~/src =] test -x bin && echo 'test -x finds a directory! Uh-oh!' > iolanthe:~ =] rpm -q sh-utils > sh-utils-2.0-5 Ho hum - I was talking in the context of a path search (I highly doubt running 'test -x' will _ever_ do a path search by itself; 'test -x rm' won't return true unless you're in /bin or /usr/bin or whatever). In the case of using test -x /usr/local/bin/m4 however, test -x WILL return true if /usr/local/bin/m4 refers to a directory (that the current user can cd into). You'd need 'test -f foo && test -x foo' for a more foolproof test. And that is what happened in autoconf's AC_PROG_PATH if 'test -x' was used as executable test instead of 'test -f' > Bye, Rich =] -- Tim Van Holder