Commons-IO 2.7 - FileUtils.deleteDirectory/cleanDirectory Issue with Symbolic Links (Linux only)

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Commons-IO 2.7 - FileUtils.deleteDirectory/cleanDirectory Issue with Symbolic Links (Linux only)

Robert Turner
Over the past couple of days (since we upgraded to Commons-IO 2.7), we've
been seeing a strange issue on our build server where our code that cleans
up our automatic test environment fails to clean up folders. The code uses
(in different places) FileUtils.deleteDirectory() and
FileUtils.cleanDirectory().

What I've observed is that after invoking one or both of the above on a
directory, all the files are removed from the directory, but the symbolic
links are not. With Commons-IO 2.6, we did not have this issue.

Testing locally on OSX, I do not see the problem with 2.7. Our build server
is Ubuntu 18.04. There might be some Java differences as well (although
both are 1.8 versions of some variation).

I've done a quick scan over the code and release notes and I cannot see
anything that jumps out at me, but I haven't gone so far as getting
everything set up for a more isolated test case yet.

I thought I'd query the community and see if anyone else is observing this
issue, or has any suggestions.

For the moment, we are reverting the library change to keep our daily
activities going, and when I have a bit more time, I will dig into the
issue in more detail to try to isolate it.

Comments/thoughts?

Thanks,

Robert
Reply | Threaded
Open this post in threaded view
|

Re: Commons-IO 2.7 - FileUtils.deleteDirectory/cleanDirectory Issue with Symbolic Links (Linux only)

garydgregory
I can see in the code where we do not follow symbolic links.

I think we need to:
- decide if the default behavior is to follow links.
- add an option to toggle that

Gary

On Mon, Jul 6, 2020 at 11:37 AM Robert Turner <[hidden email]> wrote:

> Over the past couple of days (since we upgraded to Commons-IO 2.7), we've
> been seeing a strange issue on our build server where our code that cleans
> up our automatic test environment fails to clean up folders. The code uses
> (in different places) FileUtils.deleteDirectory() and
> FileUtils.cleanDirectory().
>
> What I've observed is that after invoking one or both of the above on a
> directory, all the files are removed from the directory, but the symbolic
> links are not. With Commons-IO 2.6, we did not have this issue.
>
> Testing locally on OSX, I do not see the problem with 2.7. Our build server
> is Ubuntu 18.04. There might be some Java differences as well (although
> both are 1.8 versions of some variation).
>
> I've done a quick scan over the code and release notes and I cannot see
> anything that jumps out at me, but I haven't gone so far as getting
> everything set up for a more isolated test case yet.
>
> I thought I'd query the community and see if anyone else is observing this
> issue, or has any suggestions.
>
> For the moment, we are reverting the library change to keep our daily
> activities going, and when I have a bit more time, I will dig into the
> issue in more detail to try to isolate it.
>
> Comments/thoughts?
>
> Thanks,
>
> Robert
>
Reply | Threaded
Open this post in threaded view
|

Re: Commons-IO 2.7 - FileUtils.deleteDirectory/cleanDirectory Issue with Symbolic Links (Linux only)

garydgregory
Robert,

I've added the option to follow links by default in the new implementation
that came with 2,7.

Please try git master or the latest 2.8-SNAPSHOT:
https://repository.apache.org/content/repositories/snapshots/commons-io/commons-io/2.8-SNAPSHOT/commons-io-2.8-20200706.215152-9.jar

Gary

On Mon, Jul 6, 2020 at 12:17 PM Gary Gregory <[hidden email]> wrote:

> I can see in the code where we do not follow symbolic links.
>
> I think we need to:
> - decide if the default behavior is to follow links.
> - add an option to toggle that
>
> Gary
>
> On Mon, Jul 6, 2020 at 11:37 AM Robert Turner <[hidden email]>
> wrote:
>
>> Over the past couple of days (since we upgraded to Commons-IO 2.7), we've
>> been seeing a strange issue on our build server where our code that cleans
>> up our automatic test environment fails to clean up folders. The code uses
>> (in different places) FileUtils.deleteDirectory() and
>> FileUtils.cleanDirectory().
>>
>> What I've observed is that after invoking one or both of the above on a
>> directory, all the files are removed from the directory, but the symbolic
>> links are not. With Commons-IO 2.6, we did not have this issue.
>>
>> Testing locally on OSX, I do not see the problem with 2.7. Our build
>> server
>> is Ubuntu 18.04. There might be some Java differences as well (although
>> both are 1.8 versions of some variation).
>>
>> I've done a quick scan over the code and release notes and I cannot see
>> anything that jumps out at me, but I haven't gone so far as getting
>> everything set up for a more isolated test case yet.
>>
>> I thought I'd query the community and see if anyone else is observing this
>> issue, or has any suggestions.
>>
>> For the moment, we are reverting the library change to keep our daily
>> activities going, and when I have a bit more time, I will dig into the
>> issue in more detail to try to isolate it.
>>
>> Comments/thoughts?
>>
>> Thanks,
>>
>> Robert
>>
>