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

Francis Galiegue fgaliegue at gmail.com
Wed Feb 18 09:05:17 UTC 2015


On Wed, Feb 18, 2015 at 9:17 AM, Alan Bateman <Alan.Bateman at oracle.com> wrote:
> On 18/02/2015 08:13, Francis Galiegue wrote:
>>
>> This was not what I was talking about.
>>
>>  From your mail I understood that the destination file would have to be
>> opened(O_TRUNC) _even if the source file is not readable_. Which is
>> not any better than the current behavior, really. In fact it's even
>> worse.
>>
>> Or did I misread?
>>
> For regular file case and assuming no sym links the implementation is
> supposed to open the source and then open the destination with O_TRUNC. In
> general, there is a big matrix of scenario and the tests for these methods
> attempt to create as many of these scenarios as possible.
>

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?

-- 
Francis Galiegue, fgaliegue at gmail.com, https://github.com/fge
JSON Schema in Java: http://json-schema-validator.herokuapp.com
Parsers in pure Java: https://github.com/fge/grappa


More information about the nio-dev mailing list