Opened 17 years ago
Last modified 17 years ago
#196 new defect
bash'isms in build_thirdparty.sh which uses /bin/sh
Reported by: | warmerdam | Owned by: | warmerdam |
---|---|---|---|
Priority: | minor | Milestone: | 3.4.0 |
Component: | Build System | Version: | 3.2.0 |
Severity: | 3 | Keywords: | bash |
Cc: | External ID: |
Description
When I build FDO from svn trunk (presumably analygous to 3.3) I get:
warmerda@gdal64[23]% ./build_thirdparty.sh test: 152: ==: unexpected operator test: 161: ==: unexpected operator ./build_thirdparty.sh: 168: Syntax error: Bad fd number
the problem turns out to be that on Ubuntu /bin/sh is now a pointer to /bin/dash which is presumably a more bourne shell compatible interpreter than /bin/bash. But the script uses "==" as an operator for test which I gather is a bash extension.
The problem can be resolved by changing == to = or running the script with /bin/bash instead of /bin/sh.
My suggestion is that we just modify the bang line for these scripts to use /bin/bash, though cleaning them up to work with real bourne shells should also be fairly straight forward. I'd be willing to take on the implementation of either if so desired.
Note, bash is not normally available on some BSD derived systems, so in some ways the sh compatability is better than just using bash.
I believe this problem affects other similar scripts like build_linux.sh.
Another work around is to change the /bin/sh pointer on my system to point to bash but that may have unexpected consequences, and isn't a good solution for the project.
Change History (2)
comment:1 by , 17 years ago
Owner: | changed from | to
---|
comment:2 by , 17 years ago
Milestone: | 3.3.0 → 3.3.1 |
---|
Frank, I believe you affered to help. Please let us know if this is still the case.