RFR JDK-8170114 jimage extract to not an empty directory overwrites content of the directory

Michal Vala mvala at redhat.com
Mon Feb 12 06:57:36 UTC 2018



On 02/10/2018 01:04 AM, mandy chung wrote:
> On 2/9/18 7:23 AM, Michal Vala wrote:
>>
>> Patch validates output directory before any jimage extracting happen. I've 
>> moved validation to extra private method as it is few lines of code. I've also 
>> added proper error message for case when output path is not a directory 
>> (JImageTask.java#449).
>>
> 
> Thanks for looking at JDK-8170114 and JDK-8170120.  I took a look at 
> http://cr.openjdk.java.net/~shade/8170114/webrev.01/
> 
> Alternatively,  jimage extract can behave as jlink and it fails if the specified 
> output directory exists including empty directory. It'd be easy to delete the 
> directory in the command-line before running jimage.
> 
> You extend JImageCliTest to handle the beforeTest method to be invoked before 
> running each test case.  Is that necessary?  The test itself is creating temp 
> file/directory for each test case.    I think it'd be good to update the test to 
> create a named file/dir under the scratch area as jtreg will take care of 
> cleaning the scratch area.

It's because of extract tests without specifying --dir (extract to cwd). AFAIK 
you can't correctly change cwd in runtime, so calling a test method in context 
of different cwd is not an option. Thus we need an empty scratch area for those. 
Alternatively we can clean cwd explicitly just before these tests, instead of 
before each test method.

> 
> Mandy
> 
> 

-- 
Michal Vala
OpenJDK QE
Red Hat Czech


More information about the jigsaw-dev mailing list