From: Ralf Wildenhues Date: Tue, 06 Nov 2007 20:20:02 GMT Subject: [PATCH 4/5] Fix sed string regex escaping in module_name. Message-ID: <20071106202002.GE6361@ins.uni-bonn.de> In-Reply-To: <20071106201518.GA6361@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 may lead to problems with some sed's extensions. --- With this one, I'm not sure whether it is necessary, simply because I don't know what kinds of characters can be part of a submodule path. It anyway should be safe though. git-submodule.sh | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/git-submodule.sh b/git-submodule.sh index 4aaaaab..5af28ec 100755 --- a/git-submodule.sh +++ b/git-submodule.sh @@ -73,7 +73,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