After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 720068 - jhbuild's ./ hardcodes #!/bin/bash
jhbuild's ./ hardcodes #!/bin/bash
Product: jhbuild
Classification: Infrastructure
Component: general
Other All
: Normal normal
: ---
Assigned To: Jhbuild maintainers
Jhbuild QA
Depends on:
Reported: 2013-12-08 17:28 UTC by Allison Karlitskaya (desrt)
Modified: 2014-01-02 15:52 UTC
See Also:
GNOME target: ---
GNOME version: ---

Attachments drop bashism, use POSIX sh (1.83 KB, patch)
2013-12-22 02:13 UTC, Allison Karlitskaya (desrt)
committed Details | Review

Description Allison Karlitskaya (desrt) 2013-12-08 17:28:10 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.
Comment 1 Allison Karlitskaya (desrt) 2013-12-08 17:30:39 UTC
This was introduced with bug 654555 due to the fact that the added there introduced some bashisms.  There is a patch there, though, to try to remove those in the interest of ./ being able to run on pure POSIX sh.
Comment 2 Colin Walters 2013-12-08 17:34:45 UTC
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.
Comment 3 Allison Karlitskaya (desrt) 2013-12-22 02:13:42 UTC
Created attachment 264743 [details] [review] drop bashism, use POSIX sh

We had a complicated loop in 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,
but that seems like a good thing to me.
Comment 4 Allison Karlitskaya (desrt) 2014-01-02 15:51:58 UTC
Attachment 264743 [details] pushed as 8a216fa - drop bashism, use POSIX sh