fix(libkernel): allow changing O_APPEND with fcntl on Windows #4954

Closed
MarcZX10 wants to merge 3 commits from upstream-pr/4954 into main
MarcZX10 commented 2026-10-13 06:12:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-13T06:12:44Z.


What

Carry the Windows fcntl(F_SETFL) implementation in #4941. Changing O_APPEND on a regular file now updates the CRT descriptors for all tracked aliases of the same open file, so the guest can set or clear append mode and observe it through duplicates. Standard descriptors retain the documented unsupported behavior.

The three original commits and David's authorship are preserved; this branch rebases them onto current main.

Tested

  • Current main, Linux Release / GCC 12.2: built guest_kernel_fcntl_tests; guest_kernel_fcntl passed (1/1).
  • MinGW-w64 GCC 12: DescriptorControl.cpp and GuestKernelFcntl.cpp pass -Wall -Wextra -Werror -fsyntax-only with _WIN32 defined.
  • Windows 11 / WinLibs GCC 15.2 results for the same source are reported in #4941: guest_kernel_fcntl passed 5/5, with additional descriptor probes and a 1026/1028 full suite. The two failures were reported to reproduce on the unchanged main baseline; these are the contributor's Windows runtime results, not a run on this Linux host.
  • tools/check_test_registration.py, conventions, and git diff --check pass.
  • A full overlap scan using the current tool fixes in #4944/#4950 checked 470 open PRs and reported no overlap for the combined candidate.

Checklist

  • Based on current main; no other open PR implements the same behavior
  • One topic per PR
  • No comments in code
  • Generic behavior
  • Depends on: none
  • Unblocks: none
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4839166777 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4954). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-13T06:12:44Z. --- ### What Carry the Windows `fcntl(F_SETFL)` implementation in #4941. Changing `O_APPEND` on a regular file now updates the CRT descriptors for all tracked aliases of the same open file, so the guest can set or clear append mode and observe it through duplicates. Standard descriptors retain the documented unsupported behavior. The three original commits and David's authorship are preserved; this branch rebases them onto current `main`. ### Tested - Current main, Linux Release / GCC 12.2: built `guest_kernel_fcntl_tests`; `guest_kernel_fcntl` passed (1/1). - MinGW-w64 GCC 12: `DescriptorControl.cpp` and `GuestKernelFcntl.cpp` pass `-Wall -Wextra -Werror -fsyntax-only` with `_WIN32` defined. - Windows 11 / WinLibs GCC 15.2 results for the same source are reported in #4941: `guest_kernel_fcntl` passed 5/5, with additional descriptor probes and a 1026/1028 full suite. The two failures were reported to reproduce on the unchanged main baseline; these are the contributor's Windows runtime results, not a run on this Linux host. - `tools/check_test_registration.py`, conventions, and `git diff --check` pass. - A full overlap scan using the current tool fixes in #4944/#4950 checked 470 open PRs and reported no overlap for the combined candidate. ### Checklist - [x] Based on current `main`; no other open PR implements the same behavior - [x] One topic per PR - [x] No comments in code - [x] Generic behavior - [x] Depends on: none - [x] Unblocks: none - [x] AI-assisted: yes
xXPBSXx commented 2026-10-13 07:05:47 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-13T07:05:47Z.


Windows test of this PR.

Environment: Windows 10 (19045), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release, BUILD_TESTING=ON, -j2, libusb-cmake from a local checkout. Built from main ea2bbefb2 with this PR and six other open PRs (#4958, #4956, #4954, #4953, #4946, #4942, #4927) merged together; the merges had no conflict.

Result: guest_kernel_fcntl (1 of 1) pass.

Not checked: whether the test fails without the change in the library code; the PR was not tested alone, only in the combined merge (the tests of the other PRs in the batch also pass); no title run; Linux not tested.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6140228125 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4954#issuecomment-6140228125). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-13T07:05:47Z. --- Windows test of this PR. Environment: Windows 10 (19045), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release, `BUILD_TESTING=ON`, `-j2`, `libusb-cmake` from a local checkout. Built from `main` `ea2bbefb2` with this PR and six other open PRs (#4958, #4956, #4954, #4953, #4946, #4942, #4927) merged together; the merges had no conflict. Result: guest_kernel_fcntl (1 of 1) pass. Not checked: whether the test fails without the change in the library code; the PR was not tested alone, only in the combined merge (the tests of the other PRs in the batch also pass); no title run; Linux not tested. AI-assisted (Claude Code).
MarcZX10 commented 2026-10-13 08:11:53 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-13T08:11:53Z.


Thanks for the Windows 10 run. I have recorded it as supplemental evidence: the reported guest_kernel_fcntl pass is from a combined PR build, and it does not include a no-change control. The PR description already distinguishes that from the Linux single-PR run and the Windows 11 source validation.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6141245569 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4954#issuecomment-6141245569). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-13T08:11:53Z. --- Thanks for the Windows 10 run. I have recorded it as supplemental evidence: the reported `guest_kernel_fcntl` pass is from a combined PR build, and it does not include a no-change control. The PR description already distinguishes that from the Linux single-PR run and the Windows 11 source validation.
github-actions[bot] commented 2026-10-13 08:44:40 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-13T08:44:40Z.


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
#5020 docs/dev/debt/libkernel.md L165
#5186 docs/dev/debt/libkernel.md L165-166
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6141787504 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4954#issuecomment-6141787504). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-13T08:44:40Z. --- <!-- pr-overlap --> 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 | |---|---|---|---| | #5020 | `docs/dev/debt/libkernel.md` [L165](https://github.com/boykopovar/AnyPS5/blob/0df6e295c52e7cd6afa394ed35513bd252045c74/docs/dev/debt/libkernel.md#L165) | | | | #5186 | `docs/dev/debt/libkernel.md` [L165-166](https://github.com/boykopovar/AnyPS5/blob/0df6e295c52e7cd6afa394ed35513bd252045c74/docs/dev/debt/libkernel.md#L165-L166) | | |
oneandonlydean commented 2026-10-14 02:33:12 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T02:33:12Z.


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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6159590711 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4954#issuecomment-6159590711). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-14T02:33:12Z. --- 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.

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!4954
No description provided.