Skip to content

fix(libSceLibcInternal): fail posix_spawn with ENOENT when the program is not there - #6233

Merged
adriadam10 merged 1 commit into
boykopovar:mainfrom
milescoviello:fix/spawn-missing-program
Oct 18, 2026
Merged

adriadam10 merged 1 commit into
boykopovar:mainfrom
milescoviello:fix/spawn-missing-program

Conversation

@milescoviello

@milescoviello milescoviello commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

What

Dusklight (PPSA99305, catalog 1.0.0) aborts on main d92a8da as soon as Select disc image is chosen on its first menu, with no disc image in its folder:

terminate called after throwing an instance of 'std::runtime_error'
  what():  posix_spawnp: process creation not implemented

With a temporary print in posix_spawnp (not part of this PR), the title calls it twice with file zenity, arguments zenity --version and three file actions. Its next log line names SDL's file dialog: File selection failed: File dialog driver unsupported (supported values for SDL_HINT_FILE_DIALOG_DRIVER are 'zenity' and 'portal'). The port's own patch says the console has no file dialog (dusklight.patch); it takes a disc image from its folder instead.

FreeBSD 11.4's posix_spawn returns the error the child's exec leaves, and writes the process ID only when the exec succeeds (_posix_spawn_thr, do_posix_spawn). posix_spawnp searches PATH, or _PATH_DEFPATH when it is unset, and fails with ENOENT when no directory holds the program (_execvpe, execvPe).

Both calls now look for the program in the guest file system the same way. When it is not there they return ENOENT without writing the process ID; when it is there they still throw, since no process is created. This is the same model system already uses (a sandbox without /bin/sh). The attributes and file actions are not applied, and whether the console lets the child be created at all is unverified; docs/dev/debt/libSceLibcInternal.md records both.

guest_posix_spawn now spawns an existing and a missing program by path, through a PATH search (including an empty entry, which means the working directory) and with PATH unset.

Tested

Ubuntu 24.04, GCC 13.3, Release, on main d92a8da:

  • guest_posix_spawn passes 3/3. With main's Spawn.cpp and the new checks, it fails 3/3 with posix_spawn: process creation not implemented for the missing program.
  • All 376 guest_* tests pass or skip; the 5 guest_video_out_* skips are their own no-display check.
  • PPSA99305 1.0.0, relinked with --to-intel and run with pad input from 8 s (RTX 4070 Ti, NVIDIA 595.99): on main it aborts at 8–9 s in 3 of 3 runs, at the first Cross press. With this change, 6 of 7 runs reach the 30–45 s limit: the title logs File selection failed, stays on its menu, and opens and moves through its Settings window (seen in screenshots). One run exited with code 0 at 11 s. Choosing the title's own Quit item gives the same exit; I did not capture which item that run chose.
  • Wind Waker (PPSA99309), the other title the old debt entry names, exits by itself at 2 s with no disc image ("no game found") and does not reach this call.
  • tools/check_conventions.py --base upstream/main passes, and tools/pr_overlap.py --branch fix/spawn-missing-program finds no overlap.

On Windows 11 (RTX 3070, NVIDIA 610.60, MinGW), @DavidSamir ran Dusklight with this PR merged onto main 4eb91ea. main aborts at the first Cross with posix_spawnp: process creation not implemented. With this PR, a Cross-only run logs File selection failed 79 times and is still running at its 150 s limit, and a mixed button sequence exits with code 0 at 16 s after reaching the menu's Quit, whose handler only sets IsRunning = false (comment). That also accounts for my one code-0 run.

Not checked on a console.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Unblocks: none
  • AI-assisted: yes

🤖 Generated with Claude Code

@milescoviello milescoviello changed the title fix(libSceLibcInternal): fail posix_spawn with ENOENT when the program is not there — Dusklight (PPSA99305) fix(libSceLibcInternal): fail posix_spawn with ENOENT when the program is not there Oct 15, 2026
@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 5021 docs/dev/debt/libSceLibcInternal.md
PR 6044 core/libs/tests/GuestPosixSpawn.cpp
PR 6447 core/libs/prx/libSceLibcInternal/Spawn.cpp
docs/dev/debt/libSceLibcInternal.md

@DavidSamir

Copy link
Copy Markdown
Contributor

Windows result for this PR, with Dusklight (PPSA99305, catalog 1.0.0).

Setup: Windows 11, RTX 3070 (NVIDIA 610.60), MinGW build. This PR's head 3d42bdf merged onto main 4eb91ea. Relinked with --windows --registry, then run with pad input through APS5_PAD_INPUT_FILE, starting about 12 s after launch.

  • main (b7cedd9; Spawn.cpp is the same on 4eb91ea): aborts at 7 s, at the first Cross press.
    terminate called after throwing an instance of 'std::runtime_error'
      what():  posix_spawnp: process creation not implemented
    
  • This PR, mixed button sequence (Cross, Down, Cross, Right, Cross, Circle, …): the title logs File selection failed: File dialog driver unsupported (supported values for SDL_HINT_FILE_DIALOG_DRIVER are 'zenity' and 'portal') 3 times and stays on its menu. It then exits with code 0 at 16 s, logging exit status 0: asking the shell to close the title.
  • This PR, Cross only (a Cross press every 1.2 s for 150 s): the title logs File selection failed 79 times and is still running when the 150 s limit stops it. It has no what() line and no exit.

On the code-0 exit you saw once: the prelaunch menu at the pinned dusklight commit 34a144a49 has Select Disc Image, Settings, Mods and Quit. Quit's handler only sets IsRunning = false (prelaunch.cpp). The Cross-only run never leaves Select Disc Image and never exits. So in my runs the code-0 exit comes from the mixed sequence reaching Quit, not from this change.

AI-assisted: yes

@milescoviello

Copy link
Copy Markdown
Contributor Author

@DavidSamir thanks for the Windows run, and for tracing the code-0 exit to the menu's Quit. That explains my one odd run too. I added your result to the description.

AI-assisted: yes (Claude Code)

…m is not there

Dusklight (PPSA99305) aborts on main as soon as its Select disc image
item is chosen: SDL's file dialog probes "zenity --version" through
posix_spawnp, and posix_spawnp throws "process creation not implemented".

FreeBSD 11.4's posix_spawn returns the error of the child's exec, and
an exec of a program that is in no directory of PATH (_PATH_DEFPATH
when PATH is unset) fails with ENOENT. Both calls now return ENOENT
without writing the process ID when the program is not in the guest
file system, and keep throwing when it is. SDL then reports the file
dialog as unsupported and the title stays on its menu.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@milescoviello
milescoviello force-pushed the fix/spawn-missing-program branch from 3d42bdf to a7c68a3 Compare October 17, 2026 18:32
@adriadam10 adriadam10 self-assigned this Oct 18, 2026
@adriadam10
adriadam10 merged commit 6e27fc8 into boykopovar:main Oct 18, 2026
8 checks passed
@adriadam10 adriadam10 mentioned this pull request Oct 18, 2026
7 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants