From: Ralf Wildenhues Date: Thu, 08 Nov 2007 21:48:49 GMT Subject: [PATCH 3/3] Fix sed string regex escaping in module_name. Message-ID: <20071108214849.GI31439@ins.uni-bonn.de> In-Reply-To: <20071108214624.GF31439@ins.uni-bonn.de> When escaping a string to be used as a sed regex, it is important to only escape active characters. Escaping other characters is undefined according to POSIX, and in practice leads to issues with extensions such as GNU sed's \+. Signed-off-by: Ralf Wildenhues --- git-submodule.sh | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/git-submodule.sh b/git-submodule.sh index 1c656be..82ac28f 100755 --- a/git-submodule.sh +++ b/git-submodule.sh @@ -74,7 +74,7 @@ resolve_relative_url () module_name() { # Do we have "submodule..path = $1" defined in .gitmodules file? - re=$(printf '%s' "$1" | sed -e 's/\([^a-zA-Z0-9_]\)/\\\1/g') + re=$(printf '%s' "$1" | sed -e 's/[].[^$\\*]/\\&/g') name=$( GIT_CONFIG=.gitmodules \ git config --get-regexp '^submodule\..*\.path$' | sed -n -e 's|^submodule\.\(.*\)\.path '"$re"'$|\1|p' ) -- 1.5.3.5.561.g140d