On Mon, 7 Jun 2021 11:00:00 GMT, Athijegannathan Sundararajan 
<[email protected]> wrote:

> jlink should clean up output directory on any failure. should not leave 
> partially filled output.

I think we need to rename the JBS issue as this is not specific to the -vm 
option. Instead, this is about cleanup when jlink fails with some intermediate 
files in the output directory.

src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JlinkTask.java line 295:

> 293:             cleanupOutput(outputPath);
> 294:             return EXIT_ERROR;
> 295:         } catch (BadArgs e) {

Can you confirm that this change is benign for the case that the output 
directory exists? I believe it's a BadArgs case so it won't attempt to delete a 
file or tree if it exists but I'd like confirmation.

src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JlinkTask.java line 490:

> 488: 
> 489:     private static void deleteDirectory(Path dir) throws IOException {
> 490:         if (dir != null && Files.isDirectory(dir)) {

I don't think this method should be checking dir, that should be up to the 
caller to ensure that it is not called when output is null.

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

PR: https://git.openjdk.java.net/jdk/pull/4386

Reply via email to