feat(libc): implement guest gethostname #2019
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2019"
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 QRMOE on 2026-10-09T05:11:32Z.
What
Updated source branch: a4e3ff0d2. GitHub still shows the previous closed PR head
b9c5a3a8; a maintainer needs to reopen the PR to refresh its diff. The behavior and validation below describe the updated source branch.Implements
gethostname(-nvxBWa0iDs) with the stable guest hostnameAnyPS5. The guest receives this name on every host; the implementation never queries or copies the PC's DNS hostname, Unix nodename or environment. This addresses the host-name exposure raised in the close note.Preserves the existing FreeBSD buffer behavior: bounded copying, guest
ENAMETOOLONG=63, null-buffer queries and unchanged guest errno on success. There are no host API calls or dynamic allocations in the implementation. Tests now verify the guest identity, buffer guards, every capacity from zero through hostname length + 2, maximumsize_tcapacity, null queries, success errno and thread-local error isolation. TechnicalDebt records the fixed-name policy and unverified console hostname configuration and sysctl/resolver integration.babyhuey's report supplies the requested current-main failure: XashPS5 (PPSA19111) stops at missing
gethostname, and the previous branch moves it to missingrealpathon Linux and Windows. That report tested the previous head, before this identity change; it is third-party evidence and has not been independently rerun here. No claim that this revision starts the title is made.Tested
Windows 11, WinLibs MinGW-w64 GCC 15.2.0 UCRT/POSIX/SEH, Ninja Release;
BUILD_TESTING=ON,ANYPS5_ENABLE_SPIRV_TOOLS=ON.guest_hostnameandguest_errorseach passed five consecutive runs with this fix.5edae35361e9b7f7061f28c6e80ed075312b8105. On that tree,guest_hostnameandguest_errorseach passed five consecutive runs; a second build had no work to do.a4e3ff0d2bee6582651fa876f1a0e188b93cf2e6includes current main. Its complete source tree exactly matches the tree used for the successful full build and focused tests.Not tested: Linux or macOS for this revision, console, games or the complete CTest suite. Previous Linux approvals and title reports apply to the earlier head.
Checklist
main; no other open PR implements the same functionsImported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T05:16:00Z.
Review: COMMENTED
I reviewed the complete three-file diff at
faba0016408ba09181cbaeef4fb639ee6580a4f7. The null-buffer query path is consistent with the cited FreeBSD implementation, which passes the destination pointer and length tosysctl; Windows'GetComputerNameExAalso documents a null-buffer size query. The bounded copy and guestENAMETOOLONGbehavior match the source described in the PR.Independent Linux/GCC 12.2 validation:
guest_hostnameis registered and passed (1/1, 0.02 s),check_conventions.pypassed, andgit diff --checkpassed. GitHub reports no checks on this head yet. The Windows-specific path remains supported by the author's reported Windows 11 run; I could not execute that path on this Linux host. I found no blocking issue in the diff.References: FreeBSD
gethostname.c(https://raw.githubusercontent.com/freebsd/freebsd-src/main/lib/libc/gen/gethostname.c); MicrosoftGetComputerNameExAdocumentation (https://learn.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-getcomputernameexa).Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T05:29:04Z.
Review: APPROVED
The previously reviewed head is unchanged. I confirm the three-file diff and guest_hostname coverage; independent Linux/GCC 12.2 testing passed, and the author reports the Windows hostname path and test pass. The Windows API behavior is supported by the cited GetComputerNameExA docs. GitHub reports no checks for this head, and I cannot run the Windows-specific path in this Linux environment; no blocking issue found.
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-09T08:55:01Z.
Progress report (
d70b899→b9c5a3a)📈 System libraries: 84.7% (+0.01%, +1 implemented functions)
✅ 1 implemented
gethostname_nid_postfixImported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-09T21:50:41Z.
Closing for now: no title stops on
gethostnameonmain, and the description says so (the reference is an import audit, #1578). #1594, the same export, was closed on 2026-10-08 for that reason, and it also hands the host's machine name to the guest, which this PR doesn't address.The implementation and test look sound. Feel free to reopen when a title's next stop on
mainisgethostname, with the log line, and say how the host name is exposed to the guest.Imported from boykopovar/AnyPS5. Originally posted by babyhuey on 2026-10-10T02:16:37Z.
This is now a title's next stop on current
main, so here is the log line the close note asked for, plus a check of this branch.Checked
b9c5a3a8merged ontomainc963432d(clean), Linux (Ubuntu 24.04, GCC 13) and Windows 11 (MinGW-w64 GCC from WinLibs), Release.guest_hostnamepasses 5/5 on both (--repeat until-fail:5); no CRT assertion dialog on Windows.main(catalog runs on2edaf7f4Linux and0c0dc1e9Windows) and with this branch:mainundefined symbol: -nvxBWa0iDs(gethostname)vhtcIgZG-Lk(realpath)Example lines for XashPS5 (PPSA19111):
mainWindowsFAIL: unresolved ELF import -nvxBWa0iDs (gethostname) from libSceLibcInternal.prx; with this branch, Linuxapp.elf: symbol lookup error: app.elf: undefined symbol: vhtcIgZG-Lk, WindowsFAIL: unresolved ELF import vhtcIgZG-Lk from libSceLibcInternal.prx.This only covers the title-stop half of the close note; the point about handing the host's machine name to the guest is still open.
Imported from boykopovar/AnyPS5. Originally posted by QRMOE on 2026-10-10T14:46:31Z.
The host-name exposure is addressed on the updated source branch at a4e3ff0d2.
gethostnamenow returns the fixed guest nameAnyPS5without querying the PC's hostname, nodename or environment. Bounded copying, null queries, guestENAMETOOLONGand success errno preservation remain covered by tests. TechnicalDebt records the fixed-name policy and unverified console hostname configuration and sysctl/resolver integration.Windows 11, MinGW-w64 GCC 15.2.0, Ninja Release: the complete default build passed with the branch merged into main
5edae3536;guest_hostnameandguest_errorseach passed five consecutive runs. The new identity regression fails against the old implementation. Conventions, whitespace and test registration passed. The published branch's complete source tree matches the tested tree.babyhuey's XashPS5 report supplies the requested runtime-stop evidence for the previous revision. Linux and title retesting of this new hostname policy are still pending; no new title-unblocking claim is made.
Could this PR be reopened for review of the updated branch? The closed PR still shows head
b9c5a3a8, so its current diff does not include this fix. The description now links the updated branch and lists the validation limits.AI-assisted: yes, OpenAI Codex assisted with the change, tests, validation and this comment.
Imported from boykopovar/AnyPS5. Originally posted by babyhuey on 2026-10-10T17:36:50Z.
@QRMOE same question as on #2024:
gethostnameis still XashPS5's (PPSA19111) next stop onmain57f96fd2, and this branch merges cleanly. If you'd like, I can open it from my fork with your commits and authorship kept. The review point about handing the host's machine name to the guest is still open, so it would need an answer to that first; do you have a preference for what the guest should see?Imported from boykopovar/AnyPS5. Originally posted by QRMOE on 2026-10-10T18:32:05Z.
@babyhuey Yes, please go ahead and open it from your fork. Please preserve my original commits and authorship, credit @QRMOE in the new PR description, and retain the original author credit if rebasing or squashing.
My preference is the fixed guest name
AnyPS5, without exposing the PC's machine name. This is already implemented on the updated source branch at a4e3ff0d2. Please use that updated branch: the closed PR still shows the old headb9c5a3a8and its diff does not include the change.The full Windows build passed with main
5edae3536, andguest_hostnameandguest_errorseach passed five consecutive runs. Linux and XashPS5 retesting of this revision are pending, so your proposed testing would help. TechnicalDebt records the fixed-name policy and the remaining console hostname configuration and sysctl/resolver gaps.Thank you for helping carry this forward. Please link the replacement PR here so I can follow it.
AI-assisted: yes, OpenAI Codex assisted with the implementation, validation and this reply.
Imported from boykopovar/AnyPS5. Originally posted by babyhuey on 2026-10-10T18:59:50Z.
@QRMOE opened as #2968 from your updated branch (a4e3ff0d, the fixed
AnyPS5name), rebased ontomain9c5d67fbwith your seven commits and authorship kept; the two merge commits are dropped sincemaintakes linear history.guest_hostnameandguest_errorspass 5/5 on Linux and Windows, and XashPS5 goes on torealpathon both.Pull request closed