| Summary: | geant4.sh crashes when run with dash instead of bash (as in Ubuntu systems from .profile) | ||
|---|---|---|---|
| Product: | Geant4 | Reporter: | S Barnes <sbarnes> |
| Component: | cmake | Assignee: | Ben Morgan <Ben.Morgan> |
| Status: | CLOSED FIXED | ||
| Severity: | normal | CC: | sbarnes |
| Priority: | P5 | ||
| Version: | 9.5 | ||
| Hardware: | All | ||
| OS: | Linux | ||
Fixed in tag cmake-V09-05-13. |
Geant 4.9.5.p01 Ubuntu 11.10 To replicate run: $dash /path/to/geant4/bin/geant4.sh which should return the following error /path/to/geant4/bin/geant4.sh: 30: Bad substitution The root problem is the check to see if you are running bash or not (line 20): if [ "x${BASH_ARGV[0]}" = "x" ]; then Since array variables are not POSIX complaint the check to see if we are in bash will cause non-bash shells (specifically dash) to fail. The fix is simple replace the above line with: if [ -z "$BASH_VERSION" ]; then This is a much better way to see if we are running bash. The cmake file that needs patching is Geant4ToolchainBackwardCompatibility.cmake line 84. This is a concern because all Ubuntu systems (since version 6) use dash instead of bash during boot and login. So if you put the following line in your '.profile' file . /path/to/geant4/bin/geant4.sh > /dev/null In order to setup the environment variables for Geant4 as the installation guide recommends, the script will crash and you cannot login.