Page MenuHomeSoftware Heritage

tarball: Use standard Python module zipfile to extract jar archive
ClosedPublic

Authored by anlambert on Jun 9 2022, 3:27 PM.

Details

Summary

It exists many cases where using unzip to extract a jar archive
fails while using the zipfile module succeeds.

So prefer to use the zipfile module to uncompress jar archives.

Related to T4318

Diff Detail

Repository
rDCORE Foundations and core functionalities
Branch
better-jar-tarball-support
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 29815
Build 46598: Phabricator diff pipeline on jenkinsJenkins console · Jenkins
Build 46597: arc lint + arc unit

Event Timeline

Build is green

Patch application report for D7976 (id=28734)

Rebasing onto 5644f9cd33...

First, rewinding head to replay your work on top of it...
Applying: tarball: Use standard Python module zipfile to extract jar archive
Changes applied before test
commit 6bf584b35741592c7f56b257aee2a8ef3f787ba9
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Thu Jun 9 14:49:05 2022 +0200

    tarball: Use standard Python module zipfile to extract jar archive
    
    It exists many cases where using unzip to extract a jar archive
    fails while using the zipfile module succeeds.
    
    So prefer to use the zipfile module to uncompress jar archives.
    
    Related to T4318

See https://jenkins.softwareheritage.org/job/DCORE/job/tests-on-diff/448/ for more details.

why don't we also use this module for ZIP files?

why don't we also use this module for ZIP files?

We do, it is used internally by shutil.unpack_archive, we fall back on using unzip only when zipfile encounters an archive it cannot uncompress.

This revision is now accepted and ready to land.Jun 9 2022, 3:51 PM

Build is green

Patch application report for D7976 (id=28737)

Rebasing onto 5644f9cd33...

Current branch diff-target is up to date.
Changes applied before test
commit 7f85bd7cea2cc493e9b29307131bab2476077c9c
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Thu Jun 9 14:49:05 2022 +0200

    tarball: Use standard Python module zipfile to extract jar archive
    
    It exists many cases where using unzip to extract a jar archive
    fails while using the zipfile module succeeds.
    
    So prefer to use the zipfile module to uncompress jar archives.
    
    Related to T4318

See https://jenkins.softwareheritage.org/job/DCORE/job/tests-on-diff/449/ for more details.