RFR: 8338686: App classpath mismatch if a jar from the Class-Path attribute is on the classpath [v3]

David Holmes dholmes at openjdk.org
Mon Sep 16 00:45:06 UTC 2024


On Fri, 13 Sep 2024 19:03:45 GMT, Calvin Cheung <ccheung at openjdk.org> wrote:

>> When a CDS archive is created with `-cp A.jar:B.jar` where the manifest of A.jar contains a class-path attribute (e.g. `Class-Path: a.jar`). The following paths will be stored in the archive: A.jar:a.jar::B.jar.
>> 
>> Currently, if the user uses -cp A.jar:a.jar:B:jar during dump time and runtime, during runtime it will result in class path mismatch and the archive will not be used. It is due to during dump time when the ClassPathEntry's are being created, it checks if the name is in one of the existing entries and skip creating it. A simple fix is to add the check if the new entry and the existing entry are from the class path attribute.
>> 
>> With the fix, the following class path entries will be created during dump time:
>> A.jar:a.jar:a.jar:B.jar
>> The first a.jar is from the class path attribute, the second one is from the -cp. During runtime, the entries from the class path attribute obtained from the CDS archive will be skipped.
>> 
>> Testing: tiers 1 - 5.
>
> Calvin Cheung has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision:
> 
>  - Merge branch 'master' into 8338686-class-path-attr
>  - a simplier fix
>  - 8338686: App classpath mismatch if a jar from the Class-Path attribute is on the classpath

Seems reasonable but I confess I'm unclear what the actual rules should be here.

Thanks

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

Marked as reviewed by dholmes (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/20697#pullrequestreview-2305655032


More information about the hotspot-runtime-dev mailing list