On Wed, 6 Jul 2022 17:47:21 GMT, Magnus Ihse Bursie <i...@openjdk.org> wrote:
> I'm worried that with the patch you are proposing, we will unconditinonally > add `.exe` to any path that is not existing, which will make the next test > fail (since then the path with the addition of `.exe` will most likely not > exist either). In contrast, No, if ".exe" does not exist as a executable, it would be in fallback code as following (L171). So this patch wouldn't break current behavior. (Maybe it is more suitable to use return value from `ls` command to check file / dir exists - but current code uses `-e` in fallback code.) 149 # Store current unix path 150 unixpath="$path" 151 # If $unixpath does not exist, add .exe (needed on WSL) 152 if [[ ! -e "$unixpath" ]]; then 153 unixpath="$unixpath.exe" 154 fi 155 # Now turn it into a windows path 156 winpath="$($PATHTOOL -w "$unixpath" 2>/dev/null)" 157 if [[ $? -eq 0 && -e "$unixpath" ]]; then : 171 else 172 # On WSL1, PATHTOOL will fail for files in envroot. If the unix path 173 # exists, we assume that $path is a valid unix path. 174 175 if [[ ! -e $path ]]; then 176 if [[ -e $path.exe ]]; then 177 path="$path.exe" 178 else 179 if [[ $QUIET != true ]]; then 180 echo fixpath: warning: Path "'"$path"'" does not exist >&2 181 fi 182 # This is not a fatal error, maybe the path will be created later on 183 fi 184 fi 185 fi > I believe the old code could accept stuff like /tmp/foo/bar, if /tmp/foo were > a valid directory, but the file /tmp/foo/bar did not exist yet. > > I don't have any ready access to a Windows machine right now (is on the verge > of going on vacation for the summer), but can you verify that either: > > 1. the code prior to your fix would not accept a path like /tmp/foo/bar > before, or that > 2. your code will still accept it (this does not seem likely if I read the > code correctly). I got same result both WSL 0.60.0.0 and 0.61.8.0 . We can get `/tmp/foo/bar` in both case. * current behavior (master branch): $ ./make/scripts/fixpath.sh import /tmp/foo/bar ------------- PR: https://git.openjdk.org/jdk/pull/9357