On Fri, 8 Jan 2021 14:49:12 GMT, Yasumasa Suenaga <ysuen...@openjdk.org> wrote:
>> I initially wanted to leave this for Magnus to look at since he wrote all of >> this, and I know he put a lot of effort into fixpath.sh. It's not a simple >> script. Now I have stared at it for a while, I think I understand the >> problem. >> >> One very important aspect of fixpath.sh is to not do heavy work >> unnecessarily. The latest solution unfortunately adds a call to $PATHTOOL >> when winpath does not contain forbidden characters. This is a pretty common >> case and will have performance impact. >> >> The problem is that on line 152, if we find the executable by adding .exe, >> we need to remember this and use it on line 166, but we cannot modify the >> variable "path" as it's also used in the else block starting on 168. I would >> propose introducing a new variable "unixpath" before line 151. Add .exe to >> it before line 152. Then overwrite it on line 162, and finally use it as the >> source on line 166. > > Thanks @erikj79 for proposing the fix! but I think we should not add > variable(s) as possible. > > We use `$path` as a result, and we use `$path`, `$winpath` (and `$shortpath` > generated by `$winpath`) as input for it if fixpath.sh runs on WSL. > The cause of this problem is fixpath.sh modifies `$winpath` only. If we add > new variable, similar issue(s) may happen in future. Fortunately we can > convert to unix path from windows path. So it is easy to maintenance if we > converge the path to modify to `$winpath`. In this case, I think introducing a variable is well worth it as it means we can eliminate a very common and unnecessary call to $PATHTOOL. ------------- PR: https://git.openjdk.java.net/jdk/pull/1889