Skip to content

fix: unblock jcpan -t CPAN::Faker (Time::Piece %s, IO::Zlib, glob alias)#632

Merged
fglock merged 1 commit intomasterfrom
fix/cpan-faker-deps
Apr 30, 2026
Merged

fix: unblock jcpan -t CPAN::Faker (Time::Piece %s, IO::Zlib, glob alias)#632
fglock merged 1 commit intomasterfrom
fix/cpan-faker-deps

Conversation

@fglock
Copy link
Copy Markdown
Owner

@fglock fglock commented Apr 30, 2026

Summary

Running ./jcpan -t CPAN::Faker failed in three different places in the dependency chain. Each failure traced back to a real PerlOnJava bug, all fixed in this PR:

1. Time::Piece::strptime did not support %s

Java's DateTimeFormatter has no strftime-style %s (epoch seconds) token, so Time::Piece->strptime($epoch, "%s") returned an empty list and _mktime then died with Day '' out of range 1..31. Special-cased %s in TimePiece::_strptime to parse the input as a Long epoch directly.

Fixes Data::Fake t/dates.t.

2. Compress::Zlib::gzopen failed on non-gzip files in 'rb' mode

zlib's gzopen transparently reads plain (uncompressed) files, but Java's GZIPInputStream throws on missing gzip magic, so IO::Zlib->open returned undef and Archive::Tar->read($file, 1) reported Could not create filehandle for .... Peek at the first two bytes and fall back to a plain InputStream when the file isn't actually gzip-compressed.

Fixes Archive::Any::Create t/01_tar.t.

3. Glob aliasing wasn't propagated through scalar-ref assignment

local *SYM = *foo; *SYM = \$val left $foo unchanged because RuntimeGlob.set(REFERENCE) only updated this.globName and ignored the alias group, while the existing ARRAYREFERENCE and HASHREFERENCE cases already iterated getGlobAliasGroup. Mirrored that loop for the SCALAR case.

Fixes Text::Template's _install_hash, and therefore Module::Faker t/makefile-pl.t and t/requires.t.

Test plan

  • make (full unit-test build) passes
  • ./jcpan -t CPAN::Faker now runs the whole chain (CPAN::Checksums, Archive::Any::Create, Text::Lorem, Data::Fake, Module::Faker, CPAN::Faker) green:
Running test for module 'CPAN::Checksums'             Result: PASS
Running test for module 'Archive::Any::Create'        Result: PASS
Running test for module 'Text::Lorem'                 Result: PASS
Running test for module 'Data::Fake'                  Result: PASS
Running test for module 'Module::Faker::Dist'         Result: PASS
Running test for module 'CPAN::Faker'                 Result: PASS
  • Targeted regression checks for each bug fix:
    • Time::Piece->strptime(1234567890, "%s")->strftime("%Y-%m-%dT%H:%M:%SZ") -> 2009-02-13T23:31:30Z
    • IO::Zlib opens a plain tar file and reads it transparently
    • local *SYM = *main::x; *SYM = \$obj updates $main::x

Generated with Devin

Three PerlOnJava bugs surfaced while testing the CPAN::Faker chain
(CPAN::Checksums, Archive::Any::Create, Text::Lorem, Data::Fake,
Module::Faker, CPAN::Faker). All three are now fixed:

1. Time::Piece::strptime did not support %s (epoch seconds).
   Java's DateTimeFormatter has no strftime-style %s token, so
   Time::Piece->strptime($epoch, "%s") returned an empty list and
   then died in _mktime with "Day '' out of range 1..31".
   Special-case %s in TimePiece::_strptime to parse the input as a
   Long epoch directly. Fixes Data::Fake t/dates.t.

2. Compress::Zlib::gzopen failed on non-gzip files in 'rb' mode.
   zlib's gzopen transparently reads plain files, but Java's
   GZIPInputStream throws on missing gzip magic, so IO::Zlib->open
   returned undef and Archive::Tar->read($file, 1) reported
   "Could not create filehandle for ...". Peek at the first two
   bytes and fall back to a plain InputStream when the file isn't
   gzip-compressed. Fixes Archive::Any::Create t/01_tar.t.

3. Glob aliasing wasn't propagated through scalar-ref assignment.
   `local *SYM = *foo; *SYM = \$val` left $foo unchanged because
   RuntimeGlob.set(REFERENCE) only updated this.globName and
   ignored the alias group, while the ARRAYREFERENCE and
   HASHREFERENCE cases already iterated getGlobAliasGroup.
   Mirror that loop for the SCALAR case. Fixes Text::Template's
   _install_hash, and therefore Module::Faker t/makefile-pl.t and
   t/requires.t.

After these fixes, `./jcpan -t CPAN::Faker` runs the whole
dependency chain green.

Generated with [Devin](https://cli.devin.ai/docs)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@fglock fglock merged commit ddf1631 into master Apr 30, 2026
2 checks passed
@fglock fglock deleted the fix/cpan-faker-deps branch April 30, 2026 07:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant