Copy Task issues with file permissions


(Koichi Tsunoda) #1

Hello,

I’ve noticed couple of behaviors with Gradle 2.13:

  1. In Windows, the Copy task doesn’t seem to preserve the file permission. “-r-xr-x—” becomes “-rwxrwx—” for a particular file that I’m copying via the copy task. This seems to imply that file permissions should be preserved: https://issues.gradle.org/browse/GRADLE-796.
  2. In Linux, the Copy task does preserve the file permission, but as a result, it fails to overwrite the file in the output directory when Gradle tries to update the file because the source file is readonly, so the file that it’s trying to overwrite is also readonly.

Are these expected behaviors?

My task:

task copyClientLoc(type: Copy) {
    from "some_source_dir"
    into "some_output_dir"
}

Workaround that I’ve come across:

task copyClientLoc(type: Copy) {                  
    from "some_source_dir"
    into "some_output_dir"
    fileMode = 0644
}

Thanks!
Koichi


(Dennis Lang) #2

I have the same problem on osx and made the same changes you did for windows.