Uploaded image for project: 'Buildr (Retired)'
  1. Buildr (Retired)
  2. BUILDR-533

Reading the manifest without building the zip index

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 1.4.2
    • 1.4.3
    • Packaging
    • None

    Description

      When accessing the MANIFEST file in a jar, the convention in the java world is that it should be the first entry. Actually, quite a few systems will just not work if the MANIFEST.MF file is not the first entry.

      The way we currently access the MANIFEST file is suboptimal as we parse the whole zip, and spend time to build the index. Worse, we run into issues quickly with corrupted zips (we found out Maven3 could also produce some of those, not just Buildr ).

      Hugues Malphettes provided an other way to access the MANIFEST.MF without building the complete index.

      Around line 58 of packaging.rb

      1. :call-seq:
      2. from_zip(file) => manifest
        #
      3. Parse the MANIFEST.MF entry of a ZIP (or JAR) file and return a new Manifest.
        def from_zip(file)
        Zip::ZipInputStream::open(file.to_s) { |io| while (entry = io.get_next_entry) if entry.name == 'META-INF/MANIFEST.MF' return Manifest.parse io.read rescue Manifest.new end end }

        return Manifest.new

      4. Zip::ZipFile.open(file.to_s) do |zip|
      5. Manifest.parse zip.read('META-INF/MANIFEST.MF') rescue
        Manifest.new
      6. end
        end

      Attachments

        Activity

          People

            toulmean Antoine Toulme
            toulmean Antoine Toulme
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: