On 3/04/2013 1:03 PM, Mike Duigou wrote:
Hello all;
Further testing on JDK-8011342 revealed that hgforest.sh can fail if the sh
shell is not bash. The problem appears to be due to mixing of -o -a and ! in []
test expressions.
What a bizarre failure mode. In the tests I did:
/usr/local/bin/python -V | cut -f 1 -d " "
produces
Python 2.7.3
on both sh and bash. Yet when it is part of the script:
if [ -x "$python" -a ! -d "$python" -a "`${python} -V 2>&1 | cut -f 1
-d " "`" == "Python" ] ; then
it evaluates to just "Python" on bash.
I have prepared a webrev here:
http://cr.openjdk.java.net/~mduigou/JDK-8011350/0/webrev/common/bin/hgforest.sh.udiff.html
This converts all of the potentially problematic [ expr -o expr ] [ expr -a expr ] and [ expr
-{o|a} ! expr ] to use "test". My conversions are based on the advice of the autotools
chapter on "Writing portable Bourne Shell"
(http://sourceware.org/autobook/autobook/autobook_208.html#SEC208) for avoiding potential problems.
The other option is just to require bash which is already required by the new
build process.
I'm inclined to go for the latter though that requires a change to
get_source.sh as well to use bash.
But I defer to the build gurus.
BTW this is now a P1 as it blocks the TL nightly build as the pre-build
is done on a Solaris machine.
David
Mike