I keep getting bit by this old bug:
bash - /sw/bin/init.sh fails to set undefined variables - ID: 1511981
As reported there, a number of variables in /sw/bin/init.sh are checked via
if [ -n "$VAR" ] ; then . . .
which fails when the user has "set -u", "set -o nounset", or "shopt -o
-s nounset"
costabel wrote "I am closing this now; it doesn't look like anyone wants
to change anything there." when he closed it marked "Wont fix"
Please reconsider. Patch attached.
To reproduce:
$ env -i bash --login --noprofile -norc
bash-3.2$ export HOME=~
bash-3.2$ set -u && . /sw/bin/init.sh
bash: MANPATH: unbound variable
bash: INFOPATH: unbound variable
bash: PERL5LIB: unbound variable
bash: DYLD_FALLBACK_LIBRARY_PATH: unbound variable
bash: list[@]: unbound variable
That previous bug report is:
https://sourceforge.net/tracker/?func=detail&aid=1511981&group_id=17203&atid=117203
sorry sf trackers had easy linkability:(
Is the attached .patch backwards? Looks like it's converting ${FOO:-}" to "$FOO" but our .init.sh presently *does* do "$FOO" and previous bug-report recommended converting *to* using "${FOO:-}"