From 06d2c5c884eee0b5b663730f4d379a7ceae3a8e4 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 1 Aug 2026 05:26:16 +0900 Subject: feat(php-shim): implement Phar/PharData and the zlib/bzip2 functions Adopt the tar, flate2, and bzip2 crates to fill in the phar.rs and compress.rs todos: PharData tar/zip reading, building, and whole-archive compression, plus a native .phar reader that follows the php.net file-format manual and verifies hash-based signatures. Callers now propagate the constructor/extract errors PHP throws, and fwrite accepts byte strings so gzread no longer needs lossy UTF-8. The native .phar writing API stays todo!() (no call sites; Composer's Compiler is not ported) and OPENSSL phar signatures are accepted unverified (TODO(phase-c)). This unblocks Tar::getComposerJson and the tar/phar/gzip downloaders; tar_test (7), artifact_repository_test (2), and phar_archiver_test zip (1) are un-ignored. The archive command itself still panics because ArchiveManager::archive always generates glob excludes whose look-ahead regexes the regex crate cannot compile; converting those patterns to regex-compatible ones is a separate, still-undecided work item. Co-Authored-By: Claude Fable 5 --- crates/shirabe/src/util/remote_filesystem.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'crates/shirabe/src/util/remote_filesystem.rs') diff --git a/crates/shirabe/src/util/remote_filesystem.rs b/crates/shirabe/src/util/remote_filesystem.rs index a244c9f9..2dafc0d3 100644 --- a/crates/shirabe/src/util/remote_filesystem.rs +++ b/crates/shirabe/src/util/remote_filesystem.rs @@ -1036,10 +1036,12 @@ impl RemoteFilesystem { .unwrap_or(false); if decode { - let decoded = zlib_decode(result.as_deref().unwrap_or("")); + let decoded = zlib_decode(result.as_deref().unwrap_or("").as_bytes()); result = match decoded { - Some(d) => Some(d), + // TODO(phase-e): byte-string semantics — the response body travels through + // RemoteFilesystem as a String; from_utf8_lossy can corrupt binary payloads + Some(d) => Some(String::from_utf8_lossy(&d).into_owned()), None => { return Err(anyhow::anyhow!(TransportException::new( "Failed to decode zlib stream".to_string(), -- cgit v1.3.1