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

TarArchiver and ZipArchiver don't preserve file permissions

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved (View Workflow)
    • Major
    • Resolution: Fixed
    • core
    • None

    Description

      This is definitely true for zips, and I think it's true for tars as well - when we're creating tarballs and zipfiles, we're not actually looking at the permissions/unix mode on the files and directories going into them. As a result, the tars/zips we've created have no useful permissions set. This is particularly annoying with the clone workspace SCM plugin, where files may need to be executable for the downstream to work properly.

      Attachments

        Issue Links

          Activity

            Code changed in jenkins
            User: Kohsuke Kawaguchi
            Path:
            core/src/main/java/hudson/FilePath.java
            core/src/main/java/hudson/util/IOUtils.java
            core/src/main/java/hudson/util/io/Archiver.java
            core/src/main/java/hudson/util/io/TarArchiver.java
            core/src/main/java/hudson/util/io/ZipArchiver.java
            core/src/test/java/hudson/util/io/TarArchiverTest.java
            http://jenkins-ci.org/commit/jenkins/6577d788b91a19791b6684ddeccbc50c9c563a78
            Log:
            [FIXED JENKINS-9397] fixed a bug in the implementation, added tests.

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Kohsuke Kawaguchi Path: core/src/main/java/hudson/FilePath.java core/src/main/java/hudson/util/IOUtils.java core/src/main/java/hudson/util/io/Archiver.java core/src/main/java/hudson/util/io/TarArchiver.java core/src/main/java/hudson/util/io/ZipArchiver.java core/src/test/java/hudson/util/io/TarArchiverTest.java http://jenkins-ci.org/commit/jenkins/6577d788b91a19791b6684ddeccbc50c9c563a78 Log: [FIXED JENKINS-9397] fixed a bug in the implementation, added tests.

            Code changed in jenkins
            User: Kohsuke Kawaguchi
            Path:
            changelog.html
            http://jenkins-ci.org/commit/jenkins/ad92ad461159ea3320da15f9d7030cdd12d83cee
            Log:
            JENKINS-9397 recording the change

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Kohsuke Kawaguchi Path: changelog.html http://jenkins-ci.org/commit/jenkins/ad92ad461159ea3320da15f9d7030cdd12d83cee Log: JENKINS-9397 recording the change

            I've cloned the current version of the jenkins to https://github.com/bbaja42/jenkins.

            Junit test for this bug fails the build,

            Failed tests: permission(hudson.util.io.TarArchiverTest): expected:<33261> but was:<33206>
            testCopyToWithPermission(hudson.FilePathTest): expected:<33060> but was:<33206>
            testSymlink(hudson.UtilTest): expected:<012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567> but was:<null>

            mvn -version

            Apache Maven 3.0.4
            Maven home: /usr/share/maven
            Java version: 1.6.0_24, vendor: Sun Microsystems Inc.
            Java home: /usr/lib/jvm/java-6-openjdk-i386/jre
            Default locale: en_US, platform encoding: UTF-8
            OS name: "linux", version: "3.2.0-31-generic-pae", arch: "i386", family: "unix"

            bbaja42 Barisa Obradovic added a comment - I've cloned the current version of the jenkins to https://github.com/bbaja42/jenkins . Junit test for this bug fails the build, Failed tests: permission(hudson.util.io.TarArchiverTest): expected:<33261> but was:<33206> testCopyToWithPermission(hudson.FilePathTest): expected:<33060> but was:<33206> testSymlink(hudson.UtilTest): expected:<012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567> but was:<null> mvn -version Apache Maven 3.0.4 Maven home: /usr/share/maven Java version: 1.6.0_24, vendor: Sun Microsystems Inc. Java home: /usr/lib/jvm/java-6-openjdk-i386/jre Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "3.2.0-31-generic-pae", arch: "i386", family: "unix"
            aarondmarasco_vsi Aaron D. Marasco added a comment - - edited

            (Linking JENKINS-13128)
            This is still an issue years later. Commenting here in the hopes of the people involved in fixing this one will see; that ticket remains unassigned.

            aarondmarasco_vsi Aaron D. Marasco added a comment - - edited (Linking JENKINS-13128 ) This is still an issue years later. Commenting here in the hopes of the people involved in fixing this one will see; that ticket remains unassigned.

            I think, that the issue is merely in copying the artifacts from slave to master node (even when copying from master to master). I found a method `hudson.Util.CopyFile()`, which - as I believe - is responsible for physical transfer of the artifact files. It uses `org.apache.tools.ant.taskdefs.Copy` external class to do the job.

            This class seems to copy all the files without preserving their permissions (I guess so from a quick analysis of the code). So, the files are created with master's default permissions, and subsequently archived.

            There is another ticket which seems to be related to this issue: JENKINS-13128

            ostancik Ondrej Stancik added a comment - I think, that the issue is merely in copying the artifacts from slave to master node (even when copying from master to master). I found a method `hudson.Util.CopyFile()`, which - as I believe - is responsible for physical transfer of the artifact files. It uses `org.apache.tools.ant.taskdefs.Copy` external class to do the job. This class seems to copy all the files without preserving their permissions (I guess so from a quick analysis of the code). So, the files are created with master's default permissions, and subsequently archived. There is another ticket which seems to be related to this issue:  JENKINS-13128 . 

            People

              abayer Andrew Bayer
              abayer Andrew Bayer
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: