fix(libc): give an unbuffered stream FreeBSD's one-byte buffer on Windows #12057

Merged
Ragbie merged 2 commits from upstream-pr/12057 into main 2026-11-08 02:30:46 +00:00
Ragbie commented 2026-10-27 17:53:13 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Ragbie on 2026-10-27T17:53:13Z.


What

On Windows a write that follows a read on an unbuffered update stream lands one byte too far. With 0123456789 opened r+b and setvbuf(_IONBF), fgetc then fputs("XY") gives 01XY456789, where FreeBSD and Linux glibc give 0XY3456789. A fread of three bytes then fputs("XY") gives 0123XY6789 instead of 012XY56789.

The UCRT's setvbuf(_IONBF) gives the stream its two-byte _charbuf as the buffer, so a refill reads two bytes. Since #11560, a write after a read follows FreeBSD 11.4's __swsetup: it drops the read buffer and writes at the descriptor's offset. FreeBSD's setvbuf gives an unbuffered stream its one-byte _nbuf (_bf._size = 1, L111-L117), so its descriptor offset stays at the stream position. The UCRT's sits one byte past it.

The change: on Windows, setvbuf with _IONBF sets the UCRT stream's buffer size to 1 after a successful call, under the stream lock. A refill then reads one byte, as on FreeBSD, and fread reads exactly the requested count, which FreeBSD's __fread reaches through one-byte refills. UcrtStreamState gets the three fields up to _bufsiz in the UCRT's __crt_stdio_stream_data layout. Nothing seeks, so this also works on a stream that cannot seek. Linux and macOS are not touched.

The UCRT's own wide reads need two bytes in the buffer, but no guest stream function reaches them: fgetwc, fgetws and the wide scanners decode through the guest's narrow fgetc, and ungetwc calls ungetc. The libc debt entry for writes after reads no longer says unbuffered streams read two bytes ahead.

Tested

Rebased onto main 73f4f7e06. The only conflict was the setvbuf block shared with #12469, resolved as described under Overlaps. On this head:

  • Windows: file_streams and the guest_standard_streams* tests (six in all) pass with --repeat until-fail:5, and the 121 tests matching the pattern below pass with --repeat until-fail:3 except guest_wide_formatting (see below). With main's FileStream.hpp and StandardStreams.cpp and this head's tests, file_streams fails with Write after read wrote other bytes.
  • Linux: the same six tests pass with --repeat until-fail:5, and the 93 tests matching the pattern with --repeat until-fail:3.

The results below are from the earlier base 3ae8209b6.

Windows 11 Pro, Intel Core i5-14600KF, WinLibs GCC 15.2.0, full Release build:

  • file_streams gets two new cases in CheckStreamWritesAfterReads:
    • Each of the nine writers already tested (fwrite, fputs, fputc, putc_unlocked, fprintf, fprintf_s, fputwc, fputws, fwprintf) writes XY after fgetc on an unbuffered r+b stream, and the file must hold 0XY3456789.
    • fputs("XY") after a three-byte fread on an unbuffered r+b stream must give 012XY56789.
  • Without the fix (main's sources): file_streams fails with Write after read wrote other bytes.
  • With the fix:
    • file_streams and the guest_standard_streams tests pass with --repeat until-fail:5.
    • The 97 tests matching stream|stdio|printf|wide|format|fopen|freopen|fclose|fwrite|fread|putw|getw|ungetc|gets|scanf|puts|libc|random|fwide|setvbuf|purge pass with --repeat until-fail:3, except guest_wide_formatting. That test fails on main here too: %Z gives the host's non-ASCII zone name, which #10987 addresses.
    • Full ctest on main 3ae8209b6: 99% tests passed, 3 tests failed out of 2673.
      • guest_wide_formatting, as above.
      • agc_driver_image_plane_address_on_line also fails on main on this machine.
      • agc_driver_mesh_barycentric_emulation fails every time on this machine's NVIDIA GPU with the pixel shader did not emulate barycentrics. #9193 changed that test on 2026-10-27, and it does not use libc streams.
    • check_skips.py reports one skip, guest_fopen_errors. It skips itself on this machine because creating symbolic links needs Developer Mode.

Linux (Ubuntu 24.04 container, GCC 13.3.0), where the change does nothing: the 70 tests matching the same pattern pass with --repeat until-fail:3, including the new cases. Their expectations hold on glibc as on FreeBSD.

macOS: not tested.

Overlaps:

  • #12036 changes SwitchToReadingUnlocked in the same header and adds a test function to the same file. The two merge cleanly and neither needs the other.
  • #10620 edits the neighbouring /dev/random entry in docs/dev/debt/libc.md. Order agreed with its author: this PR first; #10620 lists Depends on: #12057 and keeps this PR's Writes on an update stream entry and its own /dev/random entry on its rebase.
  • #12469, merged first, added buffer = nullptr; to the same _WIN32 block of setvbuf_nid_postfix. The behaviours are independent: with _IONBF UCRT ignores the buffer argument and uses _charbuf, which is what this PR shrinks to one byte. The rebase keeps its line after the two KeepHostStandard* checks and before _lock_file, the shape agreed with its author.

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
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5038639464 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12057). Originally posted by [Ragbie](https://github.com/Ragbie) on 2026-10-27T17:53:13Z. --- ### What On Windows a write that follows a read on an unbuffered update stream lands one byte too far. With `0123456789` opened `r+b` and `setvbuf(_IONBF)`, `fgetc` then `fputs("XY")` gives `01XY456789`, where FreeBSD and Linux glibc give `0XY3456789`. A `fread` of three bytes then `fputs("XY")` gives `0123XY6789` instead of `012XY56789`. The UCRT's `setvbuf(_IONBF)` gives the stream its two-byte `_charbuf` as the buffer, so a refill reads two bytes. Since #11560, a write after a read follows FreeBSD 11.4's [`__swsetup`](https://github.com/freebsd/freebsd-src/blob/release/11.4.0/lib/libc/stdio/wsetup.c#L59-L74): it drops the read buffer and writes at the descriptor's offset. FreeBSD's [`setvbuf`](https://github.com/freebsd/freebsd-src/blob/release/11.4.0/lib/libc/stdio/setvbuf.c#L83-L85) gives an unbuffered stream its one-byte `_nbuf` (`_bf._size = 1`, [L111-L117](https://github.com/freebsd/freebsd-src/blob/release/11.4.0/lib/libc/stdio/setvbuf.c#L111-L117)), so its descriptor offset stays at the stream position. The UCRT's sits one byte past it. The change: on Windows, `setvbuf` with `_IONBF` sets the UCRT stream's buffer size to 1 after a successful call, under the stream lock. A refill then reads one byte, as on FreeBSD, and `fread` reads exactly the requested count, which FreeBSD's [`__fread`](https://github.com/freebsd/freebsd-src/blob/release/11.4.0/lib/libc/stdio/fread.c#L100-L110) reaches through one-byte refills. `UcrtStreamState` gets the three fields up to `_bufsiz` in the UCRT's `__crt_stdio_stream_data` layout. Nothing seeks, so this also works on a stream that cannot seek. Linux and macOS are not touched. The UCRT's own wide reads need two bytes in the buffer, but no guest stream function reaches them: `fgetwc`, `fgetws` and the wide scanners decode through the guest's narrow `fgetc`, and `ungetwc` calls `ungetc`. The libc debt entry for writes after reads no longer says unbuffered streams read two bytes ahead. ### Tested Rebased onto `main` `73f4f7e06`. The only conflict was the `setvbuf` block shared with #12469, resolved as described under Overlaps. On this head: - Windows: `file_streams` and the `guest_standard_streams*` tests (six in all) pass with `--repeat until-fail:5`, and the 121 tests matching the pattern below pass with `--repeat until-fail:3` except `guest_wide_formatting` (see below). With `main`'s `FileStream.hpp` and `StandardStreams.cpp` and this head's tests, `file_streams` fails with `Write after read wrote other bytes`. - Linux: the same six tests pass with `--repeat until-fail:5`, and the 93 tests matching the pattern with `--repeat until-fail:3`. The results below are from the earlier base `3ae8209b6`. Windows 11 Pro, Intel Core i5-14600KF, WinLibs GCC 15.2.0, full Release build: - `file_streams` gets two new cases in `CheckStreamWritesAfterReads`: - Each of the nine writers already tested (`fwrite`, `fputs`, `fputc`, `putc_unlocked`, `fprintf`, `fprintf_s`, `fputwc`, `fputws`, `fwprintf`) writes `XY` after `fgetc` on an unbuffered `r+b` stream, and the file must hold `0XY3456789`. - `fputs("XY")` after a three-byte `fread` on an unbuffered `r+b` stream must give `012XY56789`. - **Without the fix (`main`'s sources):** `file_streams` fails with `Write after read wrote other bytes`. - **With the fix:** - `file_streams` and the `guest_standard_streams` tests pass with `--repeat until-fail:5`. - The 97 tests matching `stream|stdio|printf|wide|format|fopen|freopen|fclose|fwrite|fread|putw|getw|ungetc|gets|scanf|puts|libc|random|fwide|setvbuf|purge` pass with `--repeat until-fail:3`, except `guest_wide_formatting`. That test fails on `main` here too: `%Z` gives the host's non-ASCII zone name, which #10987 addresses. - Full `ctest` on `main` `3ae8209b6`: `99% tests passed, 3 tests failed out of 2673`. - `guest_wide_formatting`, as above. - `agc_driver_image_plane_address_on_line` also fails on `main` on this machine. - `agc_driver_mesh_barycentric_emulation` fails every time on this machine's NVIDIA GPU with `the pixel shader did not emulate barycentrics`. #9193 changed that test on 2026-10-27, and it does not use libc streams. - `check_skips.py` reports one skip, `guest_fopen_errors`. It skips itself on this machine because creating symbolic links needs Developer Mode. Linux (Ubuntu 24.04 container, GCC 13.3.0), where the change does nothing: the 70 tests matching the same pattern pass with `--repeat until-fail:3`, including the new cases. Their expectations hold on glibc as on FreeBSD. macOS: not tested. **Overlaps:** - #12036 changes `SwitchToReadingUnlocked` in the same header and adds a test function to the same file. The two merge cleanly and neither needs the other. - #10620 edits the neighbouring `/dev/random` entry in `docs/dev/debt/libc.md`. Order agreed with its author: this PR first; #10620 lists `Depends on: #12057` and keeps this PR's `Writes on an update stream` entry and its own `/dev/random` entry on its rebase. - #12469, merged first, added `buffer = nullptr;` to the same `_WIN32` block of `setvbuf_nid_postfix`. The behaviours are independent: with `_IONBF` UCRT ignores the buffer argument and uses `_charbuf`, which is what this PR shrinks to one byte. The rebase keeps its line after the two `KeepHostStandard*` checks and before `_lock_file`, the shape agreed with its author. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
MarcZX10 commented 2026-10-27 18:13:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-27T18:13:18Z.

Review: CHANGES_REQUESTED


The Windows-specific implementation and test changes look coherent on inspection: the added UcrtStreamState fields match the UCRT layout, the stream is locked around setvbuf and the _bufsiz adjustment, and the new cases cover both fgetc and fread followed by writes. I also verified that the pairwise merge of #12036 and this PR is clean, and the current-main merge preview for this PR is clean.

There is one repository-rule blocker to resolve before approval. #10620 is still open and edits the same Writes on an update stream entry in docs/dev/debt/libc.md. I confirmed that merging the current #10620 and #12057 heads conflicts in that file. Your description notes the overlap but does not say which PR goes first or record an agreed order; the checklist still says Depends on: none. CONTRIBUTING.md requires agreeing the order with the overlapping author and declaring it on the checklist. Please coordinate the order with #10620’s author and update the dependency/checklist plus the combined debt wording accordingly.

Local validation: file_streams_tests built on Linux with the added tests, but its QEMU run stopped in guest-path setup because QEMU returned ENOSYS for process_vm_readv; this is an emulator limitation, not a test assertion result. Your Windows runtime results are therefore the available runtime evidence here; hosted Windows passes and the other completed CI jobs are green. macOS jobs are still queued.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5672137871 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12057#pullrequestreview-5672137871). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-27T18:13:18Z. **Review:** CHANGES_REQUESTED --- The Windows-specific implementation and test changes look coherent on inspection: the added `UcrtStreamState` fields match the UCRT layout, the stream is locked around `setvbuf` and the `_bufsiz` adjustment, and the new cases cover both `fgetc` and `fread` followed by writes. I also verified that the pairwise merge of #12036 and this PR is clean, and the current-main merge preview for this PR is clean. There is one repository-rule blocker to resolve before approval. #10620 is still open and edits the same `Writes on an update stream` entry in `docs/dev/debt/libc.md`. I confirmed that merging the current #10620 and #12057 heads conflicts in that file. Your description notes the overlap but does not say which PR goes first or record an agreed order; the checklist still says `Depends on: none`. `CONTRIBUTING.md` requires agreeing the order with the overlapping author and declaring it on the checklist. Please coordinate the order with #10620’s author and update the dependency/checklist plus the combined debt wording accordingly. Local validation: `file_streams_tests` built on Linux with the added tests, but its QEMU run stopped in guest-path setup because QEMU returned `ENOSYS` for `process_vm_readv`; this is an emulator limitation, not a test assertion result. Your Windows runtime results are therefore the available runtime evidence here; hosted Windows passes and the other completed CI jobs are green. macOS jobs are still queued.
MarcZX10 commented 2026-10-29 00:12:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T00:12:18Z.

Review: CHANGES_REQUESTED


Reviewed — changes requested

The merge order with #10620 and #12469 is now recorded, but #12057 still needs rebase and focused retesting because current main changed both FileStream.hpp and the shared debt file.

What I ran

Reviewed exact head b03facfbd4ab0e7dee657cd827d6806cf99d19a0; its merge base with current main is 3ae8209b643be054ef09542f9e9e5e951b1ed73b. The individual merge preview onto current main is clean. The pairwise merge with #10620 still conflicts only in docs/dev/debt/libc.md, consistent with the now-recorded order of #12057 first and #10620 after it. Environment: Linux x86-64, Git and GitHub CLI. I did not rerun the build or runtime tests in this re-check.

git fetch https://github.com/boykopovar/AnyPS5.git main:refs/review/main-20261029 refs/pull/12057/head:refs/review/pr-12057-20261029 refs/pull/10620/head:refs/review/pr-10620-20261029
git merge-base refs/review/main-20261029 refs/review/pr-12057-20261029
git merge-tree --write-tree refs/review/main-20261029 refs/review/pr-12057-20261029
git merge-tree --write-tree refs/review/pr-12057-20261029 refs/review/pr-10620-20261029
base=$(git merge-base refs/review/main-20261029 refs/review/pr-12057-20261029)
comm -12 <(git diff --name-only "$base" refs/review/main-20261029 | sort) <(git diff --name-only "$base" refs/review/pr-12057-20261029 | sort)

Results

Check Result
Current-main merge preview Clean
Touched paths changed on current main since merge base core/libs/prx/libc/include/FileStream.hpp and docs/dev/debt/libc.md
#12057/#10620 merge order Author agreement now says #12057 first; #10620 records Depends on: #12057
Pairwise preview Expected debt-file conflict remains until #10620 rebases after #12057
Focused runtime tests Prior Windows results and controls are author-provided; not rerun here
Local build/tests Not run in this re-check
Command output
head=b03facfbd4ab0e7dee657cd827d6806cf99d19a0
merge-base=3ae8209b643be054ef09542f9e9e5e951b1ed73b
current-main-merge-preview=601cd79ef7f2338b5e7c83fafd43a57fd1bfe979
PR files changed since merge-base:
core/libs/prx/libc/include/FileStream.hpp
docs/dev/debt/libc.md
overlap merge with #10620:
CONFLICT (content): Merge conflict in docs/dev/debt/libc.md

Negative control

Assertion Change to code under test Outcome
Writes after reads on an unbuffered update stream fail without the implementation No new control run by me; the PR description reports that main's sources fail and the PR sources pass The reported control was not independently reproduced in this re-check

Findings

Blocking

  • The branch's common ancestor with current main is 3ae8209b643b, and current main has since changed FileStream.hpp and docs/dev/debt/libc.md, both touched by this PR. The merge preview is clean, but the integrated code and test evidence need to be refreshed on the current branch.

Non-blocking

  • The previously open sequencing concern is resolved: #12057 goes first, and #10620 now records that dependency. The current pairwise debt conflict is the expected pre-merge state for that sequence.

Sources

Not verified

  • I did not build or rerun file_streams on this head, and I did not run a native PS5 test. The earlier Linux/QEMU attempt stopped in setup because QEMU returned ENOSYS for process_vm_readv; that is not a test assertion result.
  • The hosted Windows job passes; Linux product is skipped and macOS relinker/specialized jobs are not relevant to the libc stream change.

To get this to a good state

Rebase #12057 onto current main, retain #12057-first wording in both PR descriptions and preserve the current-main debt text. Rerun file_streams and guest_standard_streams on the new head and record exact commands/results. I will re-check the changed code and repeat the locally available focused validation.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5691320547 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12057#pullrequestreview-5691320547). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-29T00:12:18Z. **Review:** CHANGES_REQUESTED --- # Reviewed — changes requested The merge order with #10620 and #12469 is now recorded, but #12057 still needs rebase and focused retesting because current `main` changed both `FileStream.hpp` and the shared debt file. ## What I ran Reviewed exact head `b03facfbd4ab0e7dee657cd827d6806cf99d19a0`; its merge base with current `main` is `3ae8209b643be054ef09542f9e9e5e951b1ed73b`. The individual merge preview onto current `main` is clean. The pairwise merge with #10620 still conflicts only in `docs/dev/debt/libc.md`, consistent with the now-recorded order of #12057 first and #10620 after it. Environment: Linux x86-64, Git and GitHub CLI. I did not rerun the build or runtime tests in this re-check. ```sh git fetch https://github.com/boykopovar/AnyPS5.git main:refs/review/main-20261029 refs/pull/12057/head:refs/review/pr-12057-20261029 refs/pull/10620/head:refs/review/pr-10620-20261029 git merge-base refs/review/main-20261029 refs/review/pr-12057-20261029 git merge-tree --write-tree refs/review/main-20261029 refs/review/pr-12057-20261029 git merge-tree --write-tree refs/review/pr-12057-20261029 refs/review/pr-10620-20261029 base=$(git merge-base refs/review/main-20261029 refs/review/pr-12057-20261029) comm -12 <(git diff --name-only "$base" refs/review/main-20261029 | sort) <(git diff --name-only "$base" refs/review/pr-12057-20261029 | sort) ``` ## Results | Check | Result | |---|---| | Current-main merge preview | Clean | | Touched paths changed on current main since merge base | `core/libs/prx/libc/include/FileStream.hpp` and `docs/dev/debt/libc.md` | | #12057/#10620 merge order | Author agreement now says #12057 first; #10620 records `Depends on: #12057` | | Pairwise preview | Expected debt-file conflict remains until #10620 rebases after #12057 | | Focused runtime tests | Prior Windows results and controls are author-provided; not rerun here | | Local build/tests | Not run in this re-check | <details> <summary>Command output</summary> ```text head=b03facfbd4ab0e7dee657cd827d6806cf99d19a0 merge-base=3ae8209b643be054ef09542f9e9e5e951b1ed73b current-main-merge-preview=601cd79ef7f2338b5e7c83fafd43a57fd1bfe979 PR files changed since merge-base: core/libs/prx/libc/include/FileStream.hpp docs/dev/debt/libc.md overlap merge with #10620: CONFLICT (content): Merge conflict in docs/dev/debt/libc.md ``` </details> ## Negative control | Assertion | Change to code under test | Outcome | |---|---|---| | Writes after reads on an unbuffered update stream fail without the implementation | No new control run by me; the PR description reports that main's sources fail and the PR sources pass | The reported control was not independently reproduced in this re-check | ## Findings ### Blocking - The branch's common ancestor with current `main` is `3ae8209b643b`, and current `main` has since changed `FileStream.hpp` and `docs/dev/debt/libc.md`, both touched by this PR. The merge preview is clean, but the integrated code and test evidence need to be refreshed on the current branch. ### Non-blocking - The previously open sequencing concern is resolved: #12057 goes first, and #10620 now records that dependency. The current pairwise debt conflict is the expected pre-merge state for that sequence. ## Sources - [Current contribution rules for branch freshness and overlap order](https://github.com/boykopovar/AnyPS5/blob/3a2b91981651569163768854a1fcdc7193b6667b/CONTRIBUTING.md#L57-L67) - [#12057 implementation at the reviewed head](https://github.com/boykopovar/AnyPS5/tree/b03facfbd4ab0e7dee657cd827d6806cf99d19a0/core/libs/prx/libc) - [#10620 records its dependency on #12057](https://github.com/boykopovar/AnyPS5/pull/10620) ## Not verified - I did not build or rerun `file_streams` on this head, and I did not run a native PS5 test. The earlier Linux/QEMU attempt stopped in setup because QEMU returned `ENOSYS` for `process_vm_readv`; that is not a test assertion result. - The hosted Windows job passes; Linux product is skipped and macOS relinker/specialized jobs are not relevant to the libc stream change. ## To get this to a good state Rebase #12057 onto current `main`, retain #12057-first wording in both PR descriptions and preserve the current-main debt text. Rerun `file_streams` and `guest_standard_streams` on the new head and record exact commands/results. I will re-check the changed code and repeat the locally available focused validation.
MarcZX10 commented 2026-10-31 16:47:28 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-31T16:47:28Z.

Review: APPROVED


Re-checked — looks good

The rebased head addresses the earlier freshness and focused-test follow-up; the current-main preview is clean and the changed Windows stream test passes in CI.

What I ran

Reviewed head a745546f030f310044b3004cf5354498a30c997f against current base 474030e58424fefdb65e5df9f3820810fbb4553c. The merge preview is clean. The five commits added to main after the author’s stated rebase touched no paths changed by this PR. Environment: Linux x86-64, Python 3.11.2, Git 2.39.5; I did not build locally.

python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 12057 --output-dir /tmp/anyps5-12057-precheck
gh run view 41216979773 --repo boykopovar/AnyPS5 --job 124583469802 --log | grep -E 'file_streams|guest_standard_streams|Test.*passed|tests failed|Error:|error:' | tail -35
gh run view 41216979773 --repo boykopovar/AnyPS5 --job 124583469789 --log | grep -E 'FAILED|Failed|failed|error:|Error:|write.watch|write_watch' | tail -25
gh api repos/boykopovar/AnyPS5/compare/73f4f7e06e4f210a8c6570e335fd654dc0a86134...474030e58424fefdb65e5df9f3820810fbb4553c --jq '{status,ahead_by,behind_by,files:[.files[].filename]}'

Results

Check Result
Diff check and conventions Passed in the no-build precheck.
Current-main merge preview Clean. Main advanced five commits beyond the stated rebase; none changed this PR’s paths.
Windows CI The changed file_streams target passed; the changed-test step reports 2,523/2,523 selected tests passed.
Windows and Linux focused repeats Author reports the six focused stream tests passing five times on both systems; the wider Windows set had one known main failure (guest_wide_formatting), and the wider Linux set passed.
macOS write-watch job Failed during CMake configuration because write_watch_read-fault was registered twice; this PR changes no write-watch files.
Local build/tests Not run. The precheck’s ABI and test-quality helpers are absent from its isolated PR archive; its stack helper also emitted a self-cycle despite the PR declaring Depends on: none. The direct merge preview above is clean.
Selected hosted CI output
windows	Build and run changed guest core/libs tests	2026-10-31T16:05:04.2589495Z [120/1519] Building CXX object core/libs/prx/libc/CMakeFiles/file_streams_tests.dir/__/__/tests/FileStreams.cpp.obj
windows	Build and run changed guest core/libs tests	2026-10-31T16:08:06.9403803Z [918/1519] Linking CXX executable tests\file_streams_tests.exe
windows	Build and run changed guest core/libs tests	2026-10-31T16:11:34.3850248Z  262/2523 Test  #665: file_streams .............................................................   Passed    0.31 sec
windows	Build and run changed guest core/libs tests	2026-10-31T16:13:33.6395934Z 100% tests passed, 0 tests failed out of 2523
write-watch (macos-15-intel)	Run cmake -S core/libs/tests/write_watch -B build/write-watch -DCMAKE_BUILD_TYPE=Release	2026-10-31T15:57:24.6110340Z   add_test given test NAME "write_watch_read-fault" which already exists in

Negative control

Assertion Change to code under test Outcome
An unbuffered update-stream write follows the stream position after a read Author reports restoring FileStream.hpp and StandardStreams.cpp from main while retaining this head’s tests file_streams reportedly failed with Write after read wrote other bytes; I did not independently rerun the control.

Findings

Blocking

None found on the reviewed head.

Non-blocking

The macOS write-watch job needs its duplicate CMake test registration resolved in the workflow/test setup; it does not involve files changed by this PR.

Sources

Not verified

I did not build or run Linux/macOS tests locally, repeat the author’s reported Linux runs, or independently reproduce the negative control. The macOS write-watch job failed at CMake configure time as shown above.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5723836944 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12057#pullrequestreview-5723836944). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-31T16:47:28Z. **Review:** APPROVED --- # Re-checked — looks good The rebased head addresses the earlier freshness and focused-test follow-up; the current-main preview is clean and the changed Windows stream test passes in CI. ## What I ran Reviewed head `a745546f030f310044b3004cf5354498a30c997f` against current base `474030e58424fefdb65e5df9f3820810fbb4553c`. The merge preview is clean. The five commits added to `main` after the author’s stated rebase touched no paths changed by this PR. Environment: Linux x86-64, Python 3.11.2, Git 2.39.5; I did not build locally. ```sh python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 12057 --output-dir /tmp/anyps5-12057-precheck gh run view 41216979773 --repo boykopovar/AnyPS5 --job 124583469802 --log | grep -E 'file_streams|guest_standard_streams|Test.*passed|tests failed|Error:|error:' | tail -35 gh run view 41216979773 --repo boykopovar/AnyPS5 --job 124583469789 --log | grep -E 'FAILED|Failed|failed|error:|Error:|write.watch|write_watch' | tail -25 gh api repos/boykopovar/AnyPS5/compare/73f4f7e06e4f210a8c6570e335fd654dc0a86134...474030e58424fefdb65e5df9f3820810fbb4553c --jq '{status,ahead_by,behind_by,files:[.files[].filename]}' ``` ## Results | Check | Result | |---|---| | Diff check and conventions | Passed in the no-build precheck. | | Current-main merge preview | Clean. Main advanced five commits beyond the stated rebase; none changed this PR’s paths. | | Windows CI | The changed `file_streams` target passed; the changed-test step reports 2,523/2,523 selected tests passed. | | Windows and Linux focused repeats | Author reports the six focused stream tests passing five times on both systems; the wider Windows set had one known main failure (`guest_wide_formatting`), and the wider Linux set passed. | | macOS write-watch job | Failed during CMake configuration because `write_watch_read-fault` was registered twice; this PR changes no write-watch files. | | Local build/tests | Not run. The precheck’s ABI and test-quality helpers are absent from its isolated PR archive; its stack helper also emitted a self-cycle despite the PR declaring `Depends on: none`. The direct merge preview above is clean. | <details><summary>Selected hosted CI output</summary> ```text windows Build and run changed guest core/libs tests 2026-10-31T16:05:04.2589495Z [120/1519] Building CXX object core/libs/prx/libc/CMakeFiles/file_streams_tests.dir/__/__/tests/FileStreams.cpp.obj windows Build and run changed guest core/libs tests 2026-10-31T16:08:06.9403803Z [918/1519] Linking CXX executable tests\file_streams_tests.exe windows Build and run changed guest core/libs tests 2026-10-31T16:11:34.3850248Z 262/2523 Test #665: file_streams ............................................................. Passed 0.31 sec windows Build and run changed guest core/libs tests 2026-10-31T16:13:33.6395934Z 100% tests passed, 0 tests failed out of 2523 write-watch (macos-15-intel) Run cmake -S core/libs/tests/write_watch -B build/write-watch -DCMAKE_BUILD_TYPE=Release 2026-10-31T15:57:24.6110340Z add_test given test NAME "write_watch_read-fault" which already exists in ``` </details> ## Negative control | Assertion | Change to code under test | Outcome | |---|---|---| | An unbuffered update-stream write follows the stream position after a read | Author reports restoring `FileStream.hpp` and `StandardStreams.cpp` from `main` while retaining this head’s tests | `file_streams` reportedly failed with `Write after read wrote other bytes`; I did not independently rerun the control. | ## Findings ### Blocking None found on the reviewed head. ### Non-blocking The macOS write-watch job needs its duplicate CMake test registration resolved in the workflow/test setup; it does not involve files changed by this PR. ## Sources - [Implementation at reviewed head](https://github.com/boykopovar/AnyPS5/blob/a745546f030f310044b3004cf5354498a30c997f/core/libs/prx/libc/src/StandardStreams.cpp) - [Regression tests at reviewed head](https://github.com/boykopovar/AnyPS5/blob/a745546f030f310044b3004cf5354498a30c997f/core/libs/tests/FileStreams.cpp) - [Author’s updated test report](https://github.com/boykopovar/AnyPS5/pull/12057#issuecomment-6545678608) ## Not verified I did not build or run Linux/macOS tests locally, repeat the author’s reported Linux runs, or independently reproduce the negative control. The macOS write-watch job failed at CMake configure time as shown above.
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!12057
No description provided.