JDK-8170114 : jimage extract to not an empty directory overwrites content of the directory
  • Type: Bug
  • Component: tools
  • Sub-Component: jlink
  • Affected Version: 9
  • Priority: P4
  • Status: Closed
  • Resolution: Not an Issue
  • OS: generic
  • CPU: generic
  • Submitted: 2016-11-21
  • Updated: 2018-02-17
  • Resolved: 2018-02-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.
Other
tbd_minorResolved
Related Reports
Blocks :  
Description
This is possibly not an issue. When we run 'jimage extract --dir' and specify not an empty directory jimage silently overwrites everything there. For better user experience it could warn a user that the directory is not empty and do nothing.

Tested on jdk 9-ea+144.
Comments
Discussed on jigsaw-dev here: http://mail.openjdk.java.net/pipermail/jigsaw-dev/2018-February/013588.html Summary: keep existing behavior.
17-02-2018

I also like the alternative Alan suggested.
10-02-2018

The alternative is for `jimage extract` to work like the `unzip` tool. When I use `unzip foo.jar -d tmp` then it will extract the contents to the directory, creating it if needed. It prompts before overriding files (need -o to override).
10-02-2018

I suggest jimage extract requires the specified output directory not present, consistent with jlink behavior.
10-02-2018