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

[macos] Signed macOS jpackage app doesn't filter spurious '-psn' argument

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b25
    • CPU:
      x86_64
    • OS:
      os_x
    • Verification:
      Not verified

      Description

      ADDITIONAL SYSTEM INFORMATION :
      macOS 10.15.7, java 15 and 16-ea

      A DESCRIPTION OF THE PROBLEM :
      MacOS adds a ProcessSerialNumber to args when launching a quarantined app for the first time, like "-psn_0_10615327"

      The jpackage wrapper should filter out the psn since it's not expected in the app



      See also:
       https://bugs.openjdk.java.net/browse/JDK-8212780 where the git patch claims to filter out the psn
       https://trac.wxwidgets.org/ticket/15432
       https://github.com/bitcoin/bitcoin/issues/17179

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Download a .app produced by jpackage. Open it for the first time.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      No argument get passed to the app except the ones specified by --arguments in the jpackage call. The jpackage wrapper catches and filters the -psn_x_yyy arguments passed by the OS.
      ACTUAL -
      Spurious "-psn_x_yyy" argument gets passed

      ---------- BEGIN SOURCE ----------
      The process to package and sign a macOS app is a bit complex, but I've produced a build at https://stereo.dev.openstreetmap.org/JOSM.zip . It will crash on the first run because it gets an argument it didn't expect, and log the error at /tmp/josm-err.txt. Arguments will be logged at /tmp/josm-out.txt
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      MacOS only seems to pass that psn argument to quarantined apps when they're being run for the first time. Opening the .app for a second time, or manually clear the quarantine flags, is a workaround.

      It is also possible to ignore -psn_x_yyyy arguments in your java program.

      FREQUENCY : always


        Attachments

          Issue Links

            Activity

              People

              Assignee:
              almatvee Alexander Matveev
              Reporter:
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: