Binaries in the archive root are not extracted
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 70/100
Research direction
The bug is in extract() in src/Archive/PharAwareArchive.php, which reopens $this->archive (the PharData iterator) instead of the archive path, so only the first entry is searched. Start by reading that method, then remove #[Skip] from extractFindsBinaryInArchiveRoot in tests/Unit/Archive/PharAwareArchiveTest.php and run vendor/bin/testo --filter=extractFindsBinaryInArchiveRoot. Done when that test passes and a flat archive or a binary outside the first top-level entry extracts. Check with maintainers first, since issue #49 may replace this code.
Written by the indexing model from the issue text.
Description
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]fromPharAwareArchiveTest::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.
- Dominant language
- PHP
- Stars
- 30
- Forks
- 15
- Avg merge
- 45m
- Merged PRs (30d)
- 11
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from roadrunner-php/cli
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
roadrunner-php/cli#69 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
roadrunner-php/cli#68 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
roadrunner-php/cli#67 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
roadrunner-php/cli#62 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
roadrunner-php/cli#61 ·
Maintainers usually reply within 1 day
All issues in roadrunner-php/cli
Similar issues
-
sync-en
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
sync-en
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 4 days
-
Перевод устарел
Difficulty 1/5 Under an hour Newbie friendliness 85/100
-
bug
Difficulty 2/5 Half a day Newbie friendliness 76/100
m3ue/m3u-editor#1604 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
femiwiki/docker-mediawiki#1497 ·
Maintainers usually reply within 1 day