Skip to content

Commit

Permalink
8258925: configure script failed on WSL
Browse files Browse the repository at this point in the history
Reviewed-by: dholmes, erikj
  • Loading branch information
YaSuenag committed Jan 11, 2021
1 parent cd73939 commit 712ea25
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions make/scripts/fixpath.sh
@@ -1,6 +1,6 @@
#!/bin/bash
#
# Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -145,11 +145,14 @@ function import_path() {
fi

if [[ "$path" != "" ]]; then
# Store current unix path
unixpath="$path"
# Now turn it into a windows path
winpath="$($PATHTOOL -w "$path" 2>/dev/null)"
# If it fails, try again with an added .exe (needed on WSL)
if [[ $? -ne 0 ]]; then
winpath="$($PATHTOOL -w "$path.exe" 2>/dev/null)"
unixpath="$unixpath.exe"
winpath="$($PATHTOOL -w "$unixpath" 2>/dev/null)"
fi
if [[ $? -eq 0 ]]; then
if [[ ! "$winpath" =~ ^"$ENVROOT"\\.*$ ]] ; then
Expand All @@ -159,11 +162,11 @@ function import_path() {
# This monster of a command uses the %~s support from cmd.exe to
# reliably convert to short paths on all winenvs.
shortpath="$($CMD /q /c for %I in \( "$winpath" \) do echo %~sI 2>/dev/null | tr -d \\n\\r)"
path="$($PATHTOOL -u "$shortpath")"
# Path is now unix style, based on short name
unixpath="$($PATHTOOL -u "$shortpath")"
# unixpath is based on short name
fi
# Make it lower case
path="$(echo "$path" | tr [:upper:] [:lower:])"
path="$(echo "$unixpath" | tr [:upper:] [:lower:])"
fi
else
# On WSL1, PATHTOOL will fail for files in envroot. If the unix path
Expand Down

1 comment on commit 712ea25

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.