From 8e6b452f4ec0fabc93fadb7abe99378fc4778c4a Mon Sep 17 00:00:00 2001 From: Chinyue Chen Date: Wed, 14 Sep 2011 15:26:32 +0800 Subject: [PATCH] Fix config file section header regex. Fix section header regex so that bracket expansion syntax won't be recognized as section header. The only requirement is that section header must start at the beginning of a line. BUG=chrome-os-partner:5850 TEST=1. Create a config file (mp_factory.conf) with the following content: [x86-zgb] --factory ~/trunk/src/build/images/${BOARD}/latest/chromiumos_factory_image.bin --release ~/trunk/src/build/images/${BOARD}/latest/[Cc]hromiumos_image.bin --hwid_updater ~/trunk/src/platform/[Cc]hromeos-hwid/hwid_bundle_zgb.sh --firmware_updater none --detect_release_image # Comment. # More comments. [x86-zgb-he] --subfolder x86-zgb-he --factory ~/trunk/src/build/images/${BOARD}/latest/chromiumos_factory_image.bin --release ~/trunk/src/build/images/${BOARD}/latest/chromiumos_image.bin --hwid_updater ~/trunk/src/platform/chromeos-hwid/hwid_bundle_zgb.sh --firmware_updater none --detect_release_image 2. BOARD=x86-zgb ./make_factory_package.sh --config mp_factory.conf Change-Id: I4d1475a5e513e7e0e06a5c3c6d46d13e2120668c Reviewed-on: http://gerrit.chromium.org/gerrit/7698 Tested-by: Chinyue Chen Reviewed-by: Hung-Te Lin --- make_factory_package.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/make_factory_package.sh b/make_factory_package.sh index a2866fb642..268c817686 100755 --- a/make_factory_package.sh +++ b/make_factory_package.sh @@ -630,7 +630,8 @@ parse_and_run_config() { # [section2] # --yet_another_param # - # Note that it's not allowed to read from config file recursively. + # Note that a section header must start at the beginning of a line. + # And it's not allowed to read from config file recursively. local config_file="$1" local -a cmds @@ -641,7 +642,7 @@ parse_and_run_config() { local IFS=$'\n' for line in $config do - if [[ "$line" =~ \[.*\] ]]; then + if [[ "$line" =~ ^\[.*] ]]; then if [ -n "$cmd" ]; then cmds+=("$cmd") cmd=""