fix(libc): match fgetws size and partial-error behavior #9786

Closed
MarcZX10 wants to merge 1 commit from upstream-pr/9786 into main
MarcZX10 commented 2026-10-22 14:57:31 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T14:57:31Z.


What

Implements the two fgetws edge cases supported by the bundled libc.prx disassembly discussed in #8897:

  • A size below two returns null without writing the destination or changing stream error state.
  • If a read error occurs after at least one character was stored, the function null-terminates and returns the partial string while leaving the stream error indicator set.

This keeps the separately unverified fgetwc conversion/state behavior out of scope; #8897 remains open for that discrepancy.

Tested

Linux x86-64, GCC 12.2, Release:

  • Built guest_standard_stream_tests.
  • ctest --test-dir /dev/shm/AnyPS5-fgetws-build -R '^guest_standard_streams' --output-on-failure: 3/3 passed.
  • python3 tools/check_conventions.py --base upstream/main: passed.
  • git diff --check: passed.

PR #9763 also edits GuestStandardStreams.cpp and docs/dev/debt/libc.md; pairwise merge-tree check is clean and its changes are in separate areas.

Checklist

  • Based on current main (b7d1d47a5f9f32c9c388ad8d47a0055a90ae6e33); no open PR implements these fgetws behaviors
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw; silent stubs are documented
  • No investigation notes or images added to the repository
  • No third-party code added
  • Generic behavior, not title-specific
  • Depends on: none
  • Fixes: none (the remaining conversion/state discrepancy keeps #8897 open)
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes (Codex)
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4969447372 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9786). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-22T14:57:31Z. --- ### What Implements the two `fgetws` edge cases supported by the bundled `libc.prx` disassembly discussed in #8897: - A size below two returns null without writing the destination or changing stream error state. - If a read error occurs after at least one character was stored, the function null-terminates and returns the partial string while leaving the stream error indicator set. This keeps the separately unverified `fgetwc` conversion/state behavior out of scope; #8897 remains open for that discrepancy. ### Tested Linux x86-64, GCC 12.2, Release: - Built `guest_standard_stream_tests`. - `ctest --test-dir /dev/shm/AnyPS5-fgetws-build -R '^guest_standard_streams' --output-on-failure`: 3/3 passed. - `python3 tools/check_conventions.py --base upstream/main`: passed. - `git diff --check`: passed. PR #9763 also edits `GuestStandardStreams.cpp` and `docs/dev/debt/libc.md`; pairwise merge-tree check is clean and its changes are in separate areas. ### Checklist - [x] Based on current `main` (`b7d1d47a5f9f32c9c388ad8d47a0055a90ae6e33`); no open PR implements these `fgetws` behaviors - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except technical debt - [x] Unimplemented paths throw; silent stubs are documented - [x] No investigation notes or images added to the repository - [x] No third-party code added - [x] Generic behavior, not title-specific - [x] Depends on: none - [x] Fixes: none (the remaining conversion/state discrepancy keeps #8897 open) - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes (Codex)
github-actions[bot] commented 2026-10-22 14:58:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-22T14:58:01Z.


Thank you for your contribution! Authors with no pull requests merged into main can have 1 open pull request at a time, authors with at least 1 merged can have 20, and from 20 merged there is no limit. This PR has been automatically closed and labeled "open PR limit" because that limit was reached. This is not a judgment of the quality of your changes: reopen it once one of your open pull requests is merged or closed.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6343870728 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9786#issuecomment-6343870728). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-22T14:58:01Z. --- Thank you for your contribution! Authors with no pull requests merged into `main` can have 1 open pull request at a time, authors with at least 1 merged can have 20, and from 20 merged there is no limit. This PR has been automatically closed and labeled "open PR limit" because that limit was reached. This is not a judgment of the quality of your changes: reopen it once one of your open pull requests is merged or closed.
MarcZX10 commented 2026-10-22 15:04:36 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T15:04:36Z.


I traced the intake closure to a case-sensitive GitHub Search qualifier. The workflow interpolates the case-preserved login MarcZX10 in author:${pr.user.login}. The equivalent search for author:MarcZX10 returns 0 merged PRs, while author:marczx10 returns 296 (incomplete_results: false). That makes intake compute zero merged PRs and apply the one-open-PR limit even though the repository rule removes the cap after 20 merges. Normalizing the login in the search qualifier (or using another reliable merged-PR count) should prevent this false closure. The PR description has been corrected; the focused build/tests and local conventions checks pass. I cannot reopen this PR from my current repository permission level.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6344014065 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9786#issuecomment-6344014065). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-22T15:04:36Z. --- I traced the intake closure to a case-sensitive GitHub Search qualifier. The workflow interpolates the case-preserved login `MarcZX10` in `author:${pr.user.login}`. The equivalent search for `author:MarcZX10` returns 0 merged PRs, while `author:marczx10` returns 296 (`incomplete_results: false`). That makes intake compute zero merged PRs and apply the one-open-PR limit even though the repository rule removes the cap after 20 merges. Normalizing the login in the search qualifier (or using another reliable merged-PR count) should prevent this false closure. The PR description has been corrected; the focused build/tests and local conventions checks pass. I cannot reopen this PR from my current repository permission level.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!9786
No description provided.