jpackage requests permission via a dialog

Alexander Matveev alexander.matveev at oracle.com
Mon Mar 4 21:27:49 UTC 2024


Hi Alan,

See below.

From: core-libs-dev <core-libs-dev-retn at openjdk.org> on behalf of Alan Snyder <javalists at cbfiddle.com>
Date: Sunday, March 3, 2024 at 7:09 PM
To: core-libs-dev at openjdk.org <core-libs-dev at openjdk.org>
Subject: jpackage requests permission via a dialog
I tried using jpackage on macOS to create a DMG (which I have not done before) and was surprised when a system dialog was displayed requesting permission for Terminal to control Finder.

I found this issue described in JDK-8231855, which was closed without explanation as “not an issue”.
From JDK-8231855: “Looks like this dialog is part of macOS Catalina Data Protection features. I did not found if it possible not to trigger this prompt. Also, this prompt is shown only once and subsequent jpackage runs will not show any prompts. As workaround in case when jpackage will be part of automated build system which needs to be run without user intervention it is recommended to run jpackage first on this system and confirm any prompts.”.

It seems to me that having a command line build tool try to interact with a user via a dialog is inappropriate, even if it happens only once per system.
So far, I did not figure out other solution for this problem.

I’m not sure why this dialog is shown, as it appears that all of the actions are performed by running the hdiutil program.
This dialog is shown when we running osascript (https://github.com/openjdk/jdk/blob/master/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/DMGsetup.scpt) to post process DMG file. This script will setup DMG background and re-arrange icons, so it look nice.

It does seem odd, however, that jpackage mounts the DMG to modify its contents. Shouldn’t the contents be set up before creating the DMG?
We need to mount it to run osascript I mentioned above.

Is mounting the image the source of the dialog?
No, dialog is shown after we mount it from osascript which is run right after DMG is mounted.

Is there some reason this cannot be fixed?
So far I did not found any substitution to our osascript to setup background image and re-arrange icons. I do not think that Apple provides any other ways to do it.
Thanks,
Alexander
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/core-libs-dev/attachments/20240304/33961c5f/attachment.htm>


More information about the core-libs-dev mailing list