Skip to content

fix: honor imported overrides of core built-ins #1155

Description

@fglock

Failure

File::chmod 0.42 fails under PerlOnJava in CPAN run 20260827-102602-1611: 9 of 39 subtests fail across symbolic read, write, executable, sticky-bit, and permission-removal cases.

The module is pure Perl. Its exported chmod subroutine accepts symbolic modes such as +r and converts them to numeric modes before calling CORE::chmod.

PerlOnJava instead compiles an imported bare chmod call as the core numeric opcode. It warns that symbolic values are non-numeric and leaves the mode unchanged.

Minimal reproduction

use File::chmod;
use File::Temp qw(tempfile);

my ($fh, $path) = tempfile();
close $fh;
chmod('+r', $path) or die "chmod: $!";
printf "%04o\n", (stat($path))[2] & 07777;

System Perl prints 0644 (with the module's documented default umask behavior). Both PerlOnJava backends print 0000.

The qualified control works in both PerlOnJava backends:

File::chmod::chmod('+r', $path);

That call prints 0644, confirming that the module implementation and filesystem operation are functional. The defect is resolution/compilation of an imported subroutine whose name matches a core built-in.

Baseline

The upstream File::chmod 0.42 suite passes completely under system Perl: 19 files and 39 tests, with Result: PASS.

Expected behavior

After use File::chmod, an unqualified chmod(...) must dispatch to File::chmod::chmod, as it does in Perl. CORE::chmod(...) must continue to select the core opcode explicitly.

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