Skip to content

Tests: 16 tests abort when TEMP has a character outside the ANSI code page (host std::tmpfile returns NULL) #13083

Closed

Description

@bunbeans2-arch

What happens

16 C++ tests abort on Windows when %TEMP% contains a character outside the ANSI code page, as it does for a profile like C:\Users\Жанна on a code page 1252 system. Each of them gets a scratch stream from the host std::tmpfile(). UCRT builds that file under GetTempPathA, which turns the character into ?. So tmpfile() returns NULL with errno 22, and the test aborts with FileStream: null handle or cannot open a temporary file for stderr.

A path with spaces alone, or with a character inside the code page (é), is fine. These are test-only failures as far as I can see: no non-test .cpp under core/libs/prx calls tmpfile, and the runtime temporary paths I read (Jit.cpp, SharedMemory.cpp) go through temp_directory_path and CreateFileW.

Title, test or build step

guest_binary_word, guest_stream_purge, file_position, guest_wide_stream_scan, guest_stdio_variadic, guest_standard_streams, guest_gets, file_stream_status, file_streams, guest_syslog, guest_err, guest_getopt, np_trophy2_store, guest_np_trophy_stats, guest_raise_in_host_code, guest_filesystem

AnyPS5 commit

2960e9a, where 74 std::tmpfile() calls sit in 28 test files under core. GuestBinaryWord.cpp and TrophyStore.cpp still call it on main 76fd1c0.

System

Windows 11 Pro 10.0.22631, ANSI code page 1252, MSYS2 UCRT64 GCC 16.1.0, Release, BUILD_TESTING=ON, Python 3.13.

Steps to reproduce

From Git Bash, with any existing directory whose name has a character outside the code page:

TEMP='D:\x\zh_Ж' TMP='D:\x\zh_Ж' ctest --test-dir build -R '^(guest_binary_word|guest_gets|np_trophy2_store)$' --output-on-failure

The same tests pass with TEMP=C:\x\sp ace and with TEMP=C:\x\e_é.

Log

terminate called after throwing an instance of 'std::runtime_error'
  what():  FileStream: null handle
FATAL: abort() (SIGABRT) on thread 25560

A small probe built with the same toolchain (std::tmpfile(), then GetTempPathA):

TEMP=...\e_é   acp=1252 tmpfile=ok   errno=0   GetTempPathA=...\e_<e9>\ exists=1
TEMP=...\zh_Ж  acp=1252 tmpfile=NULL errno=22  GetTempPathA=...\zh_?\  exists=0
                                               temp_directory_path exists=1

What was checked

  • Non-GPU suite (1717 tests, network tests excluded) with TEMP=TMP=<dir>\tmp Жé: all 16 tests fail in 3 of 3 runs. They pass with the normal TEMP, with TEMP=<dir>\sp ace and with TEMP=<dir>\e_é.
  • Every one of the 16 test sources calls std::tmpfile(). A shared test helper that opens a scratch file under std::filesystem::temp_directory_path() with _wfopen on Windows would cover them. I have not written or run that fix.
  • Not the same as fix(tests): pass guest_system_font, exec_arguments and unwrap_self under a non-ASCII TEMP on Windows #12993 and fix(diagnostics): open VideoOut telemetry and sampler files under any Unicode path on Windows #12996, which cover characters inside the code page (tëmp) through fopen(path.string()) and getenv. Under é those tests fail here too, and these 16 do not.
  • Also seen under Ж, not part of this issue: the Python tool tests that run cmake, gcc or objdump on files under TEMP (check_compile_*, select_tests*, configure_seed*, annotate_module) fail at that step. as and objdump report the path with ? (can't create ...\zh_?\...\unit.o), so these look like a MinGW toolchain limit. pad_timeline and pr_overlap_export_cache fail with é too on Python 3.13. Their logs show the UTF-8 path decoded as cp1252 (Ж).
  • Not run: the agc_* GPU tests under this TEMP (several also call std::tmpfile()), Linux and macOS.
  • TZ IST-5:30 and NZST-12NZDT, LANG=LC_ALL=de_DE.UTF-8, and USERPROFILE=HOME=<dir>\home dir caused no new failures in the same suite.

AI-assisted: yes (Claude Code)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions