feat(Compress::Bzip2): real bzip2 backend via Apache Commons Compress#629
Merged
feat(Compress::Bzip2): real bzip2 backend via Apache Commons Compress#629
Conversation
Two issues kept `./jcpan -t CPAN::Checksums` from running:
1. Shebang parser rejected emacs mode markers like
`#!/usr/bin/perl -w -*- mode: cperl -*-` with
`Unrecognized switch: -*-`. Real perl tolerates `-*- ... -*-`
in the shebang line. ArgumentParser now strips the marker
before processing switches.
2. CPAN::Checksums does `use Compress::Bzip2();` unconditionally,
but PerlOnJava had no Bzip2 implementation, so module load died
in XSLoader. Add a real Java-backed Compress::Bzip2:
- Add commons-compress 1.27.1 dependency (Gradle, Maven, version
catalog).
- CompressBzip2 / CompressBzip2BzFile Java modules implementing
memBzip, memBunzip, bzip2, bzunzip, bzopen, and the OO handle
methods bzread, bzwrite, bzreadline, bzeof, bzclose, bzerror,
plus the BZ_* status constants. Mirrors the existing
CompressZlib / CompressZlibGzFile pattern.
- lib/Compress/Bzip2.pm calls XSLoader::load('Compress::Bzip2'),
which auto-discovers the Java backend (no GlobalContext wiring
needed).
Verified: in-memory and file round-trips work; `jcpan -t
CPAN::Checksums` now passes (Files=4, Tests=31, Result: PASS);
`make` (full unit test suite) is green.
Generated with [Devin](https://cli.devin.ai/docs)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes
./jcpan -t CPAN::Checksums, which previously failed for two unrelated reasons.1. Shebang parser rejected emacs mode markers
Makefile.PLstarted with#!/usr/bin/perl -w -*- mode: cperl -*-. PerlOnJava parsed-*-as a CLI switch and aborted withUnrecognized switch: -*-. Real perl tolerates-*- ... -*-in the shebang line.ArgumentParsernow strips the marker before processing switches.2. Real
Compress::Bzip2backendCPAN::Checksums.pmdoesuse Compress::Bzip2();unconditionally. PerlOnJava had no Bzip2 implementation, so the module load died insideXSLoader.pom.xml,build.gradle, andgradle/libs.versions.toml.CompressZlib/CompressZlibGzFilepattern:CompressBzip2.java—memBzip,memBunzip,bzip2,bzunzip,bzopen, plus allBZ_*status constants.CompressBzip2BzFile.java—bzread,bzwrite,bzreadline,bzeof,bzclose,bzerroron the handle returned bybzopen.lib/Compress/Bzip2.pmcallsXSLoader::load('Compress::Bzip2'), which auto-discovers the Java backend (noGlobalContextwiring needed).Test plan
./jcpan -t CPAN::Checksums—Files=4, Tests=31, Result: PASSmake(full unit test suite) green on rebased branchmemBzip->memBunzip)bzopen+bzread+bzcloseGenerated with Devin