CopyFromLocal creates an empty file if an error occurs

Description

To reproduce, run

The final cp will fail because the worker is not available, but a zero-byte /LICENSE2 will still be created. This is because we always close the FileOutStream in CpCommand#copyFile, even where there is an error. We should change it to cancel the stream if an error happens.

Environment

None

Activity

Show:
Andrew Audibert
January 2, 2018, 7:34 PM

Merry Christmas Pavel!

Thanks for pointing this out, the repro steps were incorrect. The copyFromLocal command properly cancels the stream because it doesn't use the CpCommand#copyFile method. To reproduce the real issue, run

The final cp will fail because the worker is not available, but a zero-byte /LICENSE2 will still be created.

I'll update the description to contain the right reproduction steps

Fixed
Your pinned fields
Click on the next to a field label to start pinning.

Assignee

Pavel Simo

Reporter

Andrew Audibert

Labels