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

Calvin Cheung ccheung at openjdk.org
Fri Sep 13 19:03:45 UTC 2024


> 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

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/20697/files
  - new: https://git.openjdk.org/jdk/pull/20697/files/9a4e7046..3b8baf17

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=20697&range=02
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=20697&range=01-02

  Stats: 35493 lines in 1104 files changed: 21055 ins; 8165 del; 6273 mod
  Patch: https://git.openjdk.org/jdk/pull/20697.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/20697/head:pull/20697

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


More information about the hotspot-runtime-dev mailing list