JDK-8240636 : [macos] Signing app bundle with jpackage fails if runtime is already signed
  • Type: Bug
  • Component: tools
  • Sub-Component: jpackage
  • Affected Version: 14,15
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: os_x
  • CPU: x86
  • Submitted: 2020-02-11
  • Updated: 2020-11-18
  • Resolved: 2020-04-03
Related Reports
Duplicate :  
Relates :  
Relates :  
Description
ADDITIONAL SYSTEM INFORMATION :
MacOS
OpenJDK Runtime Environment (build 15-ea+9-264)
OpenJDK Runtime Environment (build 14+36-1461)


A DESCRIPTION OF THE PROBLEM :
It is almost the same  JDK-8237607.
After signing all components it fails with error:

/var/folders/9g/62bb9wjd1ks04kfxsd3_1tbr0000gn/T/jdk.incubator.jpackage12785038626377964102/images/image-7125624493142684957/griddlers.app: is already signed
java.io.IOException: Command [codesign, -s, XXXXXX , -vvvv, /var/folders/9g/62bb9wjd1ks04kfxsd3_1tbr0000gn/T/jdk.incubator.jpackage12785038626377964102/images/image-7125624493142684957/myapp.app] exited with 1 code
	at jdk.incubator.jpackage/jdk.incubator.jpackage.internal.Executor.executeExpectSuccess(Executor.java:73)
	at jdk.incubator.jpackage/jdk.incubator.jpackage.internal.IOUtils.exec(IOUtils.java:165)
	at jdk.incubator.jpackage/jdk.incubator.jpackage.internal.IOUtils.exec(IOUtils.java:136)
	at jdk.incubator.jpackage/jdk.incubator.jpackage.internal.MacAppImageBuilder.signAppBundle(MacAppImageBuilder.java:895)
	at jdk.incubator.jpackage/jdk.incubator.jpackage.internal.MacAppImageBuilder.sign(MacAppImageBuilder.java:363)

I would say that there could be also -f parameter on        https://github.com/openjdk/jdk14/blob/5ed4b9f2c0a1572da09fef84aaf0ce899689c4c2/src/jdk.incubator.jpackage/macosx/classes/jdk/incubator/jpackage/internal/MacAppImageBuilder.java#L881



REGRESSION : Last worked in version 14

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
jpackage --verbose --type dmg -d dist -i target/input -n myapp \
 --main-class com.igridd.client.Griddlers --main-jar myapp.jar \
 --icon src/main/bundleresources/package/macosx/myapp.icns \
 --mac-package-identifier myapp.com --mac-sign --mac-signing-key-user-name "developer" \
 --resource-dir src/main/bundleresources/package/macosx \
 --mac-package-signing-prefix com.myapp


EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
complete dmg image
ACTUAL -
Error

FREQUENCY : always



Comments
The --force (-f) option is used on both the runtime and app as a whole after implementation of JDK-8237490, resolving this problem.
03-04-2020