8257905: Make fixpath.sh more liberal in accepting paths embedded in arguments

Reviewed-by: erikj
This commit is contained in:
Magnus Ihse Bursie 2020-12-08 17:59:35 +00:00
parent 044616bd71
commit 264feb35ff

View File

@ -293,7 +293,7 @@ function convert_path() {
winpath="" winpath=""
# Start looking for drive prefix. Also allow /xxxx prefixes (typically options # Start looking for drive prefix. Also allow /xxxx prefixes (typically options
# for Visual Studio tools), and embedded file:// URIs. # for Visual Studio tools), and embedded file:// URIs.
if [[ $arg =~ ^([^/]*|.*file://|/[a-zA-Z:]{1,3}:?)($DRIVEPREFIX/)([a-z])(/[^/]+.*$) ]] ; then if [[ $arg =~ ^([^/]*|-[^:=]*[:=]|.*file://|/[a-zA-Z:]{1,3}:?)($DRIVEPREFIX/)([a-z])(/[^/]+.*$) ]] ; then
prefix="${BASH_REMATCH[1]}" prefix="${BASH_REMATCH[1]}"
winpath="${BASH_REMATCH[3]}:${BASH_REMATCH[4]}" winpath="${BASH_REMATCH[3]}:${BASH_REMATCH[4]}"
# Change slash to backslash (or vice versa if mixed mode) # Change slash to backslash (or vice versa if mixed mode)
@ -302,7 +302,7 @@ function convert_path() {
else else
winpath="${winpath//'\'/'/'}" winpath="${winpath//'\'/'/'}"
fi fi
elif [[ $arg =~ ^([^/]*|(.*file://))(/([-_.a-zA-Z0-9]+)(/[-_.a-zA-Z0-9]+)+)(.*)?$ ]] ; then elif [[ $arg =~ ^([^/]*|-[^:=]*[:=]|(.*file://))(/([-_.+a-zA-Z0-9]+)(/[-_.+a-zA-Z0-9]+)+)(.*)?$ ]] ; then
# This looks like a unix path, like /foo/bar. Also embedded file:// URIs. # This looks like a unix path, like /foo/bar. Also embedded file:// URIs.
prefix="${BASH_REMATCH[1]}" prefix="${BASH_REMATCH[1]}"
pathmatch="${BASH_REMATCH[3]}" pathmatch="${BASH_REMATCH[3]}"