Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to extract using '/usr/bin/unzip' #10379

Closed
staabm opened this issue Dec 22, 2021 · 7 comments
Closed

Failed to extract using '/usr/bin/unzip' #10379

staabm opened this issue Dec 22, 2021 · 7 comments
Labels
Milestone

Comments

@staabm
Copy link
Contributor

staabm commented Dec 22, 2021

from time to time we experience errors like

...

  - Installing psr/event-dispatcher (1.0.0): Extracting archive
  - Installing symfony/event-dispatcher-contracts (v2.5.0): Extracting archive
  - Installing symfony/event-dispatcher (v5.4.0): Extracting archive
  - Installing phpro/soap-client (v1.7.1): Extracting archive
  - Installing recombee/php-api-client (v3.2.1): Extracting archive
  - Installing robrichards/wse-php (2.0.4): Extracting archive
  - Installing scn/hydrator (3.0.0): Extracting archive
  - Installing scn/hydrator-property-values (v3.0.1): Extracting archive
  - Installing scn/evalanche-soap-api-struct (v1.12.1): Extracting archive
  - Installing scn/evalanche-soap-api-connector (v1.9.1): Extracting archive
  - Installing webmozart/assert (1.10.0): Extracting archive
    Failed to extract filp/whoops: (9) '/usr/bin/unzip' -qq '/home/runner/work/kunzmann/kunzmann/vendor/composer/tmp-3fe1235deb919bb0ab336e3272b99f68' -d '/home/runner/work/kunzmann/kunzmann/vendor/composer/a82e210e'

[/home/runner/work/kunzmann/kunzmann/vendor/composer/tmp-3fe1235deb919bb0ab336e3272b99f68]
  End-of-central-directory signature not found.  Either this file is not
  a zipfile, or it constitutes one disk of a multi-part archive.  In the
  latter case the central directory and zipfile comment will be found on
  the last disk(s) of this archive.
unzip:  cannot find zipfile directory in one of /home/runner/work/kunzmann/kunzmann/vendor/composer/tmp-3fe1235deb919bb0ab336e3272b99f68 or
        /home/runner/work/kunzmann/kunzmann/vendor/composer/tmp-3fe1235deb919bb0ab336e3272b99f68.zip, and cannot find /home/runner/work/kunzmann/kunzmann/vendor/composer/tmp-3fe1235deb919bb0ab336e3272b99f68.ZIP, period.

    The archive may contain identical file names with different capitalization (which fails on case insensitive filesystems)
    Unzip with unzip command failed, falling back to ZipArchive class
    Install of filp/whoops failed
Error: '/home/runner/work/kunzmann/kunzmann/vendor/composer/tmp-3fe1235deb919bb0ab336e3272b99f68' is not a zip archive.


  [UnexpectedValueException]                                                                                        
  '/home/runner/work/kunzmann/kunzmann/vendor/composer/tmp-3fe1235deb919bb0ab336e3272b99f68' is not a zip archive.  

in our github actions.

usually just re-starting the github action fixes this problem.

could composer retry the unzip/download to make this more robust?


env:

Run shivammathur/setup-php@v2
  with:
    php-version: 7.4
    coverage: none
/usr/bin/bash /opt/hostedtoolcache/linux.sh 7.4 /home/runner/work/_actions/shivammathur/setup-php/v2/dist

==> Setup PHP
✓ PHP Switched to PHP 7.4.26

==> Setup Tools
✓ composer Added composer 2.1.14

==> Setup Coverage
✓ none Disabled Xdebug and PCOV

==> Sponsor setup-php
✓ setup-php setup-php.com/sponsor
@Seldaek Seldaek added the Bug label Dec 22, 2021
@Seldaek Seldaek added this to the 2.2 milestone Dec 22, 2021
@Seldaek
Copy link
Member

Seldaek commented Jan 21, 2022

This is quite weird. I haven't seen this ever.. Do you have any strange setup/env/VM on your GH actions?

