[Python-Dev] Re: [Python-checkins] CVS: python/dist/src configure,1.157,1.158 configure.in,1.166,1.167

Thomas Wouters thomas@xs4all.net
Thu, 5 Oct 2000 23:40:22 +0200


On Thu, Oct 05, 2000 at 11:45:55AM -0700, Barry Warsaw wrote:
> Update of /cvsroot/python/python/dist/src
> In directory slayer.i.sourceforge.net:/tmp/cvs-serv14007

> Modified Files:
> 	configure configure.in 
> Log Message:
> Change all occurances of
> 
> 	test -d "$directory"
> to
> 	test ! -z "directory" -a -d "directory"

> Apparently, on SunOS 4.1.4_JL (and other?) OSes, -d on an empty string
> always returns true.  This closes SF bug #115392.

> --- 3103,3110 ----
>       USE_THREAD_MODULE="#"
>   else
> !     if test ! -z $with_threads -a -d $with_threads
>       then LDFLAGS="$LDFLAGS -L$with_threads"
>       fi
> !     if test ! -z $withval -a -d $withval
>       then LDFLAGS="$LDFLAGS -L$withval"
>       fi

Is this really going to work ? I always see 'portable' shell code do
something like

if [ "X${spam}" != "X" ] ...

instead of 'test -z', eventhough even BSDI test has -z. (The portable code
I'm talking about are mostly BSDI /etc/rc* scripts... BSDI's /bin/sh is
minimal, compared to modern day equivalents.) My /bin/sh-knowledge is
decidedly less impressive than my Python knowledge, but I thought something
like 

if test ! -z $withval -a -d $withval

where $withval is empty, would be parsed as

if test ! -z -a -d

which would be, uhm, wrong ? But like I said, I don't really know what I'm
talking about here, there could be another perfectly valid reason for BSDI
to use the roundabout way, instead of using -z.

-- 
Thomas Wouters <thomas@xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!