[arch-general] A good time to switch to dash as /bin/sh?

lolilolicon lolilolicon at gmail.com
Fri Sep 26 07:35:26 EDT 2014

On Fri, Sep 26, 2014 at 6:06 PM, Mailing Lists
<mailinglists at hawkradius.com> wrote:
> i just ran the "checkbashisms" script from the AUR on my /usr/bin using
> the command from the wiki:
> # checkbashisms -f -p $(grep -rlE '^#! ?/bin/(env )?sh' /usr/bin)
> which revealed 470 instances of putative bashisms in scripts using
> #!/bin/sh.

The grep would find some false positives -- e.g., some perl script might
include #!/bin/sh in its body (such as findimagedupes).

With dash you don't really need -p, which is more strict.

The following will reduce the count drastically:

    for f in /usr/bin/*; do
        test -f "$f" || continue
        sed -nr '
        ' "$f" || checkbashisms -f "$f"

This finds 259 instances for me, of which 208 instances are from a
*single* script /usr/bin/libtool -- which apparently really relies on bash.

Among The other instances of bashism, many are false positives (if we
had removed -f from the checkbashisms command line, some could have been
detected), but some are real, such as /usr/bin/bzgrep and /usr/bin/xbmc,
but they're mostly an easy fix for upstream.

> Assuming that these bashisms all come from upstream, patching
> and maintaining them would be a chore.

>From my inspection above, bashism is really not that wide spread.

More information about the arch-general mailing list