Description
PharAwareArchive::extract() cannot extract a binary from the archive root. For a zip that contains LICENSE and rr at the top level, extraction fails with:
RecursiveDirectoryIterator::__construct(phar:///tmp/.../rr.zip/rr): Failed to open directory: operation failed
extract() reopens the archive with $this->open($this->archive). $this->archive is the PharData iterator itself, so its getPathname() returns the current entry, i.e. the first file in the archive, not the archive. Only that first entry is searched:
- if it is a directory, the files inside it are found;
- if it is a file, the reopen fails.
Current RoadRunner archives put everything in one top-level directory (roadrunner-<version>-<os>-<arch>/rr), which is the only reason extraction works today. A flat archive, or a binary outside the first top-level entry, cannot be installed.
Steps to reproduce
- Remove
#[Skip] from PharAwareArchiveTest::extractFindsBinaryInArchiveRoot.
- Run
vendor/bin/testo --filter=extractFindsBinaryInArchiveRoot.
Additional context
Archive handling may be replaced by DLoad in #49, in which case this code goes away.
Description
PharAwareArchive::extract()cannot extract a binary from the archive root. For a zip that containsLICENSEandrrat the top level, extraction fails with:extract()reopens the archive with$this->open($this->archive).$this->archiveis thePharDataiterator itself, so itsgetPathname()returns the current entry, i.e. the first file in the archive, not the archive. Only that first entry is searched:Current RoadRunner archives put everything in one top-level directory (
roadrunner-<version>-<os>-<arch>/rr), which is the only reason extraction works today. A flat archive, or a binary outside the first top-level entry, cannot be installed.Steps to reproduce
#[Skip]fromPharAwareArchiveTest::extractFindsBinaryInArchiveRoot.vendor/bin/testo --filter=extractFindsBinaryInArchiveRoot.Additional context
Archive handling may be replaced by DLoad in #49, in which case this code goes away.