[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: install-sh posix compliance
From: |
Paul Eggert |
Subject: |
Re: install-sh posix compliance |
Date: |
Thu, 27 Jun 2002 02:20:13 -0700 (PDT) |
> From: Alexandre Duret-Lutz <address@hidden>
> Date: Thu, 27 Jun 2002 10:09:22 +0200
>
> I don't get it. The issue that you and the Autoconf manual
> describe is that `-a' and `-o' cannot be used *together*.
It's more complicated than that, due to combinations with other
operators. For example, POSIX requires that
test ! -o = -a
must succeed; here the "-o" and "-a" must be parsed as strings, not
options. Even worse:
test '(' = ')'
must fail (because '(' and ')' are different strings), whereas
test '(' -a ')'
must succeed (because '-a' is not the null string).
If you assume the XSI extension to POSIX 1003.1-2001, so that you get
the -a and -o operators, then you have further anomalies. For example,
test 0 != 1 -a 2 != 3
conforms to POSIX+XSI, but
test 0 -ne 1 -a 2 -ne 3
does not conform. "!=" and "-ne" have different parsing rules in the
standard, when they are used with "-a" and "-o". I haven't a clue as
to why the rules differ.
All this leads me to suggest that portable scripts should avoid -a and
-o entirely. && and || suffice and are portable. I'd rather not
worry about the ambiguities and portability problems of -a and -o.
(I don't even want to know which systems support -a and -o;
I have too few brain cells as it is. :-)