Found during the issue-#11 path audit (2026-11-29).
Problem:_psCreateFolder (src/skel/glfw/glfw.cpp, master ~107–131; same on miami) calls realpath() on a directory that may not exist yet. realpath returns NULL for nonexistent paths and writes to the output buffer only as a glibc side effect — the code works by luck on glibc and would break user-files directory creation on other libcs (musl etc.). Confirmed behavior on the reference glibc: it writes a usable string even for a missing dir, but that is not contractual.
Task: make the directory creation explicit and libc-independent — e.g. mkdir (recursively for the parent chain) before resolving, or construct the path without realpath for the not-yet-existing case — matching the tree's existing POSIX patterns. Both branches.
Acceptance
User-files dir creation works without relying on glibc realpath side effects (demonstrate with a harness against the patched code, as in #11).
No behavior change on Windows.
Found during the issue-#11 path audit (2026-11-29).
**Problem:** `_psCreateFolder` (`src/skel/glfw/glfw.cpp`, master ~107–131; same on miami) calls `realpath()` on a directory that may not exist yet. `realpath` returns NULL for nonexistent paths and writes to the output buffer only as a glibc side effect — the code works **by luck on glibc** and would break user-files directory creation on other libcs (musl etc.). Confirmed behavior on the reference glibc: it writes a usable string even for a missing dir, but that is not contractual.
**Task:** make the directory creation explicit and libc-independent — e.g. `mkdir` (recursively for the parent chain) before resolving, or construct the path without `realpath` for the not-yet-existing case — matching the tree's existing POSIX patterns. Both branches.
## Acceptance
- User-files dir creation works without relying on glibc `realpath` side effects (demonstrate with a harness against the patched code, as in #11).
- No behavior change on Windows.
opencode
added this to the M2: Linux platform hardening milestone 2026-11-29 18:23:06 +00:00
RESOLVED 2026-11-29._psCreateFolder's POSIX branch no longer calls realpath() at all: lstat(path) + mkdir(path, 0755) on the path as given, errno == ENOENT guarded. The reviewer independently confirmed: the old !S_ISDIR(info.st_mode) clause read indeterminate info after a failed lstat (never meaningful — its removal is strictly better); symlink semantics re-derived as no-regression (existing dir / symlink-to-dir: identical behavior; dangling symlink moved from undefined to defined-but-silent); the only live POSIX caller is _psGetUserFilesFolder() → "userfiles" (single-level, cwd-relative — MemoryCard's callers are PS2_MENU-dead).
Published on both branches (fix: _psCreateFolder creates the dir without relying on realpath side effects, glfw.cpp only). Harnesses 12/12 against the real patched body: creates as dir mode 0755, idempotent, cwd-relative, no invented recursion (pre-existing no-nested-creation limitation documented as out of scope — its only live caller is single-level). Windows branch untouched. Reviewer verdict: ship.
**RESOLVED 2026-11-29.** `_psCreateFolder`'s POSIX branch no longer calls `realpath()` at all: `lstat(path)` + `mkdir(path, 0755)` on the path as given, `errno == ENOENT` guarded. The reviewer independently confirmed: the old `!S_ISDIR(info.st_mode)` clause read indeterminate `info` after a failed `lstat` (never meaningful — its removal is strictly better); symlink semantics re-derived as no-regression (existing dir / symlink-to-dir: identical behavior; dangling symlink moved from undefined to defined-but-silent); the only live POSIX caller is `_psGetUserFilesFolder()` → `"userfiles"` (single-level, cwd-relative — MemoryCard's callers are PS2_MENU-dead).
Published on both branches (`fix: _psCreateFolder creates the dir without relying on realpath side effects`, glfw.cpp only). Harnesses 12/12 against the real patched body: creates as dir mode 0755, idempotent, cwd-relative, no invented recursion (pre-existing no-nested-creation limitation documented as out of scope — its only live caller is single-level). Windows branch untouched. Reviewer verdict: **ship**.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Found during the issue-#11 path audit (2026-11-29).
Problem:
_psCreateFolder(src/skel/glfw/glfw.cpp, master ~107–131; same on miami) callsrealpath()on a directory that may not exist yet.realpathreturns NULL for nonexistent paths and writes to the output buffer only as a glibc side effect — the code works by luck on glibc and would break user-files directory creation on other libcs (musl etc.). Confirmed behavior on the reference glibc: it writes a usable string even for a missing dir, but that is not contractual.Task: make the directory creation explicit and libc-independent — e.g.
mkdir(recursively for the parent chain) before resolving, or construct the path withoutrealpathfor the not-yet-existing case — matching the tree's existing POSIX patterns. Both branches.Acceptance
realpathside effects (demonstrate with a harness against the patched code, as in #11).RESOLVED 2026-11-29.
_psCreateFolder's POSIX branch no longer callsrealpath()at all:lstat(path)+mkdir(path, 0755)on the path as given,errno == ENOENTguarded. The reviewer independently confirmed: the old!S_ISDIR(info.st_mode)clause read indeterminateinfoafter a failedlstat(never meaningful — its removal is strictly better); symlink semantics re-derived as no-regression (existing dir / symlink-to-dir: identical behavior; dangling symlink moved from undefined to defined-but-silent); the only live POSIX caller is_psGetUserFilesFolder()→"userfiles"(single-level, cwd-relative — MemoryCard's callers are PS2_MENU-dead).Published on both branches (
fix: _psCreateFolder creates the dir without relying on realpath side effects, glfw.cpp only). Harnesses 12/12 against the real patched body: creates as dir mode 0755, idempotent, cwd-relative, no invented recursion (pre-existing no-nested-creation limitation documented as out of scope — its only live caller is single-level). Windows branch untouched. Reviewer verdict: ship.