Bugzilla – Bug 2842
Generated bakeSetEnv.sh needs empty path detection
Last modified: 2018-01-04 17:16:13 UTC
The generated bakeSetEnv.sh doesn't check if path variables are empty before appending. This causes a bash error when sourcing the file, and the variables aren't set. For example, on my Mac, LD_LIBRARY_PATH doesn't normally exist. After sourcing bakeSetEvn.sh, it still doesn't exist... Suggested fix could look like: if [ -z "${LD_LIBRARY_PATH:-}" ]; then export LD_LIBRARY_PATH=... else export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:..." fi A little more cryptic, this also works: export LD_LIBRARY_PATH="${LD_LIBRARY_PATH:+${LD_LIBRARY_PATH}:}..." The fix should be made to each variable in the script. The actual export statements are generated by ModuleEnvironment.py, in the add_onPath function around line 414. [Note: encapsulating the rhs of shell variable assignment in double quotes is preferred, in case it contains ' ' spaces...]
Clarify: error is caused by expansion of an unset environment variable
Created attachment 2987 [details] Suggested patch Suggested patch. This patch also detects if the file is being sourced correctly, and if not prints the error message and exits.
fixed in changeset 385:d64a4a547639, thanks!