[OE-core] [PATCH v2] Remove bashisms

He Zhe zhe.he at windriver.com
Mon Sep 26 06:54:05 UTC 2016


OK. I have senta new patch([OE-core] [PATCH] guile: Remove bashisms) for guile as other bashisms have been addressed.

Thanks,
Zhe

On 09/22/2016 06:04 PM, Burton, Ross wrote:
> On 22 September 2016 at 10:33, <zhe.he at windriver.com <mailto:zhe.he at windriver.com>>wrote:
>
>     -if type systemctl >/dev/null 2>/dev/null; then
>     +if command -p systemctl >/dev/null 2>/dev/null; then
>
>
> This doesn't do what you want:
>
> $ type whoami ; echo $?
> whoami is /usr/bin/whoami
> 0
> $ type foobar; echo $?
> -bash: type: foobar: not found
> 1
>
> 'type' when used with a binary prints the full path (thus the redirect) and returns success if it was found, error if it wasn't.
>
> $ command -p whoami ; echo $?
> ross
> 0
>
> $ which applyotron
> /home/ross/bin/applyotron
> $ command -p applyotron
> -bash: applyotron: command not found
>
> 'command -p' searches for a binary (ignoring any aliases or builtins) in a hardcoded set of paths as you pass -p (not $PATH, so will fail at rootfs time) for a binary and executes it if found.  We don't want to look in a hard-coded set of paths, and we don't want to run the binary, so these changes are bad.
>
> bash, dash and ash all support type, which is why verify-bashisms has them on the whitelist as the simplest way of saying "does this binary exist".
>
>
>             # Remove unpackaged files (based on list in rpm.spec)
>     -       rm -f ${D}/${libdir}/rpm/{Specfile.pm,cpanflute,cpanflute2,rpmdiff,rpmdiff.cgi,sql.prov,sql.req,tcl.req,trpm}
>     +       rm -f ${D}/${libdir}/rpm/Specfile.pm
>     +       rm -f ${D}/${libdir}/rpm/cpanflute
>     +       rm -f ${D}/${libdir}/rpm/cpanflute2
>     +       rm -f ${D}/${libdir}/rpm/rpmdiff
>     +       rm -f ${D}/${libdir}/rpm/rpmdiff.cgi
>     +       rm -f ${D}/${libdir}/rpm/sql.prov
>     +       rm -f ${D}/${libdir}/rpm/sql.req
>     +       rm -f ${D}/${libdir}/rpm/tcl.req
>     +       rm -f ${D}/${libdir}/rpm/trpm
>
>
> I deleted these in "rpm: remove redundant removals" when doing a similar sweep, so please rebase to master.
>
> I think all thats left is the guile cleanup, so can you submit just that with a rewritten commit message.
>
> Ross




More information about the Openembedded-core mailing list