rpmlint
rpmlint copied to clipboard
Run checkbashisms on /bin/sh scriptlets
rpmlint could run /usr/bin/checkbashisms on all scriptlets that have /bin/sh as the interpreter.
https://lists.fedoraproject.org/pipermail/devel/2014-October/203024.html
Original comment by: scop
I'm not convinced that this is very valuable. Even if we decide it's worthwhile to make /bin/sh be a more minimal non-dash shell, we don't have to use that for RPM scriptlets.
Original comment by: matthewmiller
Well, it's been a while... but this is still a feature that I think has some merit. While Fedora'a packaging guidelines state to assume bash as /bin/sh, that's a) not really technically proper, and b) not great for other users of 'rpm' that might have other ideas about /bin/sh.
Running this and having the result be either Informational or a Warning (perhaps as an rpmlint compile or runtime option) would expose this type of data for end users looking for a more POSIX-correct solution.
We now have check for bash/syntax in the content of the packages, thus doing the same on the scriptlets should be trivial.
@scarabeusiv Can you help me here? What does it mean use it for scriplets?
@marxin this will need to be part of the speccheck or a new check as a whole and we have scriptlets (the %post/%pre/... in there) also it should be in the metadata of the rpm in INFO/SCRIPTS/* so those could be checked even without providing the actual specfile I guess.
The intent is that this would be good preparation/lintchecking for the case where either /bin/sh isn't bash, or https://github.com/rpm-software-management/rpm/issues/646 has been implemented, allowing an rpm macro to specify a differing default Bourne shell interpreter at install/scriptlet time if none is specified (e.g., dash).