dogtagpki / pki

The Dogtag Certificate System is an enterprise-class Certificate Authority (CA) which supports all aspects of certificate lifecycle management, including key archival, OCSP and smartcard management.
https://www.dogtagpki.org
GNU General Public License v2.0
365 stars 135 forks source link

fix bashisms #2369

Open pki-bot opened 4 years ago

pki-bot commented 4 years ago

This issue was migrated from Pagure Issue #2249. Originally filed by tjaalton (@tjaalton) on 2016-03-29 19:04:35:


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

pki-bot commented 4 years ago

Comment from tjaalton (@tjaalton) at 2016-03-29 19:04:55

attachment use-dot-instead-of-source.diff

pki-bot commented 4 years ago

Comment from mharmsen (@mharmsen) at 2016-04-26 19:13:56

pki-bot commented 4 years ago

Comment from mharmsen (@mharmsen) at 2016-04-26 19:18:24

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

pki-bot commented 4 years ago

Comment from mharmsen (@mharmsen) at 2016-04-26 22:55:00

Checked into master:

pki-bot commented 4 years ago

Comment from mharmsen (@mharmsen) at 2016-04-27 00:52:13

Bugzilla Bug 1330755 - Fix 'bashisms' in tests was filed separately and assigned to QE.

pki-bot commented 4 years ago

Comment from tjaalton (@tjaalton) at 2016-09-30 10:21:45

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

pki-bot commented 4 years ago

Comment from mharmsen (@mharmsen) at 2016-10-05 17:26:14

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'.

pki-bot commented 4 years ago

Comment from tjaalton (@tjaalton) at 2016-10-05 19:40:06

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

pki-bot commented 4 years ago

Comment from mharmsen (@mharmsen) at 2016-10-25 20:42:40

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

pki-bot commented 4 years ago

Comment from tjaalton (@tjaalton) at 2017-02-27 14:10:32

Metadata Update from @tjaalton:

pki-bot commented 4 years ago

Comment from edewata (@edewata) at 2018-04-10 11:11:55

https://manpages.debian.org/jessie/devscripts/checkbashisms.1.en.html

pki-bot commented 4 years ago

Comment from edewata (@edewata) at 2018-04-10 11:11:56

Metadata Update from @edewata: