From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <gentoo-commits+bounces-644502-garchives=archives.gentoo.org@lists.gentoo.org> Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id EC084138247 for <garchives@archives.gentoo.org>; Sat, 30 Nov 2013 21:34:03 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 5B209E084C; Sat, 30 Nov 2013 21:33:55 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id E6D10E084C for <gentoo-commits@lists.gentoo.org>; Sat, 30 Nov 2013 21:33:52 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 5343333F1A5 for <gentoo-commits@lists.gentoo.org>; Sat, 30 Nov 2013 21:33:51 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 866AAE545F for <gentoo-commits@lists.gentoo.org>; Sat, 30 Nov 2013 21:33:48 +0000 (UTC) From: "Mike Frysinger" <vapier@gentoo.org> To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Mike Frysinger" <vapier@gentoo.org> Message-ID: <1385847211.af30c4b86e20512cbd2cfa861ff8346ed6bd1c3e.vapier@OpenRC> Subject: [gentoo-commits] proj/openrc:master commit in: sh/ X-VCS-Repository: proj/openrc X-VCS-Files: sh/functions.sh.in X-VCS-Directories: sh/ X-VCS-Committer: vapier X-VCS-Committer-Name: Mike Frysinger X-VCS-Revision: af30c4b86e20512cbd2cfa861ff8346ed6bd1c3e X-VCS-Branch: master Date: Sat, 30 Nov 2013 21:33:48 +0000 (UTC) Precedence: bulk List-Post: <mailto:gentoo-commits@lists.gentoo.org> List-Help: <mailto:gentoo-commits+help@lists.gentoo.org> List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org> List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org> List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org> X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: ad21574d-a591-4054-9938-ab3d5d925fbc X-Archives-Hash: 0338d1c785024ed62c6db0aea2eb75d9 commit: af30c4b86e20512cbd2cfa861ff8346ed6bd1c3e Author: Mike Frysinger <vapier <AT> gentoo <DOT> org> AuthorDate: Sat Nov 30 21:21:15 2013 +0000 Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org> CommitDate: Sat Nov 30 21:33:31 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=af30c4b8 functions.sh: yesno: (mostly) fix eval logic We need to quote the expansion. X-Gentoo-Bug: 475032 X-Gentoo-Bug: https://bugs.gentoo.org/475032 Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org> --- sh/functions.sh.in | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sh/functions.sh.in b/sh/functions.sh.in index 52a8ae7..e4e69eb 100644 --- a/sh/functions.sh.in +++ b/sh/functions.sh.in @@ -24,13 +24,18 @@ yesno() { [ -z "$1" ] && return 1 + # Check the value directly so people can do: + # yesno ${VAR} case "$1" in [Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1) return 0;; [Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0) return 1;; esac + # Check the value of the var so people can do: + # yesno VAR + # Note: this breaks when the var contains a double quote. local value= - eval value=\$${1} + eval value=\"\$$1\" case "$value" in [Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1) return 0;; [Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0) return 1;;