From f2e9a5e8e67755361b50e3ace85d239cb061fd2e Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Wed, 9 Oct 2013 15:56:47 +0200 Subject: [PATCH] MT#4295 Be more strict with option handling when passing file names to grep --- functions/main | 8 ++++---- scripts/build | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/functions/main b/functions/main index dbb402aa..54e123bf 100644 --- a/functions/main +++ b/functions/main @@ -135,7 +135,7 @@ generate_template_list() { else # arguments (file list/pattern) provided via cmdline for arg in $* ; do - if echo $file | grep -q "${arg}" ; then + if echo $file | grep -q -- "${arg}" ; then echo "$file" >> "${filelist_prepared}" fi done @@ -157,21 +157,21 @@ generate_template_list() { # foo.customtt.tt2.sp{1,2} if [ -n "${HA_FILE:-}" ] ; then - if grep -q "^${normalized_filename}.customtt.tt2${HA_FILE:-}" "${filelist_prepared}" ; then + if grep -q -- "^${normalized_filename}.customtt.tt2${HA_FILE:-}" "${filelist_prepared}" ; then echo "${normalized_filename}.customtt.tt2${HA_FILE:-}" >> "${filelist_final}" continue fi fi # foo.customtt.tt2 - if grep -q "^${normalized_filename}.customtt.tt2$" "${filelist_prepared}" ; then + if grep -q -- "^${normalized_filename}.customtt.tt2$" "${filelist_prepared}" ; then echo "${normalized_filename}.customtt.tt2" >> "${filelist_final}" continue fi # foo.tt2.sp{1,2} if [ -n "${HA_FILE:-}" ] ; then - if grep -q "^${normalized_filename}.tt2${HA_FILE}" "${filelist_prepared}" ; then + if grep -q -- "^${normalized_filename}.tt2${HA_FILE}" "${filelist_prepared}" ; then echo "${normalized_filename}.tt2${HA_FILE}" >> "${filelist_final}" continue fi diff --git a/scripts/build b/scripts/build index bddd3259..9580ec74 100755 --- a/scripts/build +++ b/scripts/build @@ -77,7 +77,7 @@ else if [ -n "${EXTRA_CONFIG_FILES:-}" ] ; then for file in $EXTRA_CONFIG_FILES ; do - if git diff-index --name-only HEAD | grep -qe "$(basename $file)" ; then + if git diff-index --name-only HEAD | grep -qe -- "$(basename $file)" ; then log_debug "modification in EXTRA_CONFIG_FILES file $file found" trigger_rebuild=true break # no reason for further checks