You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Greg Hudson <gh...@MIT.EDU> on 2004/09/10 17:14:20 UTC

Re: svn commit: r10868 - trunk/build/ac-macros

On Thu, 2004-09-09 at 20:49, breser@tigris.org wrote:
> +    if [ test -f "$where" ]; then
> +    if [ test ! -f "$SWIG" ] || [ test ! -x "$SWIG" ]; then

The square brackets around the test commands are harmless in this
context (they act as m4 quote characters in this context), but are
confusing because you've written what at first glance appears to be
invalid shell code.

Also, the second statement is weird, firstly because it uses two test
processes instead of -o, and secondly because the second test seems to
subsume the first one (that is, just 'test ! -x "$SWIG"' would seem to
do the job).


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: svn commit: r10868 - trunk/build/ac-macros

Posted by Julian Foad <ju...@btopenworld.com>.
Ben Reser wrote:
> On Fri, Oct 01, 2004 at 03:36:05PM +0100, Julian Foad wrote:
> 
>>Greg was talking about the second and first tests within the second line: 
>>"($SWIG is not a file) or ($SWIG is not an executable file)" can be 
>>simplified to "$SWIG is not an executable file".  Note that "test -x" does 
>>have that particular meaning; it won't match a directory.
> 
> Actually it will.  Go try it.  Greg and I talked abou this on IRC and he
> realized that what I did was right.
> 
> $ mkdir dir
> $ [ -x dir ] && echo foo
> foo

Oh.  My apologies.

- Julian

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: svn commit: r10868 - trunk/build/ac-macros

Posted by Ben Reser <be...@reser.org>.
On Fri, Oct 01, 2004 at 03:36:05PM +0100, Julian Foad wrote:
> Greg was talking about the second and first tests within the second line: 
> "($SWIG is not a file) or ($SWIG is not an executable file)" can be 
> simplified to "$SWIG is not an executable file".  Note that "test -x" does 
> have that particular meaning; it won't match a directory.

Actually it will.  Go try it.  Greg and I talked abou this on IRC and he
realized that what I did was right.

$ mkdir dir
$ [ -x dir ] && echo foo
foo

-- 
Ben Reser <be...@reser.org>
http://ben.reser.org

"Conscience is the inner voice which warns us somebody may be looking."
- H.L. Mencken

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: svn commit: r10868 - trunk/build/ac-macros

Posted by Julian Foad <ju...@btopenworld.com>.
Ben Reser wrote:
> On Fri, Sep 10, 2004 at 01:14:20PM -0400, Greg Hudson wrote:
>>On Thu, 2004-09-09 at 20:49, breser@tigris.org wrote:
>>
>>>+    if [ test -f "$where" ]; then
>>>+    if [ test ! -f "$SWIG" ] || [ test ! -x "$SWIG" ]; then
[...]
>>Also, the second statement is weird, firstly because it uses two test
>>processes instead of -o,
[...]
>> and secondly because the second test seems to
>>subsume the first one (that is, just 'test ! -x "$SWIG"' would seem to
>>do the job).
> 
> Look again.  The first test is to see if the $where is a file, the
> second test is to see if $SWIG is a file.

Greg was talking about the second and first tests within the second line: "($SWIG is not a file) or ($SWIG is not an executable file)" can be simplified to "$SWIG is not an executable file".  Note that "test -x" does have that particular meaning; it won't match a directory.

- Julian


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: svn commit: r10868 - trunk/build/ac-macros

Posted by Ben Reser <be...@reser.org>.
On Fri, Sep 10, 2004 at 01:14:20PM -0400, Greg Hudson wrote:
> On Thu, 2004-09-09 at 20:49, breser@tigris.org wrote:
> > +    if [ test -f "$where" ]; then
> > +    if [ test ! -f "$SWIG" ] || [ test ! -x "$SWIG" ]; then
> 
> The square brackets around the test commands are harmless in this
> context (they act as m4 quote characters in this context), but are
> confusing because you've written what at first glance appears to be
> invalid shell code.

Ahh you're right, I usually use the brackets instead of test and the m4
uses test for obvious reasons, so I just reflexivly typed the brackets
but was trying to use test.

I'll fix this.

> Also, the second statement is weird, firstly because it uses two test
> processes instead of -o,

I always forget that test supports -o.  I'll change this as well.

>  and secondly because the second test seems to
> subsume the first one (that is, just 'test ! -x "$SWIG"' would seem to
> do the job).

Look again.  The first test is to see if the $where is a file, the
second test is to see if $SWIG is a file.  Note that if $where is not a
file we assume it's the path to the prefix where SWIG was installed.
Thus we have to test twice.  

I intentionally made the prefix path the default (the part in the else
clause) becuase we document --with-swig as wanting the prefix to where
SWIG is installed, so this causes the error message for a non-existant
path to have the bin/swig concated on it to give the user a clue as to
what they're expected to pass.

-- 
Ben Reser <be...@reser.org>
http://ben.reser.org

"Conscience is the inner voice which warns us somebody may be looking."
- H.L. Mencken

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org