You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Gary D. Gregory (Jira)" <ji...@apache.org> on 2023/04/18 21:52:00 UTC

[jira] [Updated] (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:all-tabpanel ]

Gary D. Gregory updated IO-575:
-------------------------------
    Fix Version/s: 2.12.0
      Environment: 
Merged [https://github.com/apache/commons-io/pull/377, see the PR for behavior.|https://github.com/apache/commons-io/pull/377]

COPY_ATTRIBUTES is no longer used by default.

> 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
>         Environment: Merged [https://github.com/apache/commons-io/pull/377, see the PR for behavior.|https://github.com/apache/commons-io/pull/377]
> COPY_ATTRIBUTES is no longer used by default.
>            Reporter: Adam Kewley
>            Priority: Minor
>             Fix For: 2.9.0, 2.12.0
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> 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
(v8.20.10#820010)