From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 4D6B31382C5 for ; Thu, 11 Mar 2021 06:12:28 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 74BE4E08E0; Thu, 11 Mar 2021 06:12:27 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 07A8EE08E0 for ; Thu, 11 Mar 2021 06:12:26 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 5D639340D67 for ; Thu, 11 Mar 2021 06:12:25 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id A61504AF for ; Thu, 11 Mar 2021 06:12:23 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1615443072.57c3b63a002a67aad884624fc89fe57c50e94eb5.sam@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: net-irc/irker/files/ X-VCS-Repository: repo/gentoo X-VCS-Files: net-irc/irker/files/irkerd.confd net-irc/irker/files/irkerd.initd X-VCS-Directories: net-irc/irker/files/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: 57c3b63a002a67aad884624fc89fe57c50e94eb5 X-VCS-Branch: master Date: Thu, 11 Mar 2021 06:12:23 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 95a96cd7-d10f-4675-a1ff-c56096697153 X-Archives-Hash: a7f36a366f1d7b43abbfa8686265a86e commit: 57c3b63a002a67aad884624fc89fe57c50e94eb5 Author: Kerin Millar plushkava net> AuthorDate: Thu Mar 11 06:11:12 2021 +0000 Commit: Sam James gentoo org> CommitDate: Thu Mar 11 06:11:12 2021 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=57c3b63a 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 plushkava.net> Signed-off-by: Sam James gentoo.org> net-irc/irker/files/irkerd.confd | 4 ++-- net-irc/irker/files/irkerd.initd | 29 ++++++++++++----------------- 2 files changed, 14 insertions(+), 19 deletions(-) diff --git a/net-irc/irker/files/irkerd.confd b/net-irc/irker/files/irkerd.confd index 42ae7323612..9b74518472c 100644 --- a/net-irc/irker/files/irkerd.confd +++ b/net-irc/irker/files/irkerd.confd @@ -12,8 +12,8 @@ # Debug Level (critical, error, warning, info, debug) # IRKERD_LOGLEVEL="" -# To run an anonymous irkerd safely. It should not be able -# to write to anywhere on your system +# To run an anonymous irkerd safely. It should not be able to write to anywhere +# on your system. If the user is undefined or empty, it defaults to "nobody". # IRKERD_USER="" # see man pages for irkerd for valid cmdline options diff --git a/net-irc/irker/files/irkerd.initd b/net-irc/irker/files/irkerd.initd index 6417d45ebf8..9a02708e2ee 100644 --- a/net-irc/irker/files/irkerd.initd +++ b/net-irc/irker/files/irkerd.initd @@ -2,32 +2,27 @@ # Copyright 1999-2014 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -: ${pidfile:=/run/${RC_SVCNAME}.pid} - -: ${IRKERD_NICK:=} -: ${IRKERD_PASSWORD:=} -: ${IRKERD_USER:=nobody} +: "${pidfile:=/run/${RC_SVCNAME}.pid}" +: "${IRKERD_USER:=nobody}" depend() { use net } -start () { - if [[ ${IRKERD_LOGFILE} ]] ; then +start() ( + if [ -n "${IRKERD_LOGFILE}" ] ; then checkpath -f \ -o "${IRKERD_USER}" \ "${IRKERD_LOGFILE}" \ || return 1 fi - if [[ -z "${IRKERD_USER}" ]] ; then - die "IRKERD_USER is mandatory" - fi - - [[ -n "${IRKERD_LOGLEVEL}" ]] && IRKERD_OPTS="${IRKERD_OPTS} -d ${IRKERD_LOGLEVEL}" - [[ -n "${IRKERD_LOGFILE}" ]] && IRKERD_OPTS="${IRKERD_OPTS} -l ${IRKERD_LOGFILE}" - [[ -n "${IRKERD_NICK}" ]] && IRKERD_OPTS="${IRKERD_OPTS} -n ${IRKERD_NICK}" - [[ -n "${IRKERD_PASSWORD}" ]] && IRKERD_OPTS="${IRKERD_OPTS} -p ${IRKERD_PASSWORD}" + set -f + set -- ${IRKERD_OPTS} + [ -n "${IRKERD_LOGLEVEL}" ] && set -- "$@" -d "${IRKERD_LOGLEVEL}" + [ -n "${IRKERD_LOGFILE}" ] && set -- "$@" -l "${IRKERD_LOGFILE}" + [ -n "${IRKERD_NICK}" ] && set -- "$@" -n "${IRKERD_NICK}" + [ -n "${IRKERD_PASSWORD}" ] && set -- "$@" -p "${IRKERD_PASSWORD}" ebegin "Starting ${RC_SVCNAME}" start-stop-daemon --start \ @@ -35,6 +30,6 @@ start () { --user "${IRKERD_USER}" \ --make-pidfile --pidfile "${pidfile}" \ --exec /usr/bin/irkerd \ - -- ${IRKERD_OPTS} < /dev/null + -- "$@" < /dev/null eend $? -} +)