feat(libc): implement strmode #11664
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/11664"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by B-Howell on 2026-10-27T02:01:08Z.
What
Implement the BSD
strmodeexport incore/libs/prx/libc/src/StringExtensions.cpp, decoding the mode into the twelve-bytels -lpermissions string as FreeBSD 11.4lib/libc/string/strmode.cdoes: file-type character from the top four bits, threerwxtriples,s/Sandt/Tfor the setuid/setgid/sticky combinations with the matching execute bit, a space in the ACL slot and a trailing NUL. Declaration added tocore/libs/prx/libc/include/Api.hppbeside the other string exports.Signature takes
intto match the FreeBSD 11.4<string.h>prototypevoid strmode(/* mode_t */ int, char *)and the project's sibling guestchmodandfchmodexports; the consolemode_twidth and register-width expectations are unverified and the doc entry records that uncertainty.Extend
core/libs/tests/GuestStrings.cppto cover a directory, a regular file, a symlink, everys/S/t/Tsetuid/setgid/sticky combination against the matching execute bit, each non-regular file-type character (c,b,p,s,w) and the?fallback.Document the export in
docs/dev/debt/libc.mdwith the registry NIDUo-nB2s+1+A; console behavior is unverified.Tested
Main refresh at
a4ac7624a923(2026-11-01)Head
a4ac7624a9236910ce1fdc9b27facc34ddb5f143/ treed49f8b1d74f78b7d04111f838d249c0f38f18d5bordinarily merges previous public head000ed8ddbfc4b67ca67b8ed3d034e0f06521741bwith upstream mainb6e3f68173c767f692f6c04eef04c73eab424e04. #13220 has landed: its original commite9f09f54fabb6408d3e2711b8df10c10112ab00eis an ancestor of that main, so the write-watch registration fix now comes from main and this PR no longer changescore/libs/tests/write_watch/CMakeLists.txt. The remaining diff against main is the four owned files (Api.hpp,StringExtensions.cpp,GuestStrings.cpp,docs/dev/debt/libc.md); its added and removed lines in those files are identical to the previous head's changes. Git's three-way merge was clean; GitHub reported the previous head as conflicting, and a merge using only the older main base conflicts on that shared CMake file.tools/check_conventions.pyfrom this main passed against this head. No new local build or runtime result is claimed for this head; hosted CI at this head is pending after push. Earlier results below keep their original pins.Main refresh at
22159353aa90Head
22159353aa90627dedc7e3fb501250e5940c9b48, tree235fc990fc5a31f682b1df7d23a9319c5ae28391, ordinarily mergese3c44ac2c60f26c7cbb0c42b447c4d4d61d0fd32with mainc0fb4a6aad1012b7e2abecaf2949e3d26c0e525d, observed at 2026-10-30 20:15:30 UTC; published6fc8bc373f486b49053870e519b0eba643784f37remains an ancestor. This is the documented main baseline for this refresh; later remote-main advances are not certified. The four owned contribution files and their additions remain unchanged. Earlier evidence below keeps its original pins.Fresh Windows/WinLibs GCC 15.2.0 r7 (CMake 4.4.4/Ninja 1.13.2) and WSL Ubuntu 22.04/GCC 11.4 (CMake 3.22.1/Ninja 1.10.1), Release: both configurations and
cmake --build <fresh-cache> --target guest_string_tests guest_formatting_tests nid_patcher --parallel 2pass.ctest --test-dir <fresh-cache> -R '^(guest_strings|guest_formatting|public_headers)$' -V -j1 --repeat until-fail:3 --timeout 30 --no-tests=errorpasses 18 selected executions at this exact head across both OS = 12 native guest runs + 6 audit-only header runs, with no failures/skips. Builds/OS arms were serial, at most two build jobs. Same-arm production-library binding and Release-active checks were verified, including the existing formatting regression and actual changed-kernel dependency.The #11664-before-#10270 order is author-confirmed. Reviewer acceptance, later combined validation and actual upstream landing remain separate. The historical hosted
web_releasetimeout and Darwin masked-store failure remain unresolved at their original heads; they are not results for22159353aa90.The audit-only case retains its generated 90-second timeout; the 64 header compile batches are excluded. At the 2026-10-30 exact-head readiness audit, 11 latest named checks completed successfully, Linux was skipped, and six macOS checks were queued; no current failed check was reported. Skipped or queued checks are not passes. No new console, GPU, title, macOS, whole-product or full-suite result is claimed.
Current-main integration
6fc8bc373f486b49053870e519b0eba643784f37, tree4da828c67c90715473314f535e208dc69583af0e, ordinarily merges frozen main3679074dd61aa6a899a00c19ce2e450b1cacfb60into published30abbd1be32adfe2ffe9f3f2de06dc053bad27a4. Owned strmode implementation, declaration and fixture additions are unchanged. Existing clean worktree-specific submodules were aligned to this main's committed pins before the build.Windows 11, WinLibs GCC 15.2.0 r7, Release:
cmake --build build --target guest_string_tests --parallel 2passes;ctest --test-dir build -R '^(guest_strings|public_headers)$' --repeat until-fail:3 -Vpasses 2/2 cases, each three repetitions (six passes, no skips), in 65.68 seconds. Conventions against this main pass. No new Linux, macOS/Rosetta, console, full-suite, title or GPU execution is claimed. Historical evidence below retains its exact source/toolchain limits.#11664-before-#10270 remains author-confirmed; any later combined-head validation is a separate integration step. The #12560 debt-only composition establishes no functional or author-order prerequisite. Current skipped-row source reconciliation is recorded in comment6475614264; it does not clear the compared #10270 scope or the entire overlap warning. Historical hosted outcomes remain at their original heads, and the older Darwin failure has no established current-head cause.
Earlier integrated-head evidence:
Current-main integration at
30abbd1be32adfe2ffe9f3f2de06dc053bad27a4, merging frozen main319621ba2e578bd053b0baba2877fe70520e0737by ordinary merge:cmake --build build --target guest_string_tests --parallel 2passed;ctest --test-dir build -R '^guest_strings$' --repeat until-fail:3 -Vpassed all three executions (test 517: 0.05, 0.01, 0.01 sec).python tools/check_conventions.py --base origin/mainpassed.Earlier current-main integration at
ca2cbc3baa, merging frozenmain750cf6cf48into the published branch without rewriting its history:Windows 11, WinLibs GCC 15.2.0, Release: a fresh
guest_string_testsbuild andctest -R '^guest_strings$' --repeat until-fail:3 -Vpass all three executions.The implementation is unchanged from
1185982eff; the only manual merge resolution preserves both the strmode debt entry and main's adjacent strtoq entry.Conventions and independent static integration review pass. The merge retains the declaration, implementation and all existing/new GuestStrings cases.
No new macOS/Rosetta execution is claimed. The historical masked-store failure and #12284 investigation remain separate evidence; this local Windows run does not diagnose its cause.
Earlier-head evidence follows:
ninja guest_string_testsandctest -R '^guest_strings$'inbuild-focusedon Windows: pass. Console behavior is not exercised.tools/check_conventions.py --base origin/main: all checks passed.tools/pr_overlap.py --branch codex/libc-strmodecompleted. The historical overlap report flags conflicting lines in GuestStrings.cpp with #10270. Its author subsequently confirmed #11664 before #10270 in comment6475839338; future combined validation remains outstanding. Other base-conflicted shared files were not fully compared by the tool.Built export
strmode_nid_postfixpresent inlibc.prx; registry NIDUo-nB2s+1+Amatches the symbol viatools/nid_names.py --name strmode.Historical hosted macOS relinker run: 309/310 passed; masked_store_lowering failed with 'Masked store stub changed the flags'. Cause is not yet established. This PR does not change relinker code. Native Linux comparison: Ubuntu 22.04/WSL, GCC 11.4, Release passed all 1728 masked-store executions, including flags checks, with the test/emitter/matcher sources identical to this PR head. This does not reproduce or clear the Rosetta failure; the historical Rosetta failure remains unexplained.
Write-watch CI prerequisite
This update merges the original #13220 commit (
e9f09f54fa) as a second parent. It removes only the duplicate execute-fault and read-fault registrations from the shared write-watch CMake file; the function change remains the first-parent history. Historical function-test results retain their original source/binary pins as recorded above; they are not results on this merged head. A separate configure-only Windows/Linux comparison generated all 18 unique test registrations after the fix, with no fixture build or runtime tests. The hosted macOS checks on this updated head are pending; no macOS runtime result is claimed here.#13220 landed in upstream main on 2026-11-01. Earlier heads carried its original commit
e9f09f54fabb6408d3e2711b8df10c10112ab00eas a second parent; after the 2026-11-01 main refresh above, the fix comes from main and this PR no longer changes the write-watch CMake file. The historical configure-only comparison and the pins recorded here are unchanged.Checklist
Based on current
main; no other open PR implements the same functionsOne 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 fileNo notes, investigation
.mdfiles 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