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

jpackage adds some arguments twice in case it is re-executed by JLI

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 14, 15, 16
    • Fix Version/s: 16
    • Component/s: tools
    • Subcomponent:
    • Resolved In Build:
      b08
    • CPU:
      generic

      Description

      There are systems that updates LD_LIBRARY_PATH or directly returns JNI_TRUE in method RequiresSetenv(const char *jvmpath) from java_md.c file [1] to request re-execution of the current executable.

        This can have some unpredictable side effects like passing not expected arguments to the current executable which forms them from a config file.

        The root cause of the issue is that a jpackage application expects one number of arguments but JLI re-executes them with another number of arguments.
       
        For example, a jpackage application can be run with arguments:
          ./app/bin/app -Dparam2=Param2 B1 B2 B3
        it adds arguments from the config file and calls JLI with arguments:
          app/bin/app -classpath -Dparam1=Param1 -m com.hello/com.hello.Hello -Dparam2=Param2 B1 B2 B3
        JLI re-executes the app with new arguments so the app adds some arguments one more time after the re-execution.
          ./app/bin/app -classpath -Dparam1=Param1 -m com.hello/com.hello.Hello -classpath -Dparam1=Param1 -m com.hello/com.hello.Hello -Dparam2=Param2 B1 B2 B3


      [1] https://hg.openjdk.java.net/jdk/jdk/file/f0792f0ffce9/src/java.base/unix/native/libjli/java_md.c#l227

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                asemenyuk Alexey Semenyuk
                Reporter:
                avoitylov Aleksei Voitylov
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: