From 1942a7366b5e17a1bff30923d5b2450b4c382ab8 Mon Sep 17 00:00:00 2001 From: Ger van Diepen <diepen@astron.nl> Date: Thu, 14 Apr 2011 06:40:35 +0000 Subject: [PATCH] Bug 1651: pattern characters needed to be changed to avoid expansion by cexec --- CEP/LMWCommon/src/cexecms | 10 +++++++++- CEP/LMWCommon/src/cexecms-part | 11 +++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/CEP/LMWCommon/src/cexecms b/CEP/LMWCommon/src/cexecms index 47dcb06dcf3..37a98f1008d 100755 --- a/CEP/LMWCommon/src/cexecms +++ b/CEP/LMWCommon/src/cexecms @@ -101,6 +101,14 @@ commandnew=`echo "$command" | sed \ -e 's%"%:DQUOTE:%g' \ -e "s%'%:SQUOTE:%g" \ -e 's%\\$%:DOLLAR:%g'` +# Furthermore it expands the nameglob, so change that as well. +nameglobnew=`echo "$nameglob" | sed \ + -e 's%\*%:ASTERISK:%g' \ + -e 's%\?%:QUESTIONMARK:%g' \ + -e 's%\[%:LBRACKET:%g' \ + -e 's%\]%:RBRACKET:%g' \ + -e 's%{%:LBRACE:%g' \ + -e 's%}%:RBRACE:%g'` -cexec $cluster cexecms-part -e "$envfile" "'$commandnew'" "$nameglob" "$@" +cexec $cluster cexecms-part -e "$envfile" "'$commandnew'" "$nameglobnew" "$@" rm -f "$envfile" diff --git a/CEP/LMWCommon/src/cexecms-part b/CEP/LMWCommon/src/cexecms-part index c34d6503ba0..da7538f74e3 100755 --- a/CEP/LMWCommon/src/cexecms-part +++ b/CEP/LMWCommon/src/cexecms-part @@ -46,8 +46,15 @@ if test "$envfile" != ""; then . $envfile fi -# Find all matching files (first substitute # by [0-9]). -nameg=`echo "$nameglob" | sed -e 's%#%[0-9]%g'` +# Find all matching files (first substitute # by [0-9] and substitute special characters back). +nameg=`echo "$nameglob" | sed \ + -e 's%#%[0-9]%g' \ + -e 's%:ASTERISK:%*%g' \ + -e 's%:QUESTIONMARK:%?%g' \ + -e 's%:LBRACKET:%[%g' \ + -e 's%:RBRACKET:%]%g' \ + -e 's%:LBRACE:%{%g' \ + -e 's%:RBRACE:%}%g'` names=`ls -d $nameg 2>&1` if test $? != 0; then echo "No file matching $nameg found" -- GitLab