On Tue, 29 Aug 2023 00:16:46 GMT, Erik Joelsson <er...@openjdk.org> wrote:

> On Windows, when a directory exists in the "unix" root with the same name as 
> a directory in the "test" dir, fixpath will corrupt test arguments to jtreg 
> (and possibly other arguments as well). Fixpath sees a string like this:
> 
> test/jdk/foo
> 
> It looks for the first `/` and checks if the first element following that, 
> until the next `/`, is an existing directory in the unix filesystem root. In 
> this case, the reporter had a directory named "/jdk" which satisfies this 
> heuristic check. This makes fixpath assume that the `/jdk/foo` part is an 
> absolute unix path that needs to be rewritten to a Windows path.
> 
> My suggested fix is to look at the prefix part, "test" in this case, and see 
> if that itself is a valid path in the current working directory, as that 
> would indicate that the string is intended to be a relative path.
> 
> I think we also need to account for possible prefixes with `:` and `=` here 
> to handle a string like:
> 
> jtreg:test/jdk/foo
> 
> In that case we need to remove anything up to the last `:` before we try to 
> match it as a relative directory. (Same thing applies to `=`)
> 
> Changing the heuristics of fixpath is rather sensitive and risky. I would 
> appreciate help from people using Windows with trying this patch with some of 
> your regular workflows.

This pull request has now been integrated.

Changeset: 2f7c65ec
Author:    Erik Joelsson <er...@openjdk.org>
URL:       
https://git.openjdk.org/jdk/commit/2f7c65ec48dc35d75eed8af411d482ba40de70dc
Stats:     3 lines in 1 file changed: 2 ins; 0 del; 1 mod

8303427: Fixpath confused if unix root contains "/jdk"

Reviewed-by: mikael

-------------

PR: https://git.openjdk.org/jdk/pull/15461

Reply via email to