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

Zip generated from "all files in zip" contains the wrong slashes

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • core
    • None
    • Windows Server 2008, Java 7u25

      The zip downloaded from "all files in zip" contains backwards slashes, which result in these becoming part of the filename when the zip is extracted (instead of becoming subdirectories.)

      Here is the output I get from unzip -t:

      Archive:  /Users/daniel/Downloads/functional-tests.zip
          testing: functional-tests/0095eaafc6104c20af6ec6f3cee22ba0\derby.log   OK
          testing: functional-tests/0095eaafc6104c20af6ec6f3cee22ba0\app.log   OK
          testing: functional-tests/0095eaafc6104c20af6ec6f3cee22ba0\stderr.log   OK
          testing: functional-tests/0095eaafc6104c20af6ec6f3cee22ba0\stdout.log   OK
          testing: functional-tests/06f5fd94c53849378657dff5682e6610\derby.log   OK
          testing: functional-tests/06f5fd94c53849378657dff5682e6610\app.log   OK
          testing: functional-tests/06f5fd94c53849378657dff5682e6610\stderr.log   OK
          testing: functional-tests/06f5fd94c53849378657dff5682e6610\stdout.log   OK
          testing: functional-tests/0869e783b162411fa8fadae3b28c98e2\app.log   OK
          testing: functional-tests/0869e783b162411fa8fadae3b28c98e2\stderr.log   OK
          testing: functional-tests/0869e783b162411fa8fadae3b28c98e2\stdout.log   OK
      

          [JENKINS-22514] Zip generated from "all files in zip" contains the wrong slashes

          Daniel Beck added a comment -

          Issue report does not mention Jenkins version, master OS, slave OS, whether it's downloading a workspace (on what kind of slave?) or archived artifacts.

          Closing as incomplete.

          Daniel Beck added a comment - Issue report does not mention Jenkins version, master OS, slave OS, whether it's downloading a workspace (on what kind of slave?) or archived artifacts. Closing as incomplete.

          trejkaz added a comment -

          Sigh.

          trejkaz added a comment - Sigh.

          trejkaz added a comment - - edited

          There you go. I couldn't enter the actual Jenkins version because your shitty issue tracker doesn't let me, but really, the platform should be enough to verify this issue.

          trejkaz added a comment - - edited There you go. I couldn't enter the actual Jenkins version because your shitty issue tracker doesn't let me, but really, the platform should be enough to verify this issue.

          Oleg Nenashev added a comment -

          The "Version" field has been turned off according to the discussions within the community.
          Use the "Environment" field to specify versions

          If you don't agree, just bother to find the thread on the Google group and provide arguments instead of non-constructive comments.

          Oleg Nenashev added a comment - The "Version" field has been turned off according to the discussions within the community. Use the "Environment" field to specify versions If you don't agree, just bother to find the thread on the Google group and provide arguments instead of non-constructive comments.

          Daniel Beck added a comment -

          Between Jenkins and plugins, we have too many versions – Jira simply cannot handle it in these fields. Just open the 'Create Issue' form in this project and check it out. Sure, it also uses plugin name as prefix, but IIRC someone counted and only using version strings such as '1.10' would likely also be too many.

          Oleg, do you have a Windows server to verify this report?

          Daniel Beck added a comment - Between Jenkins and plugins, we have too many versions – Jira simply cannot handle it in these fields. Just open the 'Create Issue' form in this project and check it out. Sure, it also uses plugin name as prefix, but IIRC someone counted and only using version strings such as '1.10' would likely also be too many. Oleg, do you have a Windows server to verify this report?

          Oleg Nenashev added a comment -

          Yes, I have Windows Server 2008. I'll check the issue
          BTW, some information about Java would be useful (just to prevent differences on the system level)

          Oleg Nenashev added a comment - Yes, I have Windows Server 2008. I'll check the issue BTW, some information about Java would be useful (just to prevent differences on the system level)

          Daniel Beck added a comment -

          Likely introduced in 1.532 because VirtualFile.list(String glob) (and ultimately Ant) returns platform separators, while ZipEntry expects forward slashes.

          Daniel Beck added a comment - Likely introduced in 1.532 because VirtualFile.list(String glob) (and ultimately Ant) returns platform separators, while ZipEntry expects forward slashes.

          Use case:

          Running Jenkins on Windows (Windows Server 2008 R2 Standard with Service Pack 1; Java version "1.6.0_21"; Java(TM) SE Runtime Environment (build 1.6.0_21-b07) Java HotSpot(TM) Client VM (build 17.0-b17, mixed mode, sharing)); on Linux download a directory via wget and the all files in zip link; unzip the zip file via unzip.

          If Jenkins 1.532.3, 1.565.1, 1.572, 1.573 or 1.574 is running and the zipped directory contains subdirectories then the unzip on Linus creates a flat list of files and the file names are concatenations of (sub)paths and filenames (names of file in subdirectories contains backslashes, e.g. file name: subdirectory\file.txt). If Jenkins 1.509.4 is running then it works as expected (unzip recreates directories, e.g. file file.txt in directory subdirectory).

          Holger Voormann added a comment - Use case: Running Jenkins on Windows (Windows Server 2008 R2 Standard with Service Pack 1; Java version "1.6.0_21"; Java(TM) SE Runtime Environment (build 1.6.0_21-b07) Java HotSpot(TM) Client VM (build 17.0-b17, mixed mode, sharing)); on Linux download a directory via wget and the all files in zip link; unzip the zip file via unzip . If Jenkins 1.532.3, 1.565.1, 1.572, 1.573 or 1.574 is running and the zipped directory contains subdirectories then the unzip on Linus creates a flat list of files and the file names are concatenations of (sub)paths and filenames (names of file in subdirectories contains backslashes, e.g. file name: subdirectory\file.txt ). If Jenkins 1.509.4 is running then it works as expected ( unzip recreates directories, e.g. file file.txt in directory subdirectory ).

          Daniel Beck added a comment -

          Oleg, this is set to you, are you planning to work on this?

          Daniel Beck added a comment - Oleg, this is set to you, are you planning to work on this?

          Having the same problem on Windows Server 2012 and using unzip on Linux. This worked fine before upgrading to Jenkins 1.572 from 1.4.x version.

          Tomasz Stanczak added a comment - Having the same problem on Windows Server 2012 and using unzip on Linux. This worked fine before upgrading to Jenkins 1.572 from 1.4.x version.

          We are having the same issue. Any progress? Do you need more information?

          Harald Hermann added a comment - We are having the same issue. Any progress? Do you need more information?

          Daniel Beck added a comment -

          Confirmation that it worked correctly up to and including 1.531 would be nice.

          Daniel Beck added a comment - Confirmation that it worked correctly up to and including 1.531 would be nice.

          Daniel Beck added a comment -

          https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/util/io/ZipArchiver.java shows how it's supposed to be done.

          String relativePath = _relativePath.replace('\\', '/');

          Unfortunately this would introduce a bug on platforms where backslash is a legal file name character. Something like replace(File.separator, '/') should do it though.

          Daniel Beck added a comment - https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/util/io/ZipArchiver.java shows how it's supposed to be done. String relativePath = _relativePath.replace( '\\' , '/' ); Unfortunately this would introduce a bug on platforms where backslash is a legal file name character. Something like replace(File.separator, '/') should do it though.

          @Daniel You are probably right, but ZipArchiver is a different issue. And you are right, this issue has been introduced in 1.532 (see your comment from May). This commit will fix this issue. Could you verify and apply it?

          Holger Voormann added a comment - @Daniel You are probably right, but ZipArchiver is a different issue. And you are right, this issue has been introduced in 1.532 (see your comment from May). This commit will fix this issue. Could you verify and apply it?

          Holger Voormann added a comment - Pull request: https://github.com/jenkinsci/jenkins/pull/1408

          Thanks Holger for the quick response and commit. We hope this gets soon integrated so we can upgrade.

          Harald Hermann added a comment - Thanks Holger for the quick response and commit. We hope this gets soon integrated so we can upgrade.

          Daniel Beck added a comment -

          Holger took over, so assigning the issue to him.

          Daniel Beck added a comment - Holger took over, so assigning the issue to him.

          Holger Voormann added a comment - - edited

          JENKINS-22514_Tests.zip: Detailed test results and scripts/jobs used.

          See pull request comment

          Holger Voormann added a comment - - edited JENKINS-22514_Tests.zip : Detailed test results and scripts/jobs used. See pull request comment

          @Daniel Could you please merge pull request #1408? I'm not a Jenkins committer.

          Holger Voormann added a comment - @Daniel Could you please merge pull request #1408 ? I'm not a Jenkins committer.

          Code changed in jenkins
          User: Holger Voormann
          Path:
          core/src/main/java/hudson/model/DirectoryBrowserSupport.java
          http://jenkins-ci.org/commit/jenkins/c56362aba30a3ae35312db3ca6222249b063e71d
          Log:
          [FIXED JENKINS-22514] In ZIP archives file separator must be '/'

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Holger Voormann Path: core/src/main/java/hudson/model/DirectoryBrowserSupport.java http://jenkins-ci.org/commit/jenkins/c56362aba30a3ae35312db3ca6222249b063e71d Log: [FIXED JENKINS-22514] In ZIP archives file separator must be '/'

          Code changed in jenkins
          User: Oleg Nenashev
          Path:
          core/src/main/java/hudson/model/DirectoryBrowserSupport.java
          http://jenkins-ci.org/commit/jenkins/fef47e124fb9826f1e1d8f740044496d7dede4af
          Log:
          Merge pull request #1408 from howlger/master

          [FIXED JENKINS-22514] In ZIP archives file separator must be '/'

          Compare: https://github.com/jenkinsci/jenkins/compare/e71d5e42c4cc...fef47e124fb9

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Oleg Nenashev Path: core/src/main/java/hudson/model/DirectoryBrowserSupport.java http://jenkins-ci.org/commit/jenkins/fef47e124fb9826f1e1d8f740044496d7dede4af Log: Merge pull request #1408 from howlger/master [FIXED JENKINS-22514] In ZIP archives file separator must be '/' Compare: https://github.com/jenkinsci/jenkins/compare/e71d5e42c4cc...fef47e124fb9

          dogfood added a comment -

          Integrated in jenkins_main_trunk #3806
          [FIXED JENKINS-22514] In ZIP archives file separator must be '/' (Revision c56362aba30a3ae35312db3ca6222249b063e71d)

          Result = SUCCESS
          github : c56362aba30a3ae35312db3ca6222249b063e71d
          Files :

          • core/src/main/java/hudson/model/DirectoryBrowserSupport.java

          dogfood added a comment - Integrated in jenkins_main_trunk #3806 [FIXED JENKINS-22514] In ZIP archives file separator must be '/' (Revision c56362aba30a3ae35312db3ca6222249b063e71d) Result = SUCCESS github : c56362aba30a3ae35312db3ca6222249b063e71d Files : core/src/main/java/hudson/model/DirectoryBrowserSupport.java

          The changelog says that the fix of this issue is included in 1.590. But this is wrong: see DirectoryBrowserSupport tagged with jenkins-1.590. Probably, this issue will be fixed with the upcoming version 1.591.

          Holger Voormann added a comment - The changelog says that the fix of this issue is included in 1.590 . But this is wrong: see DirectoryBrowserSupport tagged with jenkins-1.590 . Probably, this issue will be fixed with the upcoming version 1.591.

          steven sun added a comment - - edited

          i think this problem is still alive on 1.590. maybe something wrong when source merge.

          i use "all files in zip" function to aa.zip in Windows7, then unzip aa.zip on Linux.
          all subfolders are not idenfied. all files are unzip with the name "subfolde+filename".

          earnest hope fixed this issue.

          steven sun added a comment - - edited i think this problem is still alive on 1.590. maybe something wrong when source merge. i use "all files in zip" function to aa.zip in Windows7, then unzip aa.zip on Linux. all subfolders are not idenfied. all files are unzip with the name "subfolde+filename". earnest hope fixed this issue.

          Daniel Beck added a comment -

          sot007 Consider reading the preceding comment(s) before writing one of your own

          I moved the changelog entry to reflect reality.

          Daniel Beck added a comment - sot007 Consider reading the preceding comment(s) before writing one of your own I moved the changelog entry to reflect reality.

          Code changed in jenkins
          User: Daniel Beck
          Path:
          changelog.html
          http://jenkins-ci.org/commit/jenkins/6bf6e7f501ce2c27d99824936b92d3f9703856d6
          Log:
          JENKINS-22514 is only in 1.591

          Fixing 9162c3cbb742f13548d5513a26e5b6ef42d62480

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Daniel Beck Path: changelog.html http://jenkins-ci.org/commit/jenkins/6bf6e7f501ce2c27d99824936b92d3f9703856d6 Log: JENKINS-22514 is only in 1.591 Fixing 9162c3cbb742f13548d5513a26e5b6ef42d62480

            howlger Holger Voormann
            trejkaz trejkaz
            Votes:
            3 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:
              Resolved: