You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Sebb (JIRA)" <ji...@apache.org> on 2018/03/18 19:51:00 UTC

[jira] [Commented] (IO-575) copyDirectory (all overloads) does not maintain file permissions

    [ https://issues.apache.org/jira/browse/IO-575?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16404142#comment-16404142 ] 

Sebb commented on IO-575:
-------------------------

I don't think the code makes any guarantees that permissions will be maintained.
As such, the code is behaving as designed. Though it could be better documented.

This might be worth implementing as an optional feature.
I don't think it should be the default, as that would change long-standing behaviour which people may be relying on.

> copyDirectory (all overloads) does not maintain file permissions
> ----------------------------------------------------------------
>
>                 Key: IO-575
>                 URL: https://issues.apache.org/jira/browse/IO-575
>             Project: Commons IO
>          Issue Type: Bug
>    Affects Versions: 2.5
>            Reporter: Adam Kewley
>            Priority: Minor
>
> I found that permissions (specifically, execute) are not maintained when using copyDirectory. The following test demonstrates the behavior:**
>  
> {code:java}
> Path sourceDir = Files.createTempDirectory("source-dir");
> String filename = "some-file";
> Path sourceFile = Files.createFile(sourceDir.resolve(filename));
> assertThat(sourceFile.toFile().canExecute()).isFalse();
> sourceFile.toFile().setExecutable(true);
> assertThat(sourceFile.toFile().canExecute()).isTrue();
> Path destDir = Files.createTempDirectory("some-empty-destination");
> FileUtils.copyDirectory(sourceDir.toFile(), destDir.toFile());
> Path destFile = destDir.resolve(filename);
> assertThat(destFile.toFile().exists()).isTrue();
> assertThat(destFile.toFile().canExecute()).isTrue(); // fails
> {code}
> Is it working as intended that the permissions are not copied over?
>  
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)