• Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • copyartifact-plugin
    • None
    • SLES 11.2, Jenkins 1.411

      When copying an executable file, the copied file is not executable, that is to say parts of the file permissions are lost.

          [JENKINS-9741] Copy artifact loses file permissions

          Alan Harder added a comment -

          This was supposedly fixed by JENKINS-9397, but there's another comment on that issue stating it may not actually work yet. Perhaps add a comment over there.

          Alan Harder added a comment - This was supposedly fixed by JENKINS-9397 , but there's another comment on that issue stating it may not actually work yet. Perhaps add a comment over there.

          Code changed in jenkins
          User: alanharder
          Path:
          src/main/java/hudson/plugins/copyartifact/FilePathCopyMethod.java
          http://jenkins-ci.org/commit/copyartifact-plugin/defe9664862dd9e41f8f7ca87b42209fa320d150
          Log:
          JENKINS-9741 partial fix for preserving file permissions when copying
          artifacts. Use FilePath.copyToWithPermission to fix issue when "flatten"
          option is chosen.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: alanharder Path: src/main/java/hudson/plugins/copyartifact/FilePathCopyMethod.java http://jenkins-ci.org/commit/copyartifact-plugin/defe9664862dd9e41f8f7ca87b42209fa320d150 Log: JENKINS-9741 partial fix for preserving file permissions when copying artifacts. Use FilePath.copyToWithPermission to fix issue when "flatten" option is chosen.

          Alan Harder added a comment -

          Looks like that other fix just gets the right permissions for the file in the archive, but does not deal with how copyartifact then copies them. I looked into this and found a FilePath.copyToWithPermission that preserves permissions for a single file copy, so I switched to that in the copyartifact code that is used when the "flatten" option is chosen. When not using this option, FilePath.copyRecursiveTo delegates the work to org.apache.tools.ant.taskdefs.Copy which does not appear to support preserving permissions.

          Alan Harder added a comment - Looks like that other fix just gets the right permissions for the file in the archive, but does not deal with how copyartifact then copies them. I looked into this and found a FilePath.copyToWithPermission that preserves permissions for a single file copy, so I switched to that in the copyartifact code that is used when the "flatten" option is chosen. When not using this option, FilePath.copyRecursiveTo delegates the work to org.apache.tools.ant.taskdefs.Copy which does not appear to support preserving permissions.

          dogfood added a comment -

          Integrated in plugins_copyartifact #53
          JENKINS-9741 partial fix for preserving file permissions when copying

          alanharder : defe9664862dd9e41f8f7ca87b42209fa320d150
          Files :

          • src/main/java/hudson/plugins/copyartifact/FilePathCopyMethod.java

          dogfood added a comment - Integrated in plugins_copyartifact #53 JENKINS-9741 partial fix for preserving file permissions when copying alanharder : defe9664862dd9e41f8f7ca87b42209fa320d150 Files : src/main/java/hudson/plugins/copyartifact/FilePathCopyMethod.java

          Alan Harder added a comment -

          sogabe, did something change in Jenkins core and its use of ant.taskdefs.Copy? afaik, my comment from 24-July still applies, that preserving permissions is only partially fixed (works when using "flatten").

          Alan Harder added a comment - sogabe, did something change in Jenkins core and its use of ant.taskdefs.Copy? afaik, my comment from 24-July still applies, that preserving permissions is only partially fixed (works when using "flatten").

          Ben Williams added a comment -

          Can we re-open this issue until it is fixed even when not using the "flatten" option? Is there a bug filed for the issue in Jenkins core?

          Ben Williams added a comment - Can we re-open this issue until it is fixed even when not using the "flatten" option? Is there a bug filed for the issue in Jenkins core?

          sogabe added a comment -

          reopen
          @Alan Harder sorry, closed by my mistake.

          sogabe added a comment - reopen @Alan Harder sorry, closed by my mistake.

          Meng Xin Zhu added a comment -

          We're using Copying artifact 1.18.

          There is a job A checked out source from Git on master(linux), then another job B is multiple configuration job which copies some files from A's workspace.

          It works fine to copy files with permission to solaris slave, however the copied files to B's workspace on master(the same linux) lose the executable permission.

          Meng Xin Zhu added a comment - We're using Copying artifact 1.18. There is a job A checked out source from Git on master(linux), then another job B is multiple configuration job which copies some files from A's workspace. It works fine to copy files with permission to solaris slave, however the copied files to B's workspace on master(the same linux) lose the executable permission.

          ebann added a comment - - edited

          Same issue here, copying a whole directory from/to a Linux_Master leads to executable files that loose executable permission.
          (Flattening off)

          This is really annoying as we have an "installer" job that triggers severals test-jobs.
          With that issue, each Test-job has to chmod the install copied from the installer-workspace

          ebann added a comment - - edited Same issue here, copying a whole directory from/to a Linux_Master leads to executable files that loose executable permission. (Flattening off) This is really annoying as we have an "installer" job that triggers severals test-jobs. With that issue, each Test-job has to chmod the install copied from the installer-workspace

          Ringo De Smet added a comment -

          Same here. Need the correct file permissions with "Flatten Directories" disabled.

          Ringo De Smet added a comment - Same here. Need the correct file permissions with "Flatten Directories" disabled.

          Assigning to Kohsuke. This should be resolved in CopyArtifact 0.21, now out. Kohsuke is also investigating the root cause which is in the core.

          Jørgen Tjernø added a comment - Assigning to Kohsuke. This should be resolved in CopyArtifact 0.21, now out. Kohsuke is also investigating the root cause which is in the core.

          Code changed in jenkins
          User: Jørgen P. Tjernø
          Path:
          src/main/java/hudson/plugins/copyartifact/FingerprintingCopyMethod.java
          http://jenkins-ci.org/commit/copyartifact-plugin/540a074e1b2209e0079334f93ce4266badc5e653
          Log:
          JENKINS-9741 Update last modified too.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jørgen P. Tjernø Path: src/main/java/hudson/plugins/copyartifact/FingerprintingCopyMethod.java http://jenkins-ci.org/commit/copyartifact-plugin/540a074e1b2209e0079334f93ce4266badc5e653 Log: JENKINS-9741 Update last modified too.

          dogfood added a comment -

          Integrated in plugins_copyartifact #80
          JENKINS-9741 Update last modified too.

          jtjerno : 540a074e1b2209e0079334f93ce4266badc5e653
          Files :

          • src/main/java/hudson/plugins/copyartifact/FingerprintingCopyMethod.java

          dogfood added a comment - Integrated in plugins_copyartifact #80 JENKINS-9741 Update last modified too. jtjerno : 540a074e1b2209e0079334f93ce4266badc5e653 Files : src/main/java/hudson/plugins/copyartifact/FingerprintingCopyMethod.java

          Ringo De Smet added a comment -

          Confirmation that 1.21 seems to maintain file permissions, even without the flatten option.

          Ringo De Smet added a comment - Confirmation that 1.21 seems to maintain file permissions, even without the flatten option.

          Alan Harder added a comment -

          Kohsuke: One comment on this being "fixed".. I see that FilePathCopyMethod is still in the codebase, and I assume it would still have this problem if it ever got used instead of FingerprintingCopyMethod. As it seems people are still asking for fingerprinting to be optional (I agree that if neither src nor dest projects use fingerprinting then it probably should be skipped), be careful in how this is done so the permissions problem is not re-introduced. thx!

          Alan Harder added a comment - Kohsuke: One comment on this being "fixed".. I see that FilePathCopyMethod is still in the codebase, and I assume it would still have this problem if it ever got used instead of FingerprintingCopyMethod. As it seems people are still asking for fingerprinting to be optional (I agree that if neither src nor dest projects use fingerprinting then it probably should be skipped), be careful in how this is done so the permissions problem is not re-introduced. thx!

          Henrik Skupin added a comment -

          So this is still not working with version 1.21 installed. I have to copy various shell scripts from the master to nodes. Each of those scripts looses the executable permission and as result the build fails.

          Is there a chance to get this finally fixed?

          Henrik Skupin added a comment - So this is still not working with version 1.21 installed. I have to copy various shell scripts from the master to nodes. Each of those scripts looses the executable permission and as result the build fails. Is there a chance to get this finally fixed?

          a bc added a comment -

          It's a common requirements.

          a bc added a comment - It's a common requirements.

          ikedam added a comment -

          What's the status of this issue?
          Copyartifact looks preserve file permissions.

          FilePathCopyMethod without enabling flatten still breaks file permissions, but there's no way for users to use FilePathCopyMethod.
          I think I can fix that, but there's no way to test that.
          Anyway, even if there are users who want FilePathCopyMethod fixed, another issue should be created.

          I plan to close this issue with 'Fixed'.
          Please let me know if there is still a problem to fix.

          ikedam added a comment - What's the status of this issue? Copyartifact looks preserve file permissions. FilePathCopyMethod without enabling flatten still breaks file permissions, but there's no way for users to use FilePathCopyMethod . I think I can fix that, but there's no way to test that. Anyway, even if there are users who want FilePathCopyMethod fixed, another issue should be created. I plan to close this issue with 'Fixed'. Please let me know if there is still a problem to fix.

          Tom Sackett added a comment -

          There is still a problem to fix.

          I'm still seeing the problem of artifacts losing their executable permissions. I also notice that the current release notes include this under "Known Issues": "Filesystem permissions of artifacts are only preserved in the copy when using the "flatten" option".

          Tom Sackett added a comment - There is still a problem to fix. I'm still seeing the problem of artifacts losing their executable permissions. I also notice that the current release notes include this under "Known Issues": "Filesystem permissions of artifacts are only preserved in the copy when using the "flatten" option".

          ikedam added a comment -

          Could you report more details of your problem?
          Especially, I want to know your OS and whether you use distributed build (master / slave).

          Copyartifact completely changed the copying mechanism in 1.21.
          Almost all comments in this page are already outdated, and I want to know problems with the latest version.

          I'll try to add automated tests for file permissions.

          ikedam added a comment - Could you report more details of your problem? Especially, I want to know your OS and whether you use distributed build (master / slave). Copyartifact completely changed the copying mechanism in 1.21. Almost all comments in this page are already outdated, and I want to know problems with the latest version. I'll try to add automated tests for file permissions.

          ikedam added a comment -

          ikedam added a comment - That known issue was added in 1.17, and may be outdated. https://wiki.jenkins-ci.org/pages/diffpagesbyversion.action?pageId=42470728&selectedPageVersions=33&selectedPageVersions=32

          Tom Sackett added a comment -

          I am running into the problem in a build running on a MacOS 10.8.5 slave, so this is a distributed build. The system is running Java 7, and it is using version 1.31 of the Copy Artifact plugin.

          Tom Sackett added a comment - I am running into the problem in a build running on a MacOS 10.8.5 slave, so this is a distributed build. The system is running Java 7, and it is using version 1.31 of the Copy Artifact plugin.

          ikedam added a comment -

          Before writing tests, I tested the behavior in my environment (Jenkins 1.590.1 + Copyartifact 1.30, Linux master / slave).
          It looks that the problem happens not when copying, but when archiving (that is, in upstream builds).

          @tsackett
          Can you see file permissions of archived artifacts?
          They should be in ${JENKINS_HOME}/jobs/(project name)/builds/(build number)/archive . They look lose permissions when archiving on master.

          ikedam added a comment - Before writing tests, I tested the behavior in my environment (Jenkins 1.590.1 + Copyartifact 1.30, Linux master / slave). It looks that the problem happens not when copying, but when archiving (that is, in upstream builds). @tsackett Can you see file permissions of archived artifacts? They should be in ${JENKINS_HOME}/jobs/(project name)/builds/(build number)/archive . They look lose permissions when archiving on master.

          ikedam added a comment -

          Fixed in 1.21.

          I added a test to verify file permission handling:
          https://github.com/jenkinsci/copyartifact-plugin/pull/45

          ikedam added a comment - Fixed in 1.21. I added a test to verify file permission handling: https://github.com/jenkinsci/copyartifact-plugin/pull/45

          ikedam added a comment -

          Removed "Known Issue" from Wiki page.

          ikedam added a comment - Removed "Known Issue" from Wiki page.

          Code changed in jenkins
          User: ikedam
          Path:
          src/test/java/hudson/plugins/copyartifact/CopyArtifactTest.java
          http://jenkins-ci.org/commit/copyartifact-plugin/417cb13c63daf8f9c48d6710dd9157e3c9aeaf8a
          Log:
          JENKINS-9741 Added a test to verify file permission handling.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: ikedam Path: src/test/java/hudson/plugins/copyartifact/CopyArtifactTest.java http://jenkins-ci.org/commit/copyartifact-plugin/417cb13c63daf8f9c48d6710dd9157e3c9aeaf8a Log: JENKINS-9741 Added a test to verify file permission handling.

          Code changed in jenkins
          User: ikedam
          Path:
          src/test/java/hudson/plugins/copyartifact/CopyArtifactTest.java
          http://jenkins-ci.org/commit/copyartifact-plugin/0424d2871e0a3b70afc1db5435e6d47e030f3e3f
          Log:
          JENKINS-9741 Fixed to pass file permissions with octals.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: ikedam Path: src/test/java/hudson/plugins/copyartifact/CopyArtifactTest.java http://jenkins-ci.org/commit/copyartifact-plugin/0424d2871e0a3b70afc1db5435e6d47e030f3e3f Log: JENKINS-9741 Fixed to pass file permissions with octals.

          Code changed in jenkins
          User: ikedam
          Path:
          src/test/java/hudson/plugins/copyartifact/CopyArtifactTest.java
          http://jenkins-ci.org/commit/copyartifact-plugin/7e24b344197623a0c515ae160286fa26ff50900c
          Log:
          JENKINS-9741 Failed to set executable bits in a test.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: ikedam Path: src/test/java/hudson/plugins/copyartifact/CopyArtifactTest.java http://jenkins-ci.org/commit/copyartifact-plugin/7e24b344197623a0c515ae160286fa26ff50900c Log: JENKINS-9741 Failed to set executable bits in a test.

          Code changed in jenkins
          User: ikedam
          Path:
          src/test/java/hudson/plugins/copyartifact/CopyArtifactTest.java
          http://jenkins-ci.org/commit/copyartifact-plugin/9f7f31b6bfec56e1df37f71b492cfdf60b70b38f
          Log:
          Merge pull request #45 from ikedam/feature/JENKINS-9741_TestsForFilePermissions

          JENKINS-9741 Added a test to verify file permission handling.

          Compare: https://github.com/jenkinsci/copyartifact-plugin/compare/e80d72c7cde3...9f7f31b6bfec

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: ikedam Path: src/test/java/hudson/plugins/copyartifact/CopyArtifactTest.java http://jenkins-ci.org/commit/copyartifact-plugin/9f7f31b6bfec56e1df37f71b492cfdf60b70b38f Log: Merge pull request #45 from ikedam/feature/ JENKINS-9741 _TestsForFilePermissions JENKINS-9741 Added a test to verify file permission handling. Compare: https://github.com/jenkinsci/copyartifact-plugin/compare/e80d72c7cde3...9f7f31b6bfec

            kohsuke Kohsuke Kawaguchi
            dreamtime Angela Johansson
            Votes:
            11 Vote for this issue
            Watchers:
            14 Start watching this issue

              Created:
              Updated:
              Resolved: