8206125: [windows] cannot pass relative path to --with-boot-jdk

Reviewed-by: tbell
This commit is contained in:
Erik Joelsson 2019-09-23 08:52:05 -07:00
parent 79192e3648
commit 7ae384b2ad
2 changed files with 34 additions and 14 deletions

@ -205,6 +205,32 @@ AC_DEFUN([BASIC_PREPEND_TO_PATH],
fi
])
################################################################################
# This will make a path absolute. Assumes it's already a unix path. Also
# resolves ~ to homedir.
AC_DEFUN([BASIC_ABSOLUTE_PATH],
[
if test "x[$]$1" != x; then
new_path="[$]$1"
if [ [[ "$new_path" = ~* ]] ]; then
# Use eval to expand a potential ~
eval new_path="$new_path"
if test ! -f "$new_path" && test ! -d "$new_path"; then
AC_MSG_ERROR([The new_path of $1, which resolves as "$new_path", is not found.])
fi
fi
if test -d "$new_path"; then
$1="`cd "$new_path"; $THEPWDCMD -L`"
else
dir="`$DIRNAME "$new_path"`"
base="`$BASENAME "$new_path"`"
$1="`cd "$dir"; $THEPWDCMD -L`/$base"
fi
fi
])
###############################################################################
# This will make sure the given variable points to a full and proper
# path. This means:
@ -217,7 +243,6 @@ AC_DEFUN([BASIC_PREPEND_TO_PATH],
AC_DEFUN([BASIC_FIXUP_PATH],
[
# Only process if variable expands to non-empty
if test "x[$]$1" != x; then
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
BASIC_FIXUP_PATH_CYGWIN($1)
@ -234,19 +259,8 @@ AC_DEFUN([BASIC_FIXUP_PATH],
AC_MSG_ERROR([Spaces are not allowed in this path.])
fi
# Use eval to expand a potential ~
eval path="$path"
if test ! -f "$path" && test ! -d "$path"; then
AC_MSG_ERROR([The path of $1, which resolves as "$path", is not found.])
fi
if test -d "$path"; then
$1="`cd "$path"; $THEPWDCMD -L`"
else
dir="`$DIRNAME "$path"`"
base="`$BASENAME "$path"`"
$1="`cd "$dir"; $THEPWDCMD -L`/$base"
fi
BASIC_ABSOLUTE_PATH(path)
$1="$path"
fi
fi
])

@ -148,6 +148,8 @@ AC_DEFUN([BASIC_FIXUP_PATH_CYGWIN],
path="[$]$1"
new_path=`$CYGPATH -u "$path"`
BASIC_ABSOLUTE_PATH(new_path)
# Cygwin tries to hide some aspects of the Windows file system, such that binaries are
# named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered
# the same file, most of the time (as in "test -f"). But not when running cygpath -s, then
@ -181,6 +183,8 @@ AC_DEFUN([BASIC_FIXUP_PATH_MSYS],
new_path=`cmd //c echo $path`
fi
BASIC_ABSOLUTE_PATH(new_path)
BASIC_MAKE_WINDOWS_SPACE_SAFE_MSYS([$new_path])
BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(new_path)
if test "x$path" != "x$new_path"; then
@ -199,6 +203,8 @@ AC_DEFUN([BASIC_FIXUP_PATH_WSL],
new_path="[$]$1"
BASIC_WINDOWS_REWRITE_AS_UNIX_PATH([new_path])
BASIC_ABSOLUTE_PATH(new_path)
# Call helper function which possibly converts this using DOS-style short mode.
# If so, the updated path is stored in $new_path.
BASIC_MAKE_WINDOWS_SPACE_SAFE_WSL([$new_path])