JDK-8255947 : [macos] Signed macOS jpackage app doesn't filter spurious '-psn' argument
  • Type: Bug
  • Component: tools
  • Sub-Component: jpackage
  • Affected Version: 16
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: os_x
  • CPU: x86_64
  • Submitted: 2020-11-03
  • Updated: 2021-05-25
  • Resolved: 2020-11-17
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 16
16 b25Fixed
Related Reports
Relates :  
Relates :  
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



Comments
There has been no response from the submitter after 14 days. Closing the bug.
25-05-2021

Requested the submitter to see if the bug is fixed in the latest build at https://www.oracle.com/java/technologies/javase-jdk16-downloads.html and provide the feedback.
11-05-2021

Changeset: c35e1a28 Author: Alexander Matveev <almatvee@openjdk.org> Date: 2020-11-17 01:57:24 +0000 URL: https://github.com/openjdk/jdk/commit/c35e1a28
17-11-2020

Regression from JDK-8242302.
10-11-2020

There had been some fixes for the same in different applications: https://trac.wxwidgets.org/ticket/15432 https://github.com/bitcoin/bitcoin/issues/17179
05-11-2020