#2249 fix bashisms
Closed: migrated 3 years ago by dmoluguw. Opened 8 years ago by tjaalton.

some wrappers use "source foo" which is a bashism, best to import with a dot instead which is compatible with dash etc


  • change "source" to "."
  • change "bash" to "sh"

Fix bashisms - convert 'source' to '.' and 'bash' to 'sh'
20160426-fix-bashisms.patch

Checked into master:

  • 4708983b88d33cb1b1c2cc913499c18dfc7d6959

Hmm, I don't think it's wise to change #!/bin/bash to sh, because there can be other bashisms and you wouldn't notice them. It's fine to keep them using /bin/bash, the original problem was scripts using /bin/sh and bashism in them. The simpler alternative to 'use-dot-instead..' would've been to just migrate these scripts to use /bin/bash.. I'm fine with doing that, since bash is always available on Debian & Ubuntu

Replying to [comment:5 tjaalton]:

Hmm, I don't think it's wise to change #!/bin/bash to sh, because there can be other bashisms and you wouldn't notice them. It's fine to keep them using /bin/bash, the original problem was scripts using /bin/sh and bashism in them. The simpler alternative to 'use-dot-instead..' would've been to just migrate these scripts to use /bin/bash.. I'm fine with doing that, since bash is always available on Debian & Ubuntu

Based on what is being pointed out here, I believe that it may be more than just changing all "sh" to / back to "bash"; I believe that on some platforms, "/bin/bash" may not exist; does "/usr/bin/bash" always exist on all platforms?

http://www.tldp.org/LDP/Linux-Filesystem-Hierarchy/html/Linux-Filesystem-Hierarchy.html#bin states that "essential" programs are stored under the "/bin" directory; however, I believe that some distributions may use "/bin/sh" pointing to the distribution's default shell, and in some distributions, "/bin" is nothing more than a symbolic link to "/usr/bin".

Before any such change could be made, we need to make certain that ALL shell scripts use an embedded invocation command that is supported across ALL of the various Linux distributions.

Additionally, if "bash" is not the default shell on a platform, does this imply that all spec files should include this as a build/run time requirement?

Finally, once the changes are agreed upon, they must be applied to every shell script in both the PKI server / client code as well as the PKI test framework alluded to in Bugzilla Bug #1330755 - Fix 'bashisms'.

No, /usr/bin/bash does not exist on Debian-based distros at least, because they haven't done the /bin -> /usr/bin migration like Fedora has

There was no problem with using /bin/bash AFAIK, but if the ultimate goal is to not use bashisms then a checker tool should be used, something like checkbashisms perl script from Debian devscripts package. Here's a result from checking the test cli-scripts :)

http://pastebin.com/3tYeGVsE

Per PKI Bug Council of 10/25/2016: 10.4 - major

Metadata Update from @tjaalton:
- Issue assigned to mharmsen
- Issue set to the milestone: UNTRIAGED

7 years ago

Metadata Update from @edewata:
- Custom field feature adjusted to None
- Custom field proposedmilestone adjusted to None
- Custom field proposedpriority adjusted to None
- Custom field reviewer adjusted to None
- Custom field rhbz adjusted to https://bugzilla.redhat.com/show_bug.cgi?id=1330755 (was: 0)
- Custom field version adjusted to None

6 years ago

Dogtag PKI is moving from Pagure issues to GitHub issues. This means that existing or new
issues will be reported and tracked through Dogtag PKI's GitHub Issue tracker.

This issue has been cloned to GitHub and is available here:
https://github.com/dogtagpki/pki/issues/2369

If you want to receive further updates on the issue, please navigate to the
GitHub issue and click on Subscribe button.

Thank you for understanding, and we apologize for any inconvenience.

Metadata Update from @dmoluguw:
- Issue close_status updated to: migrated
- Issue status updated to: Closed (was: Open)

3 years ago

Login to comment on this ticket.

Metadata