[9] RFC on 8073061: Files.copy(foo, bar, REPLACE_EXISTING) deletes bar even if foo is not readable

Brian Burkhalter brian.burkhalter at oracle.com
Tue Feb 24 14:47:37 UTC 2015


On Feb 18, 2015, at 1:21 AM, Alan Bateman <Alan.Bateman at oracle.com> wrote:

> On 18/02/2015 09:05, Francis Galiegue wrote:
>> :
>> OK, so, in this matrix of test cases, what is supposed to happen when:
>> 
>> * the destination is a regular file on which you have write access,
>> * the source is a regular file on which you DO NOT have read access?
>> 
>> My hope: leave the destination alone. Am I right?
>> 
> That's right. The bug that we have now is that we assume that the source is readable when its attributes can be read. There is a similar issue on Windows although it's more difficult to create that scenario. And to be clear, it is not a security issue, the permission checks are correct for the case that you are running with a security manager.
> 
> -Alan

Given the foregoing, mightn’t a change such as this be appropriate?

http://cr.openjdk.java.net/~bpb/8073061/webrev.01/

With this change, the test in the issue description passes at any rate (no security manager active); I’ve no run the test suite yet.

Thanks,

Brian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/nio-dev/attachments/20150224/7f2c9135/attachment.html>


More information about the nio-dev mailing list