From 410f5c0016a9d3b1fbd42b95ce1402a1c614e3d3 Mon Sep 17 00:00:00 2001 From: Ryota MIBU Date: Fri, 4 Apr 2014 02:00:31 +0900 Subject: [PATCH] Fix unsubstituted filename creation Since merge_config_file() tries to create an unsubstituted config file, stack.sh fails due to permission denied in the file creation when you use '[[post-config|/$Q_PLUGIN_CONF_FILE]]' and the file does not exist. This patch deletes unnecessary 'touch' command, because the file will be made by 'iniset' function in the next command line with evaled string from 'configfile'. This patch also fixes merge_config_group() to use evaled 'configfile' when it checks the directory of the config file exists. Change-Id: I608847a34143b5c6a1708c180186dd88a32dd44b Closes-bug: #1294213 --- lib/config | 4 +--- tests/test_config.sh | 36 +++++++++++++++++++++++++++++++++++- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/lib/config b/lib/config index 552aeb0ad1..67d788ccba 100644 --- a/lib/config +++ b/lib/config @@ -82,8 +82,6 @@ function merge_config_file { local matchgroup=$2 local configfile=$3 - [[ -r $configfile ]] || touch $configfile - get_meta_section $file $matchgroup $configfile | \ $CONFIG_AWK_CMD -v configfile=$configfile ' BEGIN { section = "" } @@ -114,7 +112,7 @@ function merge_config_group { for group in $matchgroups; do for configfile in $(get_meta_section_files $localfile $group); do - if [[ -d $(dirname $configfile) ]]; then + if [[ -d $(dirname $(eval "echo $configfile")) ]]; then merge_config_file $localfile $group $configfile fi done diff --git a/tests/test_config.sh b/tests/test_config.sh index 5700f8df29..2634ce0654 100755 --- a/tests/test_config.sh +++ b/tests/test_config.sh @@ -42,6 +42,17 @@ type=original EOF } +function setup_test4 { + mkdir -p test-etc + cat >test-etc/test4.conf <test.conf <