Skip to content

fix: jcpan -t MD5 (Digest::MD5 addfile + bareword IO)#712

Merged
fglock merged 3 commits into
masterfrom
fix/jcpan-md5-addfile
May 12, 2026
Merged

fix: jcpan -t MD5 (Digest::MD5 addfile + bareword IO)#712
fglock merged 3 commits into
masterfrom
fix/jcpan-md5-addfile

Conversation

@fglock
Copy link
Copy Markdown
Owner

@fglock fglock commented May 11, 2026

Summary

Fixes ./jcpan -t MD5 (GAAS MD5-2.03 / t/md5.t), which failed with Not a GLOB reference on bareword addfile(F).

Root cause

  • Bareword handles compile to plain strings, but DigestMD5.addfile required a “reference” and bailed out early.
  • String handle resolution vivified the wrong stash glob (main::F with no IO) while the open handle lived under the real package (e.g. MD5Test::F).

Changes

  • DigestMD5.addfile: resolve via RuntimeIO.getRuntimeIO, use binmode(:raw) while reading; still no plain-path filename mode (keeps unit/digest_md5.t behavior).
  • RuntimeIO.getRuntimeIO: for simple identifier strings, peek candidate packages before vivifying; optional stash scan via GlobalVariable.pickGlobWithOpenIoForSimpleHandleName.
  • GlobalVariable: new helper to find an IO glob by short handle name when package-qualified lookup missed.

Verification

  • make (full unit suite) — pass
  • timeout 300 ./jcpan -t MD5 — pass (14/14)

fglock and others added 3 commits May 11, 2026 21:24
- DigestMD5.addfile: resolve handles via RuntimeIO.getRuntimeIO without requiring
  a reference; apply binmode(:raw) while reading.
- RuntimeIO.getRuntimeIO: for bareword-compiled string handles, peek known packages
  before vivifying the wrong stash slot; fall back to GlobalVariable helper when the
  real glob lives under another package (GAAS/MD5 t/md5.t).
- GlobalVariable: add pickGlobWithOpenIoForSimpleHandleName for stash scan.

Generated with Cursor (https://cursor.com)

Co-Authored-By: Cursor <noreply@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
RuntimeIO string resolution iterated CallerStack.peek(), which resolves lazy
caller frames and mutated the stack during unrelated IO lookups — breaking
eval/package diagnostics (uni/package.t, comp/package_block.t, run/switches.t).

Revert getRuntimeIO symbolic-name handling to the pre-712 main:: normalization.

Keep bareword addfile(F) working by resolving stash globs only inside
DigestMD5.addfile via GlobalVariable.pickGlobWithOpenIoForSimpleHandleName.

Generated with Cursor (https://cursor.com)

Co-Authored-By: Cursor <noreply@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
When `package NAME {` hit EOF before `}`, parseOptionalPackageBlock cleaned up
scopes then called TokenUtils.consume(OPERATOR, "}") and surfaced a lexer-style
"Expected token ... EOF" message. Perl reports "Missing right curly" instead;
tests: uni/package.t (comp/package_block.t section), comp/package_block.t.

Generated with Cursor (https://cursor.com)

Co-Authored-By: Cursor <noreply@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@fglock fglock merged commit 93dfa49 into master May 12, 2026
2 checks passed
@fglock fglock deleted the fix/jcpan-md5-addfile branch May 12, 2026 08:23
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