From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id A7441138A1A for ; Thu, 22 Jan 2015 23:01:31 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 8DCC8E0976; Thu, 22 Jan 2015 23:01:28 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id BE6B9E0976 for ; Thu, 22 Jan 2015 23:01:27 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 02859340761 for ; Thu, 22 Jan 2015 23:01:27 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id ACB3A10289 for ; Thu, 22 Jan 2015 23:01:25 +0000 (UTC) From: "Robin H. Johnson" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Robin H. Johnson" Message-ID: <1421409482.4f303b048743f494a79916a0a30ecb3b027164b7.robbat2@OpenRC> Subject: [gentoo-commits] proj/netifrc:master commit in: sh/ X-VCS-Repository: proj/netifrc X-VCS-Files: sh/functions.sh X-VCS-Directories: sh/ X-VCS-Committer: robbat2 X-VCS-Committer-Name: Robin H. Johnson X-VCS-Revision: 4f303b048743f494a79916a0a30ecb3b027164b7 X-VCS-Branch: master Date: Thu, 22 Jan 2015 23:01:25 +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-Archives-Salt: 5d41bc13-c657-4825-a5a4-bd8116188533 X-Archives-Hash: a4489a3382a26e98fe26e17f185a5015 commit: 4f303b048743f494a79916a0a30ecb3b027164b7 Author: Guillaume Castagnino denyall com> AuthorDate: Fri Jan 16 11:57:15 2015 +0000 Commit: Robin H. Johnson gentoo org> CommitDate: Fri Jan 16 11:58:02 2015 +0000 URL: http://sources.gentoo.org/gitweb/?p=proj/netifrc.git;a=commit;h=4f303b04 fix https://bugs.gentoo.org/show_bug.cgi?id=536758 The shill version of shell_var is not correctly escaping vars --- sh/functions.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sh/functions.sh b/sh/functions.sh index 368bb73..d82d72a 100644 --- a/sh/functions.sh +++ b/sh/functions.sh @@ -33,11 +33,14 @@ if [ -z "$(command -v service_set_value >/dev/null 2>&1)" ]; then } shell_var() { - local output=$1 sanitized_arg= - shift 1 + local output= sanitized_arg= for arg; do sanitized_arg="${arg//[^a-zA-Z0-9_]/_}" - output="$output $arg" + if [ x"$output" = x"" ] ; then + output=$sanitized_arg + else + output="$output $sanitized_arg" + fi done echo "$output" }