Regression: sysopen rejects O_CREAT|O_EXCL without explicit access mode
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 68/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Domain
- operating-systems
Research direction
Start by running the focused tempfile_named subtest in t/01-basic.t and tracing PerlOnJava's sysopen implementation for O_CREAT and O_EXCL flag translation on both JVM and interpreter backends. Add project-owned regression coverage for omitted access mode, repeated filename attempts, and existing O_EXCL targets; done means the focused test and complete File::Temp::MoreUtils suite pass on both backends.
Written by the indexing model from the issue text.
Description
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.
- Dominant language
- Perl
- Stars
- 64
- Forks
- 6
- Avg merge
- 5h 38m
- Merged PRs (30d)
- 170
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from fglock/PerlOnJava
-
area:cpan-port area:unicode bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
fglock/PerlOnJava#1341 ·
-
area:backend area:runtime bug
Difficulty 4/5 3-5 days Newbie friendliness 45/100
fglock/PerlOnJava#1511 ·
-
area:backend area:cpan-port bug
Difficulty 4/5 3-5 days Newbie friendliness 45/100
fglock/PerlOnJava#1508 · 1 comment ·
-
area:cpan-port area:platform enhancement
Difficulty 5/5 Over a week Newbie friendliness 30/100
fglock/PerlOnJava#1507 ·
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 45/100
fglock/PerlOnJava#1506 ·
All issues in fglock/PerlOnJava
Similar issues
-
documentation Needs Triage
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
trizen/youtube-viewer#456 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
connectivity Open
Difficulty 1/5 Under an hour Newbie friendliness 80/100
-
Common US ingredient names are not recognized, so about 12.4k US products miss an allergen warning Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
openfoodfacts/openfoodfacts-server#14657 · 4 comments ·