Bug 699529

Summary: Recognize ZIP files with non-standard "PK00" header
Product: [Fedora] Fedora Reporter: Karel Klíč <kklic>
Component: rpmAssignee: Panu Matilainen <pmatilai>
Status: CLOSED UPSTREAM QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 14CC: ffesti, jnovy, pmatilai, rvokal
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-04-26 04:35:06 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
Proposed patch none

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):
rpm-4.8.1-5.fc14
rpm-4.9.0-7.fc16

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
%prep
%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!