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 363D51382C5 for ; Thu, 23 Jun 2016 03:28:37 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 3A0E5E08EF; Thu, 23 Jun 2016 03:28:36 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id C7B39E08EF for ; Thu, 23 Jun 2016 03:28:35 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 57BF9340B0B for ; Thu, 23 Jun 2016 03:28:34 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 2131E23BD for ; Thu, 23 Jun 2016 03:28:28 +0000 (UTC) From: "Mike Frysinger" 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" Message-ID: <1466652409.f5f28c6c6fa09a746d317c0956659eb6c6454516.vapier@gentoo> Subject: [gentoo-commits] proj/genkernel:master commit in: / X-VCS-Repository: proj/genkernel X-VCS-Files: genkernel X-VCS-Directories: / X-VCS-Committer: vapier X-VCS-Committer-Name: Mike Frysinger X-VCS-Revision: f5f28c6c6fa09a746d317c0956659eb6c6454516 X-VCS-Branch: master Date: Thu, 23 Jun 2016 03:28:28 +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: b1b30ef9-24c8-4101-bc52-5aa8356dfebc X-Archives-Hash: 34953149ea08ad37d912fc3eb0093393 commit: f5f28c6c6fa09a746d317c0956659eb6c6454516 Author: Mike Frysinger gentoo org> AuthorDate: Thu Jun 23 03:26:49 2016 +0000 Commit: Mike Frysinger gentoo org> CommitDate: Thu Jun 23 03:26:49 2016 +0000 URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=f5f28c6c genkernel: simplify/robustify --config parsing There's no need to use eval here, and the quoting on it is off leading to incorrect expansion side effects with some inputs. genkernel | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/genkernel b/genkernel index a404415..506a2ca 100755 --- a/genkernel +++ b/genkernel @@ -15,21 +15,12 @@ small_die() { exit 1 } -parse_opt() { - case "$1" in - *\=*) - echo "$1" | cut -f2- -d= - ;; - esac -} - # We don't know where our config is, so we check for it, and default to using # /etc/genkernel.conf if nobody has specified one. # NOTE: We are look for --config=... in a way that doesn't modify $@ since we access that again, later -for (( i=1; i<=$# ; i=i+1 )); do - eval arg="\$$i" - [[ "${arg}" = --config=* ]] && CMD_GK_CONFIG=`parse_opt "${arg}"` +for arg in "$@"; do + [[ "${arg}" == --config=* ]] && CMD_GK_CONFIG=${arg#--config=} done # Pull in our configuration