Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
2.5
-
None
-
None
-
Merged https://github.com/apache/commons-io/pull/377, see the PR for behavior.
COPY_ATTRIBUTES is no longer used by default.
Description
I found that permissions (specifically, execute) are not maintained when using copyDirectory. The following test demonstrates the behavior:**
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
Is it working as intended that the permissions are not copied over?