From 2930727a87ae1f5b7c97ee967c850d269e35dd64 Mon Sep 17 00:00:00 2001 From: Florent Rougon Date: Wed, 26 Sep 2018 09:27:53 +0200 Subject: [PATCH] download_and_compile.sh: take username verbatim (no conversion to lowercase) Fix for commit 8a7fd33b2b4bf4: in argument to --git-clone-site-params, take the username exactly as provided instead of converting it to lowercase (the site and protocol are still converted to lowercase, but *that* is intentional). --- download_and_compile.sh | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/download_and_compile.sh b/download_and_compile.sh index 1b93e7b..a911a50 100755 --- a/download_and_compile.sh +++ b/download_and_compile.sh @@ -417,14 +417,15 @@ while true; do shift 2 ;; --git-clone-site-params) - # Convert the argument to lowercase, then match it against the regexp - if [[ "${2,,}" =~ ^([[:alnum:]]+)=([[:alpha:]]+)(:([[:alnum:]]+))?$ ]]; then - site="${BASH_REMATCH[1]}" - proto="${BASH_REMATCH[2]}" - username="${BASH_REMATCH[4]}" + if [[ "$2" =~ ^([[:alnum:]]+)=([[:alpha:]]+)(:([[:alnum:]]+))?$ ]]; then + site="${BASH_REMATCH[1],,}" # convert the site to lowercase + proto="${BASH_REMATCH[2],,}" # ditto for the protocol + verbatim_proto="${BASH_REMATCH[2]}" + username="${BASH_REMATCH[4]}" # but take the username verbatim + if ! _elementIn "$proto" ssh https git; then echo "Invalid protocol passed to option --git-clone-site-params:" \ - "'$proto'." >&2 + "'$verbatim_proto'." >&2 echo "Allowed protocols are 'ssh', 'https' and 'git'." >&2 exit 1 fi @@ -441,7 +442,7 @@ while true; do exit 1 fi - unset -v site proto username + unset -v site proto verbatim_proto username else echo "Invalid value passed to option --git-clone-site-params: '$2'." >&2 echo "The correct syntax is" \