Skip to content

Binaries in the archive root are not extracted #59

Description

@roxblnfk

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

  1. Remove #[Skip] from PharAwareArchiveTest::extractFindsBinaryInArchiveRoot.
  2. Run vendor/bin/testo --filter=extractFindsBinaryInArchiveRoot.

Additional context

Archive handling may be replaced by DLoad in #49, in which case this code goes away.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions