RFR: 8325089: jpackage utility creates an "infinite", undeleteable directory tree

Alexey Semenyuk asemenyuk at openjdk.org
Wed Oct 16 22:52:48 UTC 2024


Make jpackage correctly handle the output directory (`--dest`) that is:
 - a subdirectory of the input directory;
 - the same as the input directory.

Make jpackage correctly handle temp directory (`--temp`) that is:
 - a subdirectory of the input directory.

jpackage will produce an app image or a package in the above directory configurations without running in an infinite loop.

The new test/jdk/tools/jpackage/share/InOutPathTest.java test covers all the above scenarios.

`IOUtils. copyRecursive()` fixed to never run in a recursive loop by building the list of non-recursive file/dir copy commands and executing them outside the recursive directory tree traversal.

src/jdk.jpackage/share/classes/jdk/jpackage/internal/Arguments.java, src/jdk.jpackage/share/classes/jdk/jpackage/internal/DeployParams.java, src/jdk.jpackage/share/classes/jdk/jpackage/internal/StandardBundlerParam.java, test/jdk/tools/jpackage/junit/jdk.jpackage/jdk/jpackage/internal/DeployParamsTest.java files fixed to get rid of `DeployParams.input` and `DeployParams.output` fields and replace them with the new `StandardBundlerParam.OUTPUT_DIR` param.

The above changes altered the logic of configuring the output directory, thus added a new `BasicTest.testNoOutputDir()` test to test jpackage without `--dest` parameter. This required adding new API to test helper classes.

-------------

Commit messages:
 - Bugfix
 - Fix typo and trailing whitespaces
 - Fix JPackageCommand.execute(): remove existing output bundle (package file or app image folder) based on its type (file/directory) and not on the type of jpackage command (app image/package).
 - Make jpackage work properly when input and output directories are the same
 - Fix trailing whitespaces
 - Add commands
 - Minor improvements to simplify test debug and allow reruns on non-empty work directory
 - Add support to test jpackage execution without `--dest` parameter specified. Added BasicTest.testNoOutputDir() to test jpackage execution without `--dest` parameter.
 - Follow up change for DeployParams chnages
 - Fix packaging tests
 - ... and 5 more: https://git.openjdk.org/jdk/compare/5eae20f7...7e3ad9ce

Changes: https://git.openjdk.org/jdk/pull/21550/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=21550&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8325089
  Stats: 376 lines in 12 files changed: 318 ins; 24 del; 34 mod
  Patch: https://git.openjdk.org/jdk/pull/21550.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/21550/head:pull/21550

PR: https://git.openjdk.org/jdk/pull/21550


More information about the core-libs-dev mailing list