I wonder why retrying unzipping would help, as it does seem to have a corrupt file, and retrying the whole download I'd rather not do given the separation of download/install steps we now have.

@M1ke
Copy link

M1ke commented Jan 25, 2022

I think I've just reproduced this and I believe it can occur when upgrading from composer v1 to v2. If you have a cache for v1, possibly with older versions of some packages (for me it happened with both symfony/string and symfony/console) you can get this error when running in composer v2. If you remove ~/.composer (or change its name) and run again, the issue resolves. If you then delete vendor, reinstate ~/.composer and run install again, the issue reoccurs.

So if experiencing this, consider deleting ~/.composer and trying again. Nb this can happen even if you are upgrading a separate project, as your machine will keep a global composer cache.

@Seldaek
Copy link
Member

Seldaek commented Mar 29, 2022

Could be fixed by #10666 too, or not, but if not then I don't really know what to do here so closing for now, if someone has more info and a repro case feel free to reopen.

@Seldaek Seldaek closed this as completed Mar 29, 2022
@jaroslavtyc
Copy link
Contributor

FIY just met this problem using Circle CI for tests.

There we install libraries, test app, then reinstall libraries with --prefer-lowest and that crashes exactly on Failed to extract... error.

- Downgrading symfony/web-profiler-bundle (v6.2.7 => v5.2.0): Extracting archive
    Failed to extract symfony/mime: (9) '/usr/bin/unzip' -qq '/root/project/vendor/composer/tmp-f93ae3ef863034d047581f82d590e064' -d '/root/project/vendor/composer/75fb64ba'

[/root/project/vendor/composer/tmp-f93ae3ef863034d047581f82d590e064]
  End-of-central-directory signature not found.  Either this file is not
  a zipfile, or it constitutes one disk of a multi-part archive.  In the
  latter case the central directory and zipfile comment will be found on
  the last disk(s) of this archive.
unzip:  cannot find zipfile directory in one of /root/project/vendor/composer/tmp-f93ae3ef863034d047581f82d590e064 or
        /root/project/vendor/composer/tmp-f93ae3ef863034d047581f82d590e064.zip, and cannot find /root/project/vendor/composer/tmp-f93ae3ef863034d047581f82d590e064.ZIP, period.

    The archive may contain identical file names with different capitalization (which fails on case insensitive filesystems)
    Unzip with unzip command failed, falling back to ZipArchive class
    Update of symfony/mime failed

In ZipDownloader.php line 220:
                                                                               
  '/root/project/vendor/composer/tmp-f93ae3ef863034d047581f82d590e064' is not  
   a zip archive.                                                              

Composer version 2.5.5 2023-03-21 11:50:05

PHP 8.2.4

Steps

wget https://raw.githubusercontent.com/pb-sylius/3brs-sylius-sorting-plugin/5f3dd2d538bca98182b243518501c1f15c5836ae/composer.json
composer update --no-interaction --prefer-dist
composer update --no-interaction --prefer-lowest

@Seldaek
Copy link
Member

Seldaek commented Apr 7, 2023

@jaroslavtyc I cannot reproduce this, so again I'm not sure what to say if there is no clear repro or more details as to what is wrong, please try to inspect the state of the cache (/root/project/vendor/composer/tmp-f93ae3ef863034d047581f82d590e064 or whatever it came from in the cache, should be stated above somewhere if you run with -vvv flag enabled) and if you can figure anything out please open a new issue with details.

@chrisbjr
Copy link

chrisbjr commented Sep 22, 2023

In my case, this was happening because i had 2 docker containers automated to run at the same time and they were sharing the same volume they were running composer install for. I guess both of them were trying to take over the vendor directory and causing these errors. Took me a while to figure it out.

I removed my volume as I didn't need it anyway.

@JPustkuchen
Copy link

In our case asset packagist was the reason. We moved the project URL at GitLab, but the asset packagist URL was still the old one!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants