|
Bugzilla – Full Text Bug Listing |
| Summary: | Generated bakeSetEnv.sh needs empty path detection | ||
|---|---|---|---|
| Product: | bake | Reporter: | Peter Barnes <pdbarnes> |
| Component: | bake | Assignee: | Daniel Camara <daniel.camara> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | ns-bugs, tomh |
| Priority: | P3 | ||
| Version: | unspecified | ||
| Hardware: | All | ||
| OS: | All | ||
| Attachments: | Suggested patch | ||
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! |
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...]