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

TarArchiver and ZipArchiver don't preserve file permissions

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Component/s: core
    • Labels:
      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.

        Issue Links

          Activity

          abayer abayer created issue -
          abayer abayer made changes -
          Field Original Value New Value
          Link This issue is blocking JENKINS-2572 [ JENKINS-2572 ]
          abayer abayer made changes -
          Link This issue is blocking JENKINS-8677 [ JENKINS-8677 ]
          abayer abayer made changes -
          Link This issue is blocking JENKINS-8140 [ JENKINS-8140 ]
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Andrew Bayer
          Path:
          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
          http://jenkins-ci.org/commit/jenkins/00485b3188236f17b4962790945ae3218de98d09
          Log:
          [FIXED JENKINS-9397] Added convenience method to hudson.util.io.Archiver to get the Unix mode (if appropriate) for a file, and modified TarArchiver and ZipArchiver to utilise this to get and set the Unix mode for files whent they're being archived.

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Andrew Bayer Path: 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 http://jenkins-ci.org/commit/jenkins/00485b3188236f17b4962790945ae3218de98d09 Log: [FIXED JENKINS-9397] Added convenience method to hudson.util.io.Archiver to get the Unix mode (if appropriate) for a file, and modified TarArchiver and ZipArchiver to utilise this to get and set the Unix mode for files whent they're being archived.
          scm_issue_link SCM/JIRA link daemon made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Hide
          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.

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

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

          Integrated in jenkins_main_trunk #696
          [FIXED JENKINS-9397] Added convenience method to hudson.util.io.Archiver to get the Unix mode (if appropriate) for a file, and modified TarArchiver and ZipArchiver to utilise this to get and set the Unix mode for files whent they're being archived.
          [FIXED JENKINS-9397] fixed a bug in the implementation, added tests.
          JENKINS-9397 recording the change

          Kohsuke Kawaguchi : 00485b3188236f17b4962790945ae3218de98d09
          Files :

          • core/src/main/java/hudson/util/io/Archiver.java
          • core/src/main/java/hudson/util/io/ZipArchiver.java
          • core/src/main/java/hudson/util/io/TarArchiver.java

          Kohsuke Kawaguchi : 6577d788b91a19791b6684ddeccbc50c9c563a78
          Files :

          • core/src/test/java/hudson/util/io/TarArchiverTest.java
          • core/src/main/java/hudson/util/IOUtils.java
          • core/src/main/java/hudson/util/io/ZipArchiver.java
          • core/src/main/java/hudson/FilePath.java
          • core/src/main/java/hudson/util/io/Archiver.java
          • core/src/main/java/hudson/util/io/TarArchiver.java

          Kohsuke Kawaguchi : ad92ad461159ea3320da15f9d7030cdd12d83cee
          Files :

          • changelog.html
          Show
          dogfood dogfood added a comment - Integrated in jenkins_main_trunk #696 [FIXED JENKINS-9397] Added convenience method to hudson.util.io.Archiver to get the Unix mode (if appropriate) for a file, and modified TarArchiver and ZipArchiver to utilise this to get and set the Unix mode for files whent they're being archived. [FIXED JENKINS-9397] fixed a bug in the implementation, added tests. JENKINS-9397 recording the change Kohsuke Kawaguchi : 00485b3188236f17b4962790945ae3218de98d09 Files : core/src/main/java/hudson/util/io/Archiver.java core/src/main/java/hudson/util/io/ZipArchiver.java core/src/main/java/hudson/util/io/TarArchiver.java Kohsuke Kawaguchi : 6577d788b91a19791b6684ddeccbc50c9c563a78 Files : core/src/test/java/hudson/util/io/TarArchiverTest.java core/src/main/java/hudson/util/IOUtils.java core/src/main/java/hudson/util/io/ZipArchiver.java core/src/main/java/hudson/FilePath.java core/src/main/java/hudson/util/io/Archiver.java core/src/main/java/hudson/util/io/TarArchiver.java Kohsuke Kawaguchi : ad92ad461159ea3320da15f9d7030cdd12d83cee Files : changelog.html
          Hide
          owenmehegan owenmehegan added a comment - - edited

          I don't think this is fixed. I upgraded to 1.410 of Jenkins and 0.3 of the Clone Workspace plugin, but executable permissions on my files are still stripped after they are cloned.

          I set up a super simple test of this:
          1. Build 1 creates a file, runs chmod a+x on it, runs 'ls -l' so I can verify the file's perms in the console log, then archives the workspace and calls Build 2.
          2. Build 2 uses the Clone Workspace SCM option and pulls in the archived files, then runs an 'ls -l' on them.

          Before:

          -rwxr-xr-x 1 br br 0 2011-05-03 22:59 owen_test

          After:

          -rw-r--r-- 1 br br 0 2011-05-03 22:59 owen_test
          Show
          owenmehegan owenmehegan added a comment - - edited I don't think this is fixed. I upgraded to 1.410 of Jenkins and 0.3 of the Clone Workspace plugin, but executable permissions on my files are still stripped after they are cloned. I set up a super simple test of this: 1. Build 1 creates a file, runs chmod a+x on it, runs 'ls -l' so I can verify the file's perms in the console log, then archives the workspace and calls Build 2. 2. Build 2 uses the Clone Workspace SCM option and pulls in the archived files, then runs an 'ls -l' on them. Before: -rwxr-xr-x 1 br br 0 2011-05-03 22:59 owen_test After: -rw-r--r-- 1 br br 0 2011-05-03 22:59 owen_test
          owenmehegan owenmehegan made changes -
          Resolution Fixed [ 1 ]
          Status Resolved [ 5 ] Reopened [ 4 ]
          Hide
          sogabe sogabe added a comment -

          See JENKINS-9577 about clone workspace plugin.

          Show
          sogabe sogabe added a comment - See JENKINS-9577 about clone workspace plugin.
          sogabe sogabe made changes -
          Status Reopened [ 4 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          mindless Alan Harder made changes -
          Link This issue is blocking JENKINS-9741 [ JENKINS-9741 ]
          Hide
          dreamtime Angela Johansson added a comment - - edited

          Sorry, commented the wrong bug
          After this fix, I still have problems with both the Copy Artifact plugin AND the Clone Workspace plugin but I guess it's not related to the Archiver any more.

          Show
          dreamtime Angela Johansson added a comment - - edited Sorry, commented the wrong bug After this fix, I still have problems with both the Copy Artifact plugin AND the Clone Workspace plugin but I guess it's not related to the Archiver any more.
          ustuehler Uwe Stuehler made changes -
          Link This issue is related to JENKINS-9577 [ JENKINS-9577 ]
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Andrew Bayer
          Path:
          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
          http://jenkins-ci.org/commit/jenkins/00485b3188236f17b4962790945ae3218de98d09
          Log:
          [FIXED JENKINS-9397] Added convenience method to hudson.util.io.Archiver to get the Unix mode (if appropriate) for a file, and modified TarArchiver and ZipArchiver to utilise this to get and set the Unix mode for files whent they're being archived.

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Andrew Bayer Path: 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 http://jenkins-ci.org/commit/jenkins/00485b3188236f17b4962790945ae3218de98d09 Log: [FIXED JENKINS-9397] Added convenience method to hudson.util.io.Archiver to get the Unix mode (if appropriate) for a file, and modified TarArchiver and ZipArchiver to utilise this to get and set the Unix mode for files whent they're being archived.
          Hide
          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.

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

          Show
          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
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Andrew Bayer
          Path:
          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
          http://jenkins-ci.org/commit/jenkins/00485b3188236f17b4962790945ae3218de98d09
          Log:
          [FIXED JENKINS-9397] Added convenience method to hudson.util.io.Archiver to get the Unix mode (if appropriate) for a file, and modified TarArchiver and ZipArchiver to utilise this to get and set the Unix mode for files whent they're being archived.

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Andrew Bayer Path: 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 http://jenkins-ci.org/commit/jenkins/00485b3188236f17b4962790945ae3218de98d09 Log: [FIXED JENKINS-9397] Added convenience method to hudson.util.io.Archiver to get the Unix mode (if appropriate) for a file, and modified TarArchiver and ZipArchiver to utilise this to get and set the Unix mode for files whent they're being archived.
          Hide
          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.

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

          Show
          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
          Hide
          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"

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

            People

            • Assignee:
              abayer abayer
              Reporter:
              abayer abayer
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: