Details
-
Type:
Bug
-
Status:
Resolved
-
Resolution: Fixed
-
Affects Version/s: 1.0-rc-1
-
Fix Version/s: None
Description
The following fails to correctly set the file mode on files ending with ".sh" in "archive.zip":
copy {
from zipTree("archive.zip")
eachFile {
if (it.getName().endsWith(".sh")) {
it.setMode(0755)
}
}
into "targetDir"
}
If the ".sh" files included in the ZIP are mode 0644, they get copied from the ZIP into "targetDir" as mode 0644, not mode 0755 as requested by the code in eachFile(). (Adding a println to the "if" condition in the eachFile closure shows that the files are getting correctly matched and having the setMode() method called, but this seems to have no effect on the copied files.)
this seems to be a bug with the eachFile closure. I can reproduce this issue with the following more simple snippet:
task myCopy(type:Copy) {
from "test"
eachFile {
if (it.getName().endsWith(".sh")) { it.setMode(0755) }
}
into "targetDir"
}