Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Binaries in the archive root are not extracted

Đã đóng Phù hợp với người mới
#59 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
70/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
php
Lĩnh vực
cli

Hướng nghiên cứu

Lỗi nằm ở extract() trong src/Archive/PharAwareArchive.php, hàm này mở lại $this->archive (bộ lặp PharData) thay vì đường dẫn tới archive, nên chỉ mục đầu tiên được tìm kiếm. Hãy bắt đầu bằng cách đọc phương thức đó, sau đó xóa #[Skip] khỏi extractFindsBinaryInArchiveRoot trong tests/Unit/Archive/PharAwareArchiveTest.php và chạy vendor/bin/testo --filter=extractFindsBinaryInArchiveRoot. Công việc hoàn tất khi test đó pass và một archive phẳng hoặc một binary nằm ngoài mục cấp cao nhất đầu tiên được giải nén. Hãy kiểm tra với maintainer trước, vì issue #49 có thể thay thế đoạn code này.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug

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.

Ngôn ngữ chính
PHP
Star
30
Fork
15
Merge trung bình
9 giờ 37 phút
Pull request đã merge (30 ngày)
16

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của roadrunner-php/cli

Tất cả issue của roadrunner-php/cli

Issue tương tự

Thêm issue về PHP

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.