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

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 16
    • 14, 15, 16
    • tools
    • b08
    • generic

      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

            asemenyuk Alexey Semenyuk
            avoitylov Aleksei Voitylov
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: