From: Brian Harring Date: Mon, 11 Jul 2011 08:33:21 +0000 (-0700) Subject: ebuild.sh: restore old has() implementation X-Git-Tag: v2.2.0_alpha44~22 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=f8504d36c50bef4c1a982a4b9262d3e8e15f438b;p=portage.git ebuild.sh: restore old has() implementation The needle/haystack implementation handles whitespace as originally intended (prior to commit 659eafddd5964820ce8bdc0d90f5fcf7df04b5b7), as discussed in bug #374791. Signed-off-by: Brian Harring --- diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh index 9d633973b..574f949d7 100644 --- a/bin/isolated-functions.sh +++ b/bin/isolated-functions.sh @@ -525,7 +525,14 @@ hasv() { } has() { - [[ " ${*:2} " == *" $1 "* ]] + local needle=$1 + shift + + local x + for x in "$@"; do + [ "${x}" = "${needle}" ] && return 0 + done + return 1 } # @FUNCTION: save_ebuild_env