Skip to content

fix: File::Temp cwd for pathless templates (Config::JSON jcpan)#683

Merged
fglock merged 1 commit intomasterfrom
fix/file-temp-cwd-match-perl
May 8, 2026
Merged

fix: File::Temp cwd for pathless templates (Config::JSON jcpan)#683
fglock merged 1 commit intomasterfrom
fix/file-temp-cwd-match-perl

Conversation

@fglock
Copy link
Copy Markdown
Owner

@fglock fglock commented May 8, 2026

Summary

  • Fix File::Temp Java backend (FileTemp.java) so pathless templates (e.g. XXXXX, fooXXXXXX) create files under the process current working directory, matching stock Perl (perldoc File::Temp: tempfile($template) uses the current directory).
  • Previously the code fell back to java.io.tmpdir, so files were invisible to cwd-relative glob patterns.

Verification

  • ./jcpan -t Config::JSONPASS (including t/Wildcard.t, which uses tempfile + glob '*.include.conf').
  • makePASS.

Context

Config::JSON expands includes with map { glob $_ } @{ $self->get('includes') || [] }. Include paths from File::Temp must live where that glob can see them.

Perl's File::Temp::tempfile($template) creates files in the current
directory when the template has no directory component. The Java
implementation incorrectly used java.io.tmpdir / TMPDIR for that case,
so relative globs (e.g. Config::JSON's glob '*.include.conf') did not
see include files. Align createTempFile/createTempDir with stock Perl.

Fixes jcpan -t Config::JSON (t/Wildcard.t).

Generated with [Cursor](https://cursor.com)

Co-Authored-By: Cursor <cursoragent@cursor.com>
@fglock fglock merged commit a022aec into master May 8, 2026
2 checks passed
@fglock fglock deleted the fix/file-temp-cwd-match-perl branch May 8, 2026 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant