Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-9741

Copy artifact loses file permissions

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Component/s: copyartifact-plugin
    • Labels:
      None
    • Environment:
      SLES 11.2, Jenkins 1.411
    • Similar Issues:

      Description

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

        Attachments

          Issue Links

            Activity

            Hide
            mindless 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.

            Show
            mindless 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.
            Hide
            scm_issue_link 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.

            Show
            scm_issue_link 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.
            Hide
            mindless 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.

            Show
            mindless 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.
            Hide
            dogfood 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
            Show
            dogfood 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
            Hide
            mindless 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").

            Show
            mindless 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").
            Hide
            vultron81 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?

            Show
            vultron81 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?
            Hide
            sogabe sogabe added a comment -

            reopen
            @Alan Harder sorry, closed by my mistake.

            Show
            sogabe sogabe added a comment - reopen @Alan Harder sorry, closed by my mistake.
            Hide
            zxkane 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.

            Show
            zxkane 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.
            Hide
            ebann 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

            Show
            ebann 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
            Hide
            ridesmet Ringo De Smet added a comment -

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

            Show
            ridesmet Ringo De Smet added a comment - Same here. Need the correct file permissions with "Flatten Directories" disabled.
            Hide
            jorgenpt 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.

            Show
            jorgenpt 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.
            Hide
            scm_issue_link 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.

            Show
            scm_issue_link 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.
            Hide
            dogfood 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
            Show
            dogfood 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
            Hide
            ridesmet Ringo De Smet added a comment -

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

            Show
            ridesmet Ringo De Smet added a comment - Confirmation that 1.21 seems to maintain file permissions, even without the flatten option.
            Hide
            mindless 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!

            Show
            mindless 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!
            Hide
            whimboo 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?

            Show
            whimboo 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?
            Hide
            qwert a bc added a comment -

            It's a common requirements.

            Show
            qwert a bc added a comment - It's a common requirements.
            Hide
            ikedam 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.

            Show
            ikedam 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.
            Hide
            tsackett 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".

            Show
            tsackett 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".
            Hide
            ikedam 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.

            Show
            ikedam 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.
            Show
            ikedam 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
            Hide
            tsackett 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.

            Show
            tsackett 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.
            Hide
            ikedam 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.

            Show
            ikedam 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.
            Hide
            ikedam 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

            Show
            ikedam 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
            Hide
            ikedam ikedam added a comment -

            Removed "Known Issue" from Wiki page.

            Show
            ikedam ikedam added a comment - Removed "Known Issue" from Wiki page.
            Hide
            scm_issue_link 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.

            Show
            scm_issue_link 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.
            Hide
            scm_issue_link 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.

            Show
            scm_issue_link 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.
            Hide
            scm_issue_link 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.

            Show
            scm_issue_link 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.
            Hide
            scm_issue_link 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

            Show
            scm_issue_link 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

              People

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

                Dates

                Created:
                Updated:
                Resolved: