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 5F9AD1395E1 for ; Sun, 30 Oct 2016 09:17:31 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id BFEE221C075; Sun, 30 Oct 2016 09:17:27 +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 A4F4121C075 for ; Sun, 30 Oct 2016 09:17:27 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (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 C0EBE3412F9 for ; Sun, 30 Oct 2016 09:17:26 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id EFCE624A7 for ; Sun, 30 Oct 2016 09:17:24 +0000 (UTC) From: "Ulrich Müller" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Ulrich Müller" Message-ID: <1477782550.a121df41e723306bdd925098ebd4a8939ac188fe.ulm@gentoo> Subject: [gentoo-commits] proj/eselect:master commit in: libs/, / X-VCS-Repository: proj/eselect X-VCS-Files: ChangeLog libs/config.bash.in X-VCS-Directories: / libs/ X-VCS-Committer: ulm X-VCS-Committer-Name: Ulrich Müller X-VCS-Revision: a121df41e723306bdd925098ebd4a8939ac188fe X-VCS-Branch: master Date: Sun, 30 Oct 2016 09:17:24 +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: 16865763-93bc-403c-ba33-7342e79916f6 X-Archives-Hash: 5123e8d1caea3f319e6df5d64322e8ab commit: a121df41e723306bdd925098ebd4a8939ac188fe Author: Ulrich Müller gentoo org> AuthorDate: Sat Oct 29 23:09:10 2016 +0000 Commit: Ulrich Müller gentoo org> CommitDate: Sat Oct 29 23:09:10 2016 +0000 URL: https://gitweb.gentoo.org/proj/eselect.git/commit/?id=a121df41 Ignore comment lines when parsing config files. * libs/config.bash.in (store_config): Ignore comment lines in config files and make parsing more robust, bug 598480. ChangeLog | 5 +++++ libs/config.bash.in | 8 +++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index eb3db3b..e9fc937 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2016-10-30 Ulrich Müller + + * libs/config.bash.in (store_config): Ignore comment lines in + config files and make parsing more robust, bug 598480. + 2016-06-17 Ulrich Müller * configure.ac: Update version to 1.4.6. diff --git a/libs/config.bash.in b/libs/config.bash.in index 80ef798..9fbecf0 100644 --- a/libs/config.bash.in +++ b/libs/config.bash.in @@ -57,9 +57,11 @@ store_config() { # parse the names of all settings in the file local ifs_save=${IFS} IFS=$'\n' for line in ${content} ; do - [[ ${line/=/} != ${line} ]] || continue - line=${line/=*/} - local ${line}="" + line=${line##*([[:space:]])} + [[ ${line} != "#"* && ${line} == *=* ]] || continue + line=${line%%=*} + # assignment will fail if ${line} is not a valid identifier + local ${line}="" || continue vars=(${vars[@]} ${line}) done IFS=${ifs_save}