Gradle
  1. Gradle
  2. GRADLE-2171

Add an option to avoid duplicate entries when creating a zip file

    Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.7-rc-1

      Description

      Hi everyone,

      While working on another issue, I stumbled across this issue: when you create a Zip file with the Zip task, you might end up with multiple identical entries in the Zip, e.g. the exact same file more than once in the same directory within the Zip. This is the case when multiple "from"'s are given which end up creating the same Filename at the same location within the resulting zip.

      As the Zip spec doesn't forbid this case (I think), these Zip files are, in theory, okay. However, depending on how and where you try to extract them, you'll end up with a whole slue or problems and errors. This is why gradle should propose an option to ensure file uniqueness in Zip files.

      imho, zip entry uniqueness should even be the default behavior for a couple of reasons: First, it would make the zip task behave the same as the copy task (when it comes to filesystem copies), which also only keeps the last file copied in case of a conflict. Lastly, having multiple identical zip entries is clearly the corner case that 99,99% of users and use cases do NOT want, so in accordance with gradle's general philosophy, those who want the "special" behavior should be the ones having to customize the task.

      For the history, please see:
      [1]http://forums.gradle.org/gradle/topic...

      best regards,
      Mike
      ----------------------------------------------------------------------------------------
      [1] http://forums.gradle.org/gradle/topics/solution_for_copying_a_subdirectory_wihtin_a_zip_into_another_zip

        Issue Links

          Activity

          Luke Daley
          made changes -
          Field Original Value New Value
          Link This issue Duplicates GRADLE-1050 [ GRADLE-1050 ]
          Luke Daley
          made changes -
          Workflow jira with pivotal tracker [ 15358 ] jira with pivotal tracker (no resolved, only closed) [ 18725 ]
          Luke Daley
          made changes -
          Workflow jira with pivotal tracker (no resolved, only closed) [ 18725 ] Copy of jira with pivotal tracker (no closed, only resolved) [ 21322 ]
          Adam Murdoch
          made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Fix Version/s 1.7-rc-1 [ 10675 ]
          Resolution Fixed [ 1 ]

            People

            • Assignee:
              Unassigned
              Reporter:
              Gradle Forums
            • Votes:
              18 Vote for this issue
              Watchers:
              18 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: