RFR: 8377331: jpackage: improve sign errors reporting [v2]
Alexey Semenyuk
asemenyuk at openjdk.org
Mon Feb 9 21:39:57 UTC 2026
> Improve reporting of errors from failed external commands, and signing errors in particular. Use the same formatting for signing errors as for any other errors.
>
> Instead of printing:
>
> "codesign" failed with following output:
> jpackage-tests/MacSignTest/testAppContentWarning/output/AppContentWarningMacSignTest.app: replacing existing signature
> jpackage-tests/MacSignTest/testAppContentWarning/output/AppContentWarningMacSignTest.app: bundle format unrecognized, invalid, or unsuitable
> In subcomponent: jpackage-tests/MacSignTest/testAppContentWarning/output/AppContentWarningMacSignTest.app/Contents/foo.1
> jdk.jpackage.internal.util.function.ExceptionBox: jdk.jpackage.internal.Codesign$CodesignException
> at jdk.jpackage/jdk.jpackage.internal.util.function.ExceptionBox.toUnchecked(ExceptionBox.java:51)
> <stack trace omitted>
> Error: jdk.jpackage.internal.Codesign$CodesignException
>
>
> jpackage will print:
>
> Error: Unexpected exit code 1 from executing the command /usr/bin/codesign -s 'Developer ID Application: jpackage.openjdk.java.net' -vvvv --timestamp --options runtime --prefix Hello. --keychain jpackagerTest.keychain --entitlements config/AppContentWarningMacSignTest.entitlements --force MacSignTest/testAppContentWarning/output/AppContentWarningMacSignTest.app
> Command output:
> MacSignTest/testAppContentWarning/output/AppContentWarningMacSignTest.app: replacing existing signature
> MacSignTest/testAppContentWarning/output/AppContentWarningMacSignTest.app: bundle format unrecognized, invalid, or unsuitable
> In subcomponent: MacSignTest/testAppContentWarning/output/AppContentWarningMacSignTest.app/Contents/foo.1
>
>
> As for reporting generic errors from failed external commands, jpackage will always print the command's output, regardless of whether it is running in verbose or quiet mode. Previously, it would print command output only in quiet mode, assuming that in verbose mode, the output would be printed immediately after command execution. However, jpackage runs some commands quietly in verbose mode; if one of them failed, the user didn't see its output. To address this problem, jpackage will print the output of the failed command in both quiet and verbose modes.
Alexey Semenyuk has updated the pull request incrementally with one additional commit since the last revision:
Replace "verify" with "validate" in the new code.
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/29596/files
- new: https://git.openjdk.org/jdk/pull/29596/files/3d33dd75..2b0533f5
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=29596&range=01
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=29596&range=00-01
Stats: 234 lines in 3 files changed: 115 ins; 115 del; 4 mod
Patch: https://git.openjdk.org/jdk/pull/29596.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/29596/head:pull/29596
PR: https://git.openjdk.org/jdk/pull/29596
More information about the core-libs-dev
mailing list