Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8355524

Only every second line in upgradeable files is being used

XMLWordPrintable

    • b19
    • master
    • generic
    • generic

      JDK-8353185 introduced a way to allow for upgradable files. However there was a bug in the implementation that slipped through. The code that reads the lines from the config file reads as follows:

      while (scanner.hasNextLine()) {
        String line = scanner.nextLine();
        if (line.trim().startsWith("#")) {
             // Skip comments
             continue;
        }
        upgradeableFiles.add(scanner.nextLine());
      }

      Instead of every non-comment line to be added to upgradeableFiles set, it only adds the next one using 'scanner.nextLine()'. This needs to be fixed.

      One easy way to reproduce this is to flip the order of the entries in the config file to list cacerts first (which makes it being skipped and, thus, the test of JDK-8353185 fail):

      STDOUT:
      DEBUG: run-time image based jlink command: /disk/openjdk/upstream-sources/git/jdk-jdk/build/linux-x86_64-server-release/test-support/jtreg_test_jdk_tools_jlink_runtimeImage_UpgradeableFileCacertsTest_java/scratch/0/images/java-base-jlink-upgrade-cacerts-jlink.image/bin/jlink --output /disk/openjdk/upstream-sources/git/jdk-jdk/build/linux-x86_64-server-release/test-support/jtreg_test_jdk_tools_jlink_runtimeImage_UpgradeableFileCacertsTest_java/scratch/0/images/target-run-time-java-base-jlink-upgrade-cacerts-target.image --verbose --add-modules java.base
      [2025-04-24T17:13:01.457166888Z] Gathering output for process 1390604
      [2025-04-24T17:13:01.467796232Z] Waiting for completion for process 1390604
      [2025-04-24T17:13:01.780550452Z] Waiting for completion finished for process 1390604
      Output and diagnostic info for process 1390604 was saved into 'pid-1390604-output.log'
      STDERR:
      Process stdout was:
      Linking based on the current run-time image
      java.base jrt:/java.base (run-time image)

      Providers:
        java.base provides java.nio.file.spi.FileSystemProvider used by java.base
      Error: /disk/openjdk/upstream-sources/git/jdk-jdk/build/linux-x86_64-server-release/test-support/jtreg_test_jdk_tools_jlink_runtimeImage_UpgradeableFileCacertsTest_java/scratch/0/images/java-base-jlink-upgrade-cacerts-jlink.image/lib/security/cacerts has been modified

      Process stderr was:

      java.lang.AssertionError: Expected jlink to pass given a linkable run-time image. Exit code was: 1
      at AbstractLinkableRuntimeTest.jlinkUsingImage(AbstractLinkableRuntimeTest.java:198)
      at AbstractLinkableRuntimeTest.jlinkUsingImage(AbstractLinkableRuntimeTest.java:152)
      at UpgradeableFileCacertsTest.testAndAssert(UpgradeableFileCacertsTest.java:106)
      at ModifiedFilesTest.runTest(ModifiedFilesTest.java:52)
      at AbstractLinkableRuntimeTest.run(AbstractLinkableRuntimeTest.java:62)
      at UpgradeableFileCacertsTest.main(UpgradeableFileCacertsTest.java:95)
      at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
      at java.base/java.lang.reflect.Method.invoke(Method.java:565)
      at com.sun.javatest.regtest.agent.MainWrapper$MainTask.run(MainWrapper.java:138)
      at java.base/java.lang.Thread.run(Thread.java:1447)

      JavaTest Message: Test threw exception: java.lang.AssertionError: Expected jlink to pass given a linkable run-time image. Exit code was: 1
      JavaTest Message: shutting down test

            sgehwolf Severin Gehwolf
            sgehwolf Severin Gehwolf
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: