diff options
author | 2016-10-30 01:09:10 +0200 | |
---|---|---|
committer | 2016-10-30 01:09:10 +0200 | |
commit | a121df41e723306bdd925098ebd4a8939ac188fe (patch) | |
tree | 811c8087fe6dbbcc38aea093edf3aeba3ac9538c | |
parent | Update version to 1.4.6. (diff) | |
download | eselect-a121df41e723306bdd925098ebd4a8939ac188fe.tar.gz eselect-a121df41e723306bdd925098ebd4a8939ac188fe.tar.bz2 eselect-a121df41e723306bdd925098ebd4a8939ac188fe.zip |
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.
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | libs/config.bash.in | 8 |
2 files changed, 10 insertions, 3 deletions
@@ -1,3 +1,8 @@ +2016-10-30 Ulrich Müller <ulm@gentoo.org> + + * 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 <ulm@gentoo.org> * 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} |