Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#1623 /sw/bin/init.sh crashes with set -u

Any_OS_X
open
nobody
5
2011-08-08
2011-08-08
No

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

Discussion

  •  
    Attachments
  • Daniel Macks
    Daniel Macks
    2011-08-30

    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:-}"