Gradle

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What’s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
To raise new issues or bugs against Gradle, please use forums.gradle.org.
  • Gradle
  • GRADLE-971

fileMode not working for the copy task

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Resolution: Fixed
  • Affects Version/s: 0.9
  • Fix Version/s: 1.0-rc-1

Description

Copy's fileMode settings has no effect.

Example:
task test << {
copy { from 'foo.txt' into 'newDir' fileMode = 0444 }
}

No matter which value is used (as long as it is an integer), the copied file has always the default mode.

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • History
  • Activity
  • TeamCity
  • Commits
  • Source
  • Reviews
Hide
Permalink
Philip Crotwell added a comment - 29/Sep/10 9:34 AM


In addition, it would be nice if the "default mode" was to use the file mode of the copied file, rather than a generic 0644. This is particularly important when copying startup shell scripts. I generate these in gradle, which is nice because I can keep the jar versions in the shell script in sync with the gradle dependencies, but then I have to do a manual "chmod a+x bin/*" every time they are regenerated. Currently the files end up with 0644 even though the original file is 0755 and the copySpec has fileMode=0755.

Show
Philip Crotwell added a comment - 29/Sep/10 9:34 AM In addition, it would be nice if the "default mode" was to use the file mode of the copied file, rather than a generic 0644. This is particularly important when copying startup shell scripts. I generate these in gradle, which is nice because I can keep the jar versions in the shell script in sync with the gradle dependencies, but then I have to do a manual "chmod a+x bin/*" every time they are regenerated. Currently the files end up with 0644 even though the original file is 0755 and the copySpec has fileMode=0755.
Hide
Permalink
Lars Hvile added a comment - 15/Feb/12 3:42 PM

This issue has been fixed in https://github.com/gradle/gradle/pull/62. Related to GRADLE-796 & GRADLE-673.

Show
Lars Hvile added a comment - 15/Feb/12 3:42 PM This issue has been fixed in https://github.com/gradle/gradle/pull/62. Related to GRADLE-796 & GRADLE-673.
Hide
Permalink
Peter Niederwieser added a comment - 15/Feb/12 3:51 PM

merged https://github.com/gradle/gradle/pull/62

Show
Peter Niederwieser added a comment - 15/Feb/12 3:51 PM merged https://github.com/gradle/gradle/pull/62
Hide
Permalink
René Gröschke added a comment - 15/Mar/12 6:51 AM

Joern Huxhorn reported on the mailing list, that this bug isn't fixed yet. The original mail:

-------------
GRADLE-971, GRADLE-796 and GRADLE-673 are all reported as fixed in m9.

But if I remove the doLast-workaround at https://github.com/huxi/lilith/blob/6677657bb4c9ce710d3dd2a95d61fd97fd64f7e8/config.gradle#L601 the file does still have 644 instead of 755 as permission.

I'm not sure how to proceed… should I reopen GRADLE-971 or should I file a new bug for this problem?

------------------------------------------------------------
Gradle 1.0-milestone-9
------------------------------------------------------------

Gradle build time: Tuesday, March 13, 2012 4:10:09 PM UTC
Groovy: 1.8.6
Ant: Apache Ant(TM) version 1.8.2 compiled on December 20 2010
Ivy: 2.2.0
JVM: 1.6.0_29 (Apple Inc. 20.4-b02-402)
OS: Mac OS X 10.7.3 x86_64

Or is there anything I'm missing? I assumed that this should be fixed now. The tar task using the exact sam copyspec is working as expected.

Cheers,
Joern.
-------------

I've added a integration test to reproduce this error. (https://github.com/gradle/gradle/commit/b3e2c2a88c1e786b76b8414388037ade63c0d549)

Show
René Gröschke added a comment - 15/Mar/12 6:51 AM Joern Huxhorn reported on the mailing list, that this bug isn't fixed yet. The original mail: ------------- GRADLE-971, GRADLE-796 and GRADLE-673 are all reported as fixed in m9. But if I remove the doLast-workaround at https://github.com/huxi/lilith/blob/6677657bb4c9ce710d3dd2a95d61fd97fd64f7e8/config.gradle#L601 the file does still have 644 instead of 755 as permission. I'm not sure how to proceed… should I reopen GRADLE-971 or should I file a new bug for this problem? ------------------------------------------------------------ Gradle 1.0-milestone-9 ------------------------------------------------------------ Gradle build time: Tuesday, March 13, 2012 4:10:09 PM UTC Groovy: 1.8.6 Ant: Apache Ant(TM) version 1.8.2 compiled on December 20 2010 Ivy: 2.2.0 JVM: 1.6.0_29 (Apple Inc. 20.4-b02-402) OS: Mac OS X 10.7.3 x86_64 Or is there anything I'm missing? I assumed that this should be fixed now. The tar task using the exact sam copyspec is working as expected. Cheers, Joern. ------------- I've added a integration test to reproduce this error. (https://github.com/gradle/gradle/commit/b3e2c2a88c1e786b76b8414388037ade63c0d549)
Hide
Permalink
Peter Niederwieser added a comment - 15/Mar/12 12:45 PM

Maybe it's only fixed for the task but not for the method.

Show
Peter Niederwieser added a comment - 15/Mar/12 12:45 PM Maybe it's only fixed for the task but not for the method.
Hide
Permalink
René Gröschke added a comment - 16/Mar/12 3:08 AM

No it was failing for the task and the method as tested in https://github.com/gradle/gradle/blob/master/subprojects/core/src/integTest/groovy/org/gradle/api/tasks/CopyPermissionsIntegrationTest.groovy.
I've fixed this issue on master, maybe we can pair to review the changes.

Show
René Gröschke added a comment - 16/Mar/12 3:08 AM No it was failing for the task and the method as tested in https://github.com/gradle/gradle/blob/master/subprojects/core/src/integTest/groovy/org/gradle/api/tasks/CopyPermissionsIntegrationTest.groovy. I've fixed this issue on master, maybe we can pair to review the changes.
Hide
Permalink
Pablo Munoz added a comment - 20/Mar/12 2:36 PM - edited

Te suggested workaround does not work for zip tasks.

task copy(type:Copy){
...
...
doLast { File f = file('...') f.setExecutable(true, true) }
}

Is there a workaround for zip tasks?

Show
Pablo Munoz added a comment - 20/Mar/12 2:36 PM - edited Te suggested workaround does not work for zip tasks. task copy(type:Copy){ ... ... doLast { File f = file('...') f.setExecutable(true, true) } } Is there a workaround for zip tasks?
Hide
Permalink
René Gröschke added a comment - 20/Mar/12 5:47 PM

Hello Pablo,
which version of gradle are you running. FilePermissions for Zip files should be handled correctly since M9 without the need for a workaround.
regards,
René

Show
René Gröschke added a comment - 20/Mar/12 5:47 PM Hello Pablo, which version of gradle are you running. FilePermissions for Zip files should be handled correctly since M9 without the need for a workaround. regards, René
Hide
Permalink
Pablo Munoz added a comment - 14/May/12 8:41 AM

Sorry, didn't see this until now. I believe we were using an earlier version. Will retest with M9 or later. Just wanted to confirm the fix would also apply to the zip tasks.

Show
Pablo Munoz added a comment - 14/May/12 8:41 AM Sorry, didn't see this until now. I believe we were using an earlier version. Will retest with M9 or later. Just wanted to confirm the fix would also apply to the zip tasks.

People

  • Assignee:
    Unassigned
    Reporter:
    Marc Guillemot
Vote (11)
Watch (10)

Dates

  • Created:
    10/Jun/10 6:35 AM
    Updated:
    04/Jan/13 5:09 AM
    Resolved:
    16/Mar/12 3:12 AM
  • Atlassian JIRA (v5.0.3#729-sha1:bf569e4)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Gradle. Try JIRA - bug tracking software for your team.