PerlIO::via FILENO callback is omitted on open

未關閉
#2,162 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
4/5
預估耗時
3-5 天
新手友好度
35/100
Issue 類型
缺陷
描述清晰度
基本清楚
活躍度
活躍
技術堆疊
java, perl
領域
compilers

研究方向

Start where a :via handle is opened and layers are pushed: inspect ViaLayer and LayeredIOHandle.fileno() to find the open/layer-setup path, then compare it with the callback-order probe in the issue. Run the gzip reproducer and t/001_roundtrip.t to confirm current behavior. Done means FILENO runs during open before the first WRITE with the expected layer and handle arguments, plus regression tests for ordering and initialization passing on JVM and interpreter backends.

由索引模型根據 Issue 內容生成。

描述

area:io bug

Summary

PerlOnJava does not invoke a PerlIO::via layer's FILENO callback when opening a :via(...) handle. Perl invokes this callback before the first WRITE. A layer that initializes its underlying stream in FILENO therefore reaches WRITE with no initialized state.

This breaks PerlIO-via-gzip 0.03 on both PerlOnJava execution backends. Its FILENO callback initializes IO::Compress::Gzip or IO::Uncompress::Gunzip, and its write/read callbacks require that initialization.

Reproducer

With PerlIO-via-gzip 0.03 available in @INC:

use PerlIO::via::gzip;
my $path = "/tmp/perlio-via-gzip-$$.gz";
open(my $fh, ">:via(gzip)", $path) or die "open: $!";
print {$fh} "hello\n";
close $fh or die "close: $!";
unlink $path;

System Perl completes this successfully. PerlOnJava emits an uninitialized-value warning from PerlIO::via::gzip::FLUSH, then dies from PerlIO::via::gzip::WRITE with handle not initialized.

A callback-order probe gives the minimal behavior difference. For a layer implementing PUSHED, FILENO, WRITE, and FLUSH, system Perl calls:

PUSHED,FILENO,WRITE,FLUSH

PerlOnJava calls:

PUSHED,WRITE,FLUSH,FLUSH,FLUSH

The FILENO callback is omitted on both JVM and interpreter backends.

CPAN and verification evidence

  • Distribution: PerlIO-via-gzip 0.03; upstream test: t/001_roundtrip.t.
  • PerlOnJava CPAN run: 20261120-195805-13340; the test exits after 5 of 10 planned tests with the uninitialized FLUSH warning and WRITE error described above.
  • At PerlOnJava source commit 506371c134837d026687b1958c856edb3c6f70e4, t/001_roundtrip.t passes all 10 tests on system Perl 5.34.1 and fails after test 5 with the same error on both the JVM and interpreter backends.
  • The repository nice -n 19 make gate passed at that commit.
  • The distribution is pure Perl; its runtime prerequisites are IO::Compress::Gzip and IO::Uncompress::Gunzip.

Environment and implementation notes

Reproduced on macOS 26.7.3 arm64 with OpenJDK 24.0.2.

ViaLayer discovers and implements onFileno(), and LayeredIOHandle.fileno() forwards to it when called. The observed difference is that opening a :via handle does not cause this callback to run before writes, as system Perl does. Please check where FILENO must be triggered during open/layer setup and preserve the callback's return/error semantics.

Acceptance criteria

  • A :via layer's FILENO callback runs during open, before its first read or write callback, matching system Perl.
  • The callback receives the same layer object and underlying handle arguments expected by PerlIO::via.
  • Add focused regression coverage for callback ordering and for a layer that depends on FILENO initialization.
  • t/001_roundtrip.t passes on system Perl, the PerlOnJava JVM backend, and the interpreter backend.
主要語言
Perl
星號
67
分支
8
平均合併
4 小時 36 分鐘
30 天內合併 PR
123

環境準備

  • 提供 Dockerfile 或 Docker Compose 檔案
  • 沒有 Pull Request 範本
  • 閱讀貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

fglock/PerlOnJava 的其他 Issue

查看 fglock/PerlOnJava 的全部 Issue

相似的 Issue

更多 Perl Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。