RFR: 8303427: Fixpath confused if jdk source tree located in "/jdk/jdk"

Erik Joelsson erikj at openjdk.org
Tue Aug 29 00:24:27 UTC 2023


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.

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

Commit messages:
 - JDK-8303427

Changes: https://git.openjdk.org/jdk/pull/15461/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=15461&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8303427
  Stats: 3 lines in 1 file changed: 2 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/15461.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/15461/head:pull/15461

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


More information about the build-dev mailing list