miyagawa / cpanminus

cpanminus - get, unpack, build and install modules from CPAN
http://cpanmin.us
755 stars 213 forks source link

Unable to extract zip files with comments #614

Closed haarg closed 4 years ago

haarg commented 4 years ago

If a dist is stored in a zip file that includes a comment, cpanm is unable to extract it. unzip -t will include the comment in its output, confusing the attempts to parse it to find the root directory.

$ cpanm -v Config::File
cpanm (App::cpanminus) 1.7043 on perl 5.024004 built for darwin-2level
Work directory is ~/.cpanm/work/1593765776.25428
You have make /usr/bin/make
You have LWP 6.36
You have /usr/bin/tar: bsdtar 3.3.2 - libarchive 3.3.2 zlib/1.2.11 liblzma/5.0.5 bz2lib/1.0.6
You have /usr/bin/unzip
Searching Config::File () on cpanmetadb ...
--> Working on Config::File
Fetching https://cpan.metacpan.org/authors/id/T/TH/THESEAL/Config-File-1.52.zip ... OK
Unpacking Config-File-1.52.zip
Archive:  Config-File-1.52.zip
76b7fc46133c027befd3a68db6c4860526ec258b
   creating: Config-File-1.52/
  inflating: Config-File-1.52/Build.PL
  inflating: Config-File-1.52/CHANGES
  inflating: Config-File-1.52/LICENSE
  inflating: Config-File-1.52/MANIFEST
  inflating: Config-File-1.52/META.yml
  inflating: Config-File-1.52/README
   creating: Config-File-1.52/lib/
   creating: Config-File-1.52/lib/Config/
  inflating: Config-File-1.52/lib/Config/File.pm
   creating: Config-File-1.52/t/
  inflating: Config-File-1.52/t/config
 extracting: Config-File-1.52/t/empty_config
  inflating: Config-File-1.52/t/pod.t
  inflating: Config-File-1.52/t/pod_coverage.t
  inflating: Config-File-1.52/t/test.t
! Bad archive: [76b7fc46133c027befd3a68db6c4860526ec258b] Config-File-1.52.zip
! Failed to unpack Config-File-1.52.zip: no directory
! Failed to fetch distribution Config-File-1.52
$ wget https://cpan.metacpan.org/authors/id/T/TH/THESEAL/Config-File-1.52.zip
--2020-07-03 10:40:31--  https://cpan.metacpan.org/authors/id/T/TH/THESEAL/Config-File-1.52.zip
Resolving cpan.metacpan.org (cpan.metacpan.org)... 2a04:4e42:1b::729, 151.101.18.217
Connecting to cpan.metacpan.org (cpan.metacpan.org)|2a04:4e42:1b::729|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 14461 (14K) [application/zip]
Saving to: ‘Config-File-1.52.zip’

Config-File-1.52.zip            100%[====================================================>]  14.12K  --.-KB/s    in 0.008s

2020-07-03 10:40:31 (1.80 MB/s) - ‘Config-File-1.52.zip’ saved [14461/14461]

$ unzip -t Config-File-1.52.zip
Archive:  Config-File-1.52.zip
76b7fc46133c027befd3a68db6c4860526ec258b
    testing: Config-File-1.52/        OK
    testing: Config-File-1.52/Build.PL   OK
    testing: Config-File-1.52/CHANGES   OK
    testing: Config-File-1.52/LICENSE   OK
    testing: Config-File-1.52/MANIFEST   OK
    testing: Config-File-1.52/META.yml   OK
    testing: Config-File-1.52/README   OK
    testing: Config-File-1.52/lib/    OK
    testing: Config-File-1.52/lib/Config/   OK
    testing: Config-File-1.52/lib/Config/File.pm   OK
    testing: Config-File-1.52/t/      OK
    testing: Config-File-1.52/t/config   OK
    testing: Config-File-1.52/t/empty_config   OK
    testing: Config-File-1.52/t/pod.t   OK
    testing: Config-File-1.52/t/pod_coverage.t   OK
    testing: Config-File-1.52/t/test.t   OK
No errors detected in compressed data of Config-File-1.52.zip.

In this file, 76b7fc46133c027befd3a68db6c4860526ec258b is the comment. cpanm is expecting the second line of the unzip -t output to be the testing: Config-File-1.52/ OK line.

skaji commented 4 years ago

cpanm 1.7044 contains the fix.

haarg commented 4 years ago

Ugh. Not sure why I didn't check that.