Skip to content

POSIX::isatty crashes on glob-backed filehandles #1932

Closed

Description

@fglock

Summary

POSIX::isatty(*STDIN) throws a Java ClassCastException in PerlOnJava when passed a Perl glob. POSIX::isatty currently treats every GLOB scalar value as a RuntimeIO and casts it directly. The *STDIN argument is represented by a RuntimeGlob, so the cast fails before isatty can inspect the file descriptor.

This prevents loading and using IO::Pty::Easy 0.10. In CPAN random run 20261030-095654-34969, six tests failed: t/open-close.t, t/read-write.t, t/spawn.t, t/subprocess.t, t/system.t, and t/undefined-program.t.

Expected and actual behavior

Expected: POSIX::isatty(*STDIN) returns 1 when standard input is a terminal and 0 otherwise, as it does under system Perl.

Actual: it throws RuntimeGlob cannot be cast to RuntimeIO from POSIX.java in both the JVM and interpreter backends.

Evidence

  • System Perl 5.42.2 on macOS 15.6: IO-Pty-Easy 0.10 passed all 7 files (20 tests); its IO-Tty 1.31 prerequisite also built and passed.
  • PerlOnJava CPAN run 20261030-095654-34969: 6/7 files failed at the POSIX::isatty(*STDIN) call in IO::Pty::Easy; the failure was recorded on both execution backends.
  • Java: Temurin 24.0.2.

The distribution itself is pure Perl; the native prerequisite is not the cause of the failure.

Acceptance criteria

  • POSIX::isatty accepts glob-backed filehandles such as *STDIN without a cast failure.
  • Add a focused regression test that passes under system Perl and both PerlOnJava backends.
  • The IO-Pty-Easy test suite no longer fails at module load for this reason.

Activity

  1. added
    bugSomething isn't working
    area:runtimeCore Perl runtime semantics
    area:ioFiles handles paths and networking
    on Oct 30, 2026
  2. fglock commented on Oct 30, 2026

    @fglock
    OwnerAuthor

    State: active
    Agent/session: Codex root-1932-20261030
    Scope: #1932, fix POSIX::isatty handling of glob-backed standard handles and add focused permanent regression coverage.
    Work: fix/posix-isatty-glob, source 9c1b18f (current branch base); PR pending.
    Checkpoint: 2026-10-30; issue created with system Perl and CPAN run evidence. Archived run shows failure on JVM and interpreter; system Perl oracle passes.
    Evidence: CPAN run 20261030-095654-34969; current source casts a GLOB value directly to RuntimeIO in POSIX.java:580.
    Blocked by: none known.
    Next: reproduce on this branch, add standard-Perl-validated regression coverage, then implement and run required gates.

  3. fglock commented on Oct 30, 2026

    @fglock
    OwnerAuthor

    State: active
    Agent/session: Codex root-1932-20261030
    Scope: #1932, POSIX::isatty glob-backed handles and permanent regression coverage.
    Work: fix/posix-isatty-glob, source 068dd3a; PR pending.
    Checkpoint: 2026-10-30; implementation and focused coverage are complete. The two-case unit passes on JVM and interpreter, and nice -n 19 make passes. System Perl prove passes. A fresh timeout 300 ./jcpan -t IO::Pty::Easy passed t/open-close.t, skipped fork-dependent tests, then timed out before a complete suite result; no orphaned process from that run remained.
    Evidence: CPAN run 20261030-095654-34969 reproduces the cast failure on both backends. Full logs are local; durable evidence and acceptance details are in #1932.
    Blocked by: none known.
    Next: commit, push branch and open PR; await review and CI.
    Supersedes checkpoint: #1932 (comment)

  4. added a commit that references this issue on Oct 30, 2026
    0b74ff8
  5. fglock commented on Oct 30, 2026

    @fglock
    OwnerAuthor

    State: active
    Agent/session: Codex root-1932-20261030
    Scope: #1932, POSIX::isatty with glob-backed filehandles and focused permanent coverage.
    Work: draft PR #1934, branch fix/posix-isatty-glob, head 0b74ff8c23f30a0a4bed0b19870e1b3ffa81ec58 based on current master a5372ff7cd6ef1b6b8a48c0ea73db6f81a7ea94d.
    Checkpoint: 2026-10-30; fix and regression are in the draft PR. PR diff is limited to the POSIX implementation, regression test, changelog and issue queue. GitHub CI is running on the corrected head.
    Evidence: the archived CPAN run fails on both backends; system Perl passes. On local source commit c6be59f3913b45aaa097bd423df9374b88fcbea8, nice -n 19 make, prove, and focused JVM/interpreter tests pass. Fresh jcpan -t IO::Pty::Easy passed t/open-close.t, skipped fork-dependent files, then timed out before a complete suite result.
    Blocked by: CI completion and review.
    Next: inspect CI results and await review.
    Supersedes checkpoint: #1932 (comment)

  6. fglock commented on Oct 30, 2026

    @fglock
    OwnerAuthor

    State: active
    Agent/session: Codex root-1932-20261030
    Scope: #1932, POSIX::isatty glob-backed filehandles and regression coverage.
    Work: draft PR #1934, branch fix/posix-isatty-glob, exact head 0b74ff8c23f30a0a4bed0b19870e1b3ffa81ec58 on current master.
    Checkpoint: 2026-10-30; PR diff is limited to the fix, regression, changelog and queue entry. The shared checkout now points to the exact PR head as a verified shallow commit and is clean; prior local commit is preserved at backup/posix-isatty-before-master-base-20261030.
    Evidence: exact tree/blob/connectivity checks pass. System Perl and both-backend focused regression pass; nice -n 19 make passed on the preceding local source commit. The fresh CPAN rerun passed t/open-close.t, skipped fork-dependent files, then timed out before a full result. GitHub Linux and Windows build jobs are still running on this exact head.
    Blocked by: CI completion and review.
    Next: inspect CI result.
    Supersedes checkpoint: #1932 (comment)

  7. fglock commented on Oct 30, 2026

    @fglock
    OwnerAuthor

    State: released
    Agent/session: Codex root-1932-20261030
    Scope: #1932, POSIX::isatty glob-backed filehandles and regression coverage.
    Work: PR #1934 merged to master at 55c1bfcea2cbc08aead110f575e7ddbc37142b43.
    Checkpoint: 2026-10-30; issue closed after merge. Both CI checks passed. The shared checkout remains clean at the exact PR head, with the earlier local commit preserved at backup/posix-isatty-before-master-base-20261030.
    Evidence: #1934; Linux and Windows checks green.
    Blocked by: none.
    Next: none.
    Supersedes checkpoint: #1932 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:ioFiles handles paths and networkingarea:runtimeCore Perl runtime semanticsbugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions