[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Beware of bash 3.1



Okay, I originally posted about this a few months ago:

http://www.redhat.com/archives/rhl-devel-list/2006-January/msg00491.html

A seemingly harmless corner case. Here's another one:

<BobJensen> one of my guys ran a java install script as sudo and fubar'd
the box
<BobJensen> he was following these instructions
http://fedorasolved.org/browser-solutions/java-i386/

Step 9, which looks like this:

cat <<EOF > /etc/profile.d/java.sh
export JAVA_HOME=/opt/jre1.5.0_06
export PATH=$JAVA_HOME/bin:$PATH
EOF

Results in this:

# cat /etc/profile.d/java.sh
export JAVA_HOME=/opt/jre1.5.0_06
export PATH=/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/lib64/ccache:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin

Which is wrong. The fix is of course:

# cat <<EOF > ~/java.sh
> export JAVA_HOME=/opt/jre1.5.0_06
> export PATH=\$JAVA_HOME/bin:\$PATH
> EOF

# cat ~/java.sh
export JAVA_HOME=/opt/jre1.5.0_06
export PATH=$JAVA_HOME/bin:$PATH

So... bash 3.1 has definitely changed the way variable expansion is
done, namely it expands things it didn't used to expand. Bug or feature?
Either way, beware.

(And there's the larger issue, being that those instructions suck,
instead you should be using http://www.city-fan.org/tips/JpackageJava
which is linked from http://www.fedoraproject.org/wiki/JavaFAQ and thus
appears to be officially blessed. But that's not really an issue for
-devel...)

Attachment: signature.asc
Description: This is a digitally signed message part


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]