Uh oh!
There was an error while loading. Please reload this page.
Port shell script to POSIX sh - #45958
Conversation
The ui/update-all-references.sh is pretty standard, excepted for the arguments parsing part, which is ported to POSIX condition style. It so works with sh, which is more convenient, as it decreases the need to install bash on UNIX-like non-linux OS.
shepmaster
commented
Nov 18, 2017
@alexcrichton can you weigh in on how scary such a change might be? My personal opinion is to actively use bash and bash features. See also #45957 |
shepmaster
commented
Nov 19, 2017
From #45957:
To me, needing to install bash seems about the same as needing to install Python (and whatever else is needed), but making such large decisions is above my paygrade. |
alexcrichton
commented
Nov 19, 2017
Hm yeah I agree with @shepmaster that there's no need to limit ourselves in all cases, for example this script is never used by the build system, just developers. @dereckson was this done for a particular reason or just a blanket "lint all files in the repo"? |
@alexcrichton It occurred after a note from @semarie - who maintain Rust port on OpenBSD - there is an appreciable maintenance time cost to install bash on OpenBSD server, or have to patch files locally when /bin/bash is hardcoded. So my first wish was to fix shebangs to call bash properly. But then, I've noticed some scripts were virtually already ready to be written in pure sh. Basically, less bash scripts there are, easiest is the life for the BSD distributions testing and packaging work. But indeed, I've no specific feedback this particular script is needed there: to fix the condition was as quick as fix the shebang to |
semarie
commented
Nov 20, 2017
@dereckson thanks for taking care of that, but I don't use this particular script (the one I mentioned on IRC come from rust-lang/rust-installer and I could easily workaround by calling @alexcrichton in a more general way, gracefully using not POSIX shell extensions could become problematic. I agree with @dereckson that at least having path agnotic shebang would be better: it removes the need to patch the script to correct the shebang. |
alexcrichton
commented
Nov 20, 2017
Yes updating the shebang is fine, what I'd prefer to not do is avoid using bash everywhere. |
shepmaster
commented
Nov 24, 2017
My reading of the last comment indicates that we should close this PR — I don't see an interest in removing the need for bash. |
shepmaster
commented
Dec 1, 2017
Based on my understanding of the comments, I'm going to go ahead and close this PR for now. #45957 can cover updating all the shell scripts to use |
The ui/update-all-references.sh is pretty standard, excepted for
the arguments parsing part, which is ported to POSIX condition
style. It so works with sh, which is more convenient, as it
decreases the need to install bash on UNIX-like non-linux OS.