Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 760869

Summary: net-irc/irker: uses bashisms in rc script
Product: Gentoo Linux Reporter: Sam James <sam>
Component: Current packagesAssignee: Sam James <sam>
Status: RESOLVED FIXED    
Severity: normal CC: kfm, patrick
Priority: Normal Keywords: PATCH
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 526268    
Attachments: gentoo-bug-760869.patch
gentoo-bug-760869-r1.patch

Description Sam James archtester Gentoo Infrastructure gentoo-dev Security 2020-12-20 11:54:22 UTC
$ sudo /etc/init.d/irkerd start
/lib/rc/sh/openrc-run.sh: 16: [[: not found
/lib/rc/sh/openrc-run.sh: 23: [[: not found
/lib/rc/sh/openrc-run.sh: 27: [[: not found
/lib/rc/sh/openrc-run.sh: 28: [[: not found
/lib/rc/sh/openrc-run.sh: 29: [[: not found
/lib/rc/sh/openrc-run.sh: 30: [[: not found
 * Starting irkerd ...
Comment 1 kfm 2020-12-20 13:37:58 UTC
Created attachment 678927 [details, diff]
gentoo-bug-760869.patch

Address bug 760869, along with a few other quality issues.
Comment 2 kfm 2020-12-20 13:51:30 UTC
One more thing. The following two commands serve no purpose and can be removed. The subsequent tests do not depend on them being set.

: "${IRKERD_NICK:=}"
: "${IRKERD_PASSWORD:=}"
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2020-12-20 14:54:06 UTC
I don’t know what I’ve done to deserve a comprehensive patch for my own bug within so little time of filing it, but a huge thank you!

I’ll look at it properly and apply it soon as I’m currently Bugzillaing-via-phone. Could you include the GCO sign off too? (sorry)
Comment 4 kfm 2020-12-20 15:09:10 UTC
Created attachment 678936 [details, diff]
gentoo-bug-760869-r1.patch
Comment 5 Larry the Git Cow gentoo-dev 2021-03-11 06:12:22 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=57c3b63a002a67aad884624fc89fe57c50e94eb5

commit 57c3b63a002a67aad884624fc89fe57c50e94eb5
Author:     Kerin Millar <kfm@plushkava.net>
AuthorDate: 2021-03-11 06:11:12 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2021-03-11 06:11:12 +0000

    net-irc/irker: remove bashisms from init script
    
    Quote the ${parameter:=word} expansions (SC2223), while removing two
    that are spurious.
    
    Remove the -z test which does absolutely nothing. It can never be true,
    because IRKERD_USER will always contain something. As an aside, the
    "nobody" account is not intended for running services. If ever the test
    is re-instated, it should be carried out _before_ checkpath is invoked,
    for reasons that should be obvious.
    
    Remove the use of the [[ keyword in favour of the POSIX test command
    (SC3010).
    
    Employ a vastly improved method of conveying the user-specified options.
    Obviously, POSIX sh doesn't support arrays so we must still perform
    word-splitting upon IRKERD_OPTS. However, potential pathname expansion
    can still be suppressed with set -f, so let's do that.
    
    Next, proceed to assemble a list of positional parameters using the set
    builtin. This completely eliminates the possibility for word-splitting
    and pathname expansion to be performed upon the other IRKERD_*
    variables, instead conveying them verbatim. Note that the start function
    is altered to define a ( ... ) compound command, so that the effects of
    set -f do not persist beyond the intended scope of the function.
    
    Closes: https://bugs.gentoo.org/760869
    Signed-off-by: Kerin Millar <kfm@plushkava.net>
    Signed-off-by: Sam James <sam@gentoo.org>

 net-irc/irker/files/irkerd.confd |  4 ++--
 net-irc/irker/files/irkerd.initd | 29 ++++++++++++-----------------
 2 files changed, 14 insertions(+), 19 deletions(-)