[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] eliminate test -a and test -o from configure bits

From: Peter Samuelson <peter_at_p12n.org>
Date: 2005-12-12 23:44:24 CET

[Malcolm Rowe]
> Although now I come to look at it, 'test -a' and 'test -o' are
> documented as an XSI extension to POSIX. Are there any real-life
> cases where we 'test -a' doesn't work?

I don't know. I do know that Debian ships one very strict POSIX shell
(presumably for testing compatibility issues) which chokes on -a and
-o. I don't know that anyone actually *uses* it as their /bin/sh -
there doesn't seem to be much point. I use it, but only for testing
shell constructs for portability, when I'm in doubt.

From the autoconf manual, though:

    On System V, the precedence of `-a' and `-o' is wrong relative to
    the unary operators; consequently, POSIX does not specify them, so
    using them is nonportable.

It's a great reference to such issues; it also says, for example:

    Contrary to a common belief, `test -n STRING' and `test -z STRING'
    *are* portable. Nevertheless many shells (such as Solaris 2.5, AIX
    3.2, UNICOS 10.0.0.6, Digital Unix 4 etc.) have bizarre precedence
    and may be confused if STRING looks like an operator:

        $ test -n =
        test: argument expected

> > -if test "$BINNAME" = "" -a "$APXS" = ""; then
> > +if test "$BINNAME $APXS" = " "; then
>
> I don't like this change, though.

Fixed. I wondered about the tradeoff of clarity / terseness myself. I
tend to think terse things are more clear than verbose things, all else
being equal, and I have an unfortunate tendency to err on that side.

Thanks,
Peter

Received on Mon Dec 12 23:46:36 2005

This is an archived mail posted to the Subversion Dev mailing list.