GNOME Bugzilla – Bug 720068
jhbuild's ./autogen.sh hardcodes #!/bin/bash
Last modified: 2014-01-02 15:52:01 UTC
The assumption of the existence of bash is non-POSIX and, indeed, on many systems bash is found in /usr/local/bin. We should probably just use #!/bin/sh instead.
This was introduced with bug 654555 due to the fact that the autogen.sh added there introduced some bashisms. There is a patch there, though, to try to remove those in the interest of ./autogen.sh being able to run on pure POSIX sh.
I believe "#!/usr/bin/env bash" is a more canonical way to locate bash portably, or really any binary. All problems can be solved by adding an extra layer of indirection, etc. But porting autogen scripts to /bin/sh is probably fine too.
Created attachment 264743 [details] [review] autogen.sh: drop bashism, use POSIX sh We had a complicated loop in autogen.sh for parsing commandline options. It allowed setting arbitrary variables in the script, despite the fact that only two variable were ever documented as being supported (or probably ever used). The ability to set random shell variables was pretty questionable to begin with. Remove the bash-specific substring operations and replace the loop with a more common switch-based approach which should work with any POSIX shell (tested with dash). Change to #!/bin/sh. This patch has the side effect that the user can no longer use a commandline argument to modify the IFS of the shell running autogen.sh, but that seems like a good thing to me.
Attachment 264743 [details] pushed as 8a216fa - autogen.sh: drop bashism, use POSIX sh