Regression: sysopen rejects O_CREAT|O_EXCL without explicit access mode
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 68/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
调研方向
首先运行 t/01-basic.t 中聚焦的 tempfile_named 子测试,并跟踪 PerlOnJava 的 sysopen 实现,了解其在 JVM 和解释器后端上对 O_CREAT 与 O_EXCL 标志的转换。为省略访问模式、重复尝试同一文件名以及已存在的 O_EXCL 目标添加项目自有的回归测试覆盖;当聚焦测试和完整的 File::Temp::MoreUtils 测试套件在两个后端上都通过时,即视为完成。
由索引模型根据 Issue 内容生成。
描述
Summary
File::Temp::MoreUtils 0.005 regressed on PerlOnJava because sysopen rejects a valid Perl flag combination when no explicit read/write access flag is supplied.
Regression metadata
- CPAN run:
20260918-141920-96054 - Distribution:
File-Temp-MoreUtils-0.005 - Previous pass: 2026-08-29 at commit
19c285d26 - Failing test:
t/01-basic.t, subtesttempfile_named - Reproduces on both JVM and interpreter backends
Reproduction
The upstream module calls:
sysopen $fh, $name, O_CREAT | O_CREAT | O_EXCL
The duplicate O_CREAT is harmless. The important compatibility point is that no explicit O_RDONLY, O_WRONLY, or O_RDWR flag is present. Perl treats the absent access bits as the default read-only mode while still allowing creation with O_CREAT | O_EXCL.
Minimal reproducer:
use Fcntl ':DEFAULT';
my $path = '/tmp/perlonjava-sysopen-check';
my $ok = sysopen(my $fh, $path, O_CREAT | O_CREAT | O_EXCL);
print defined($ok) ? "created\\n" : "failed: $!\\n";
For comparison, adding O_WRONLY makes the call succeed on PerlOnJava:
sysopen $fh, $path, O_WRONLY | O_CREAT | O_EXCL;
Expected result
System Perl passes the complete upstream suite. The tempfile_named test creates a.1, then continues through the filename-suffix and directory cases.
Actual result
PerlOnJava fails at the first creation attempt:
tempfile_named(): Can't create temporary file 'a.1'
The CPAN regression record reports one failed test program and one failed subtest. The focused test fails identically on both JVM and interpreter backends.
The minimal reproducer confirms that O_CREAT | O_EXCL fails under PerlOnJava, while O_WRONLY | O_CREAT | O_EXCL succeeds. This is independent of the temporary-directory location and is not a permissions, service, or platform-prerequisite failure.
Likely root cause
PerlOnJava's sysopen implementation appears to require an explicit access mode when translating Perl open flags to Java file-opening options. Standard Perl permits the access bits to be omitted, interpreting them as read-only. PerlOnJava should preserve that default while still honoring O_CREAT, O_EXCL, and the other creation flags.
Acceptance criteria
sysopenwithO_CREAT | O_EXCLand no explicit access flag succeeds on both backends, matching system Perl.- Existing
O_RDONLY,O_WRONLY, andO_RDWRbehavior remains correct. O_EXCLcontinues to report an existing target as an expected collision rather than a generic creation failure.File::Temp::MoreUtils0.005 passes its complete upstream test suite on both backends.- Add focused project-owned regression tests for omitted access mode with
O_CREAT,O_EXCL, and repeated filename attempts. - Re-run the CPAN regression to confirm recovery from the previous pass boundary.
Evidence
- System Perl: PASS for
File::Temp::MoreUtils0.005. - PerlOnJava: FAIL in
tempfile_namedon JVM and interpreter. - The package is pure Perl and uses core
Fcntl,File::Temp, andsysopen; no native extension or external service is involved. - No exact existing GitHub issue was found for this
sysopenflag combination.
- 主要语言
- Perl
- 星标
- 64
- 派生
- 6
- 平均合并
- 5 小时 38 分钟
- 30 天内合并 PR
- 170
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
fglock/PerlOnJava 的其他 Issue
-
area:cpan-port area:unicode bug
难度 2/5 1-3 小时 新手友好度 88/100
fglock/PerlOnJava#1341 ·
-
area:backend area:runtime bug
难度 4/5 3-5 天 新手友好度 45/100
fglock/PerlOnJava#1511 ·
-
area:backend area:cpan-port bug
难度 4/5 3-5 天 新手友好度 45/100
fglock/PerlOnJava#1508 · 1 条评论 ·
-
area:cpan-port area:platform enhancement
难度 5/5 一周以上 新手友好度 30/100
fglock/PerlOnJava#1507 ·
-
bug
难度 4/5 3-5 天 新手友好度 45/100
fglock/PerlOnJava#1506 ·
查看 fglock/PerlOnJava 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 75/100
-
documentation Needs Triage
难度 2/5 1-3 小时 新手友好度 75/100
-
难度 2/5 1-3 小时 新手友好度 75/100
trizen/youtube-viewer#456 ·
-
难度 2/5 1-3 小时 新手友好度 70/100
-
connectivity 未关闭
难度 1/5 1 小时以内 新手友好度 80/100