Bug 699529 - Recognize ZIP files with non-standard "PK00" header
Summary: Recognize ZIP files with non-standard "PK00" header
Alias: None
Product: Fedora
Classification: Fedora
Component: rpm
Version: 14
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
Assignee: Panu Matilainen
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2011-04-25 20:45 UTC by Karel Klíč
Modified: 2013-03-03 23:02 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2011-04-26 04:35:06 UTC
Type: ---

Attachments (Terms of Use)
Proposed patch (747 bytes, patch)
2011-04-25 20:45 UTC, Karel Klíč
no flags Details | Diff

Description Karel Klíč 2011-04-25 20:45:19 UTC
Created attachment 494761 [details]
Proposed patch

Description of problem:
Some ZIP files have the magic string "PK00" before the standard PK^C^D header.
The non-standard magic string seems to be added by some archivers when writing to removable media.

The %setup macro does not recognize such files as ZIP archives. In other words, the rpmFileIsCompressed function does not detect them as COMPRESSED_ZIP.

Unzip and zip tools handle them well, and the 'file' tool recognizes them properly too. The only problem seems to be in the rpmFileIsCompressed detection.

Version-Release number of selected component (if applicable):

How to reproduce:
Try to create a new package "ant-antlr3" with source file http://antlr.org/share/1169924912745/antlr3-task.zip:

Name: ant-antlr3
Version: 20110110
Release: 1%{?dist}
Summary: Antlr3 task for Ant
Source0: http://antlr.org/share/1169924912745/antlr3-task.zip
BuildRequires: ant antlr3-tool
Requires: ant antlr3-tool
%setup -q -n antlr3-task

Build the package using rpmbuild.
Actual results:
rpmbuild tries to unpack the zip archive using tar and fails.

Expected results:
rpmbuild unpacks the zip archive using unzip.

Additional info:
I have tested the attached patch and it works well. It applies cleanly to both rpm-4.8.1-5.fc14 and rpm-4.9.0-7.fc16.

Comment 1 Jindrich Novy 2011-04-26 04:35:06 UTC
Fixed upstream. Thanks for pointing it out!

Note You need to log in before you can comment on or make changes to this bug.