Skip to content

Fix symbol-table and typeglob slot semantics exposed by Symbol::Util #1119

Description

@fglock

Summary

Symbol::Util 0.0203 exposes incorrect package-stash and typeglob-slot behavior in PerlOnJava. The distribution is pure Perl and its unchanged upstream suite passes under system Perl, so this is a PerlOnJava language-compatibility defect rather than an XS, service, or environment limitation.

Fixing the underlying semantics should benefit other modules that inspect or modify symbol tables.

Results

From CPAN random-tester run 20260825-132251-83655:

  • PerlOnJava: 262/307 assertions pass; 45 fail across 4/8 test programs.
  • System Perl in the same usable environment: 307/307 assertions pass across all 8 test programs.

Failing upstream test files:

  • t/10use.t: a package expected to have no imported functions unexpectedly contains a DATA stash entry.
  • t/40delete_glob.t: selective and complete glob deletion/restoration mishandles SCALAR, ARRAY, HASH, CODE, and IO slots.
  • t/70export_glob.t: exporting individual slots can expose unwanted CODE slots, including when the selected source slot does not exist.
  • t/80export_package.t: filtered exports and unexports leave unwanted CODE slots, and mixed-slot unexport operations do not remove the requested slots correctly.

The other four test files pass, including basic glob fetching, stash access, subroutine deletion, and glob-slot listing.

Expected behavior

PerlOnJava should preserve Perl's independent typeglob-slot semantics:

  • assigning one slot must not make unrelated slots visible;
  • deleting selected slots must retain only the intended slots;
  • deleting a complete glob through its package stash must remove it;
  • restoring backed-up slots must reproduce the original glob;
  • package stashes must not acquire unrelated DATA or phantom CODE entries.

Ecosystem impact

A targeted MetaCPAN reverse-dependency lookup found four released distributions with direct runtime requirements on Symbol::Util:

  • MySQL-Util
  • namespace-functions
  • Test-Assert
  • constant-boolean

None were classified as recent dependants. The direct count is modest, but this issue concerns reusable core Perl semantics and may affect modules that manipulate typeglobs without declaring Symbol::Util.

Suggested acceptance criteria

  • Add focused project-owned regression tests for independent glob-slot assignment, deletion/restoration through a package stash, and absence of phantom CODE/DATA entries.
  • Validate those tests with system Perl first.
  • Make the focused tests pass on both PerlOnJava backends.
  • Make the unchanged Symbol::Util 0.0203 suite pass.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions