Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8282444: Module finder incorrectly assumes default file system path-separator character #7632

Closed

Conversation

ChrisHegarty
Copy link
Member

@ChrisHegarty ChrisHegarty commented Feb 28, 2022

The module finder implementation incorrectly uses the path-separator
character from the default file system, when mapping the relative path
of an entry in an exploded module to a package name. This causes
problems on Windows [*] when using a module finder with a custom file
system that has a path-separator character that differs from that of the
default file system, e.g. the zip file system (which uses '/',
rather than '\' ).

Rather than adding a new test for this, I deciced to just modify an
existing one. The existing test exercises the module finder with a
custom file system, but does so with modules have trivial single-level
packages names. I just expanded the module to have a subpackage. This
is sufficient to reproduce the bug, and verify the fix.

[*]

java.lang.module.FindException: Error reading module: /m2
        at java.base/jdk.internal.module.ModulePath.readModule(ModulePath.java:350)
        at java.base/jdk.internal.module.ModulePath.scanDirectory(ModulePath.java:284)
        at java.base/jdk.internal.module.ModulePath.scan(ModulePath.java:232)
        at java.base/jdk.internal.module.ModulePath.scanNextEntry(ModulePath.java:190)
        at java.base/jdk.internal.module.ModulePath.findAll(ModulePath.java:166)
        at ModulesInCustomFileSystem.listAllModules(ModulesInCustomFileSystem.java:108)
        at ModulesInCustomFileSystem.testZipFileSystem(ModulesInCustomFileSystem.java:97)
        at ModulesInCustomFileSystem.testExplodedModulesInZipFileSystem(ModulesInCustomFileSystem.java:68)
        at ...
Caused by: java.lang.module.InvalidModuleDescriptorException: Package q.r not found in module
        at java.base/jdk.internal.module.ModuleInfo.invalidModuleDescriptor(ModuleInfo.java:1212)
        at java.base/jdk.internal.module.ModuleInfo.doRead(ModuleInfo.java:330)
        at java.base/jdk.internal.module.ModuleInfo.read(ModuleInfo.java:129)
        at java.base/jdk.internal.module.ModulePath.readExplodedModule(ModulePath.java:689)
        at java.base/jdk.internal.module.ModulePath.readModule(ModulePath.java:320)
        ... 36 more

Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8282444: Module finder incorrectly assumes default file system path-separator character

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/7632/head:pull/7632
$ git checkout pull/7632

Update a local copy of the PR:
$ git checkout pull/7632
$ git pull https://git.openjdk.java.net/jdk pull/7632/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 7632

View PR using the GUI difftool:
$ git pr show -t 7632

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/7632.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Feb 28, 2022

👋 Welcome back chegar! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the rfr Pull request is ready for review label Feb 28, 2022
@openjdk
Copy link

openjdk bot commented Feb 28, 2022

@ChrisHegarty The following label will be automatically applied to this pull request:

  • core-libs

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the core-libs core-libs-dev@openjdk.org label Feb 28, 2022
@mlbridge
Copy link

mlbridge bot commented Feb 28, 2022

Webrevs

@AlanBateman
Copy link
Contributor

The update to ModulePath looks okay. The tests for ModulePath with paths to locate files in custom file systems are somewhat minimal and probably should be expanded to ensure that there aren't any other issues. Updating the existing ModulesInCustomFileSystem test to use a deeper package structure is subtle but okay for now but we should create another issue to create more tests for custom file systems. I assume you'll update the date in the copyright header of the changed files.

Copy link
Member

@dfuch dfuch left a comment

Choose a reason for hiding this comment

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

Hi Chris, maybe you should add @bug 8282444 to ModulesInCustomFileSystem.java too?

@AlanBateman
Copy link
Contributor

Hi Chris, maybe you should add @bug 8282444 to ModulesInCustomFileSystem.java too?

The downside is that it would make it look like the test was added fro this issue. I think it only works if the original issue for the module system implementation is there too.

@ChrisHegarty
Copy link
Member Author

we should create another issue to create more tests for custom file systems.

Yeah, that's a good point. I'll take a closer look at this and see how best to expand the coverage (separately).

I assume you'll update the date in the copyright header of the changed files.

Done.

Hi Chris, maybe you should add @bug 8282444 to ModulesInCustomFileSystem.java too?

The downside is that it would make it look like the test was added fro this issue. I think it only works if the original issue for the module system implementation is there too.

I added a tag with both the original bugId that introduced the test, 8178380, and bug Fix Id for this issue, 8282444.

@openjdk
Copy link

openjdk bot commented Feb 28, 2022

@ChrisHegarty This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8282444: Module finder incorrectly assumes default file system path-separator character

Reviewed-by: alanb

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been no new commits pushed to the master branch. If another commit should be pushed before you perform the /integrate command, your PR will be automatically rebased. If you prefer to avoid any potential automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Feb 28, 2022
Copy link
Member

@dfuch dfuch left a comment

Choose a reason for hiding this comment

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

Not an expert of the area but the proposed changes look good to me.

@ChrisHegarty
Copy link
Member Author

/integrate

@openjdk
Copy link

openjdk bot commented Mar 1, 2022

Going to push as commit 369291b.
Since your change was applied there have been 3 commits pushed to the master branch:

  • d4d12ad: 8282047: Enhance StringDecode/Encode microbenchmarks
  • 22b93a3: 8282094: [REDO] Parallel: Refactor PSCardTable::scavenge_contents_parallel
  • d3022f8: 8282467: add extra diagnostics for JDK-8268184

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Mar 1, 2022
@openjdk openjdk bot closed this Mar 1, 2022
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Mar 1, 2022
@openjdk
Copy link

openjdk bot commented Mar 1, 2022

@ChrisHegarty Pushed as commit 369291b.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core-libs core-libs-dev@openjdk.org integrated Pull request has been integrated
3 participants