Skip to content

fix(libkernel): return EPIPE for writes to closed pipes - #5265

Closed
MarcZX10 wants to merge 2 commits into
boykopovar:mainfrom
MarcZX10:fix/pipe-write-epipe-5246
Closed

MarcZX10 wants to merge 2 commits into
boykopovar:mainfrom
MarcZX10:fix/pipe-write-epipe-5246

Conversation

@MarcZX10

@MarcZX10 MarcZX10 commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

What

Map Windows writes to a pipe with no readers to EPIPE in both the native write path and vectored stdio transfer path. Add a guest regression test for the closed-pipe write behavior.

Tested

Linux: built guest_pipe_closed_write_tests; guest_pipe_closed_write passed (1/1). python3 tools/check_conventions.py --base upstream/main and git diff --check upstream/main passed. Windows-specific error mapping was not executed locally.

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; silent stubs listed under technical debt
  • No notes, investigation .md files or images added to repository
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
  • Tested on Windows: no

husseinkad and others added 2 commits October 13, 2026 15:55
…indows

The UCRT maps ERROR_NO_DATA, which WriteFile reports for a pipe whose read
end is closed, to EINVAL. write, writev, sceKernelWrite and sceKernelWritev
returned EINVAL where FreeBSD's pipe_write returns EPIPE.

(cherry picked from commit 427044c)
@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
#5008 core/libs/prx/libkernel/CMakeLists.txt L1250

@LeandroLP23

Copy link
Copy Markdown
Contributor

Windows check, since this is a Windows-only remap. Setup: Windows 11 (26300), WinLibs GCC 15.2.0, Release, head e0f0350a5 merged onto main 30f961266.

  • With the PR: guest_pipe_closed_write passes.
  • With main's File/src/Open.cpp and File/src/Stdio.cpp and the PR's test: it fails. The test's Require aborts (FATAL: abort() (SIGABRT), exit 0xc0000409), so a write to a pipe whose reader is closed does not give EPIPE there.

AI-assisted: yes (Claude Code)

@MarcZX10

Copy link
Copy Markdown
Contributor Author

Thanks for the Windows control run. The focused test passes with this change and fails with the main source files, which gives useful independent confirmation of the EPIPE path on Windows.

@oneandonlydean

Copy link
Copy Markdown
Collaborator

Closing: no title is known to reach this. With the queue at 700+ open PRs, please hold off on new PRs that don't name a title needing the change until it's down. If a title stops on this on current main, reopen with the title ID and the log line.

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.

4 participants