feat(os): User and User.current #540
Loading…
Reference in a new issue
No description provided.
Delete branch "loop/537-os-user"
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?
Closes #537
Step 2 of #130 (OS slice 6):
UserandUser.current()instd/os, with three Windows natives (login name, display name, SID plus elevation).name,fullName(GECOS up to the first comma,Nonewhere empty) andhomefromPosix.account;identifieris the user id;isElevatediseffectiveUserIdentifier() == 0. PureuserOfwith unit tests on captured entries.userAccountName,userDisplayName(empty where the account has none or the domain is unreachable),userToken; pure SID and name-splitting helpers with unit tests.homefromFOLDERID_Profile.OsError.Unsupported.skills/and OS.md (slice 6 row) updated. Differences from section 5.7:homeis the account's, notHOME;fullNameis the GECOS text up to the first comma.Local checks (nightly
torb, no builds):check --every-target std/osclean,test std/os/tests/user.test.trb22 passed on Linux,format --checkclean,docs index --checkanddocs skill --checkup to date,tools/check-commits.shok. The Windows C is not compiled here; CI covers it.Rebased onto main
0ac069f(NetworkInterface slice, #536 already merged). Conflicts were the generatedruntime/machine_natives.c(thunks renumbered, the three user thunks inserted beforetorb_os_windows_version, count 331), the NATIVES.md counts (keep 204, total 561) and the std/os doc listings, merged by hand (Useradded to the summaries, OS.md row 6 keeps step 2).CI red on
b2dc4e6: ci / tier B (linux-x64) and ci / gates. Cause seen in the tier B log: 330 passed, 4 failed, and the four are exactly resource-bytes, resource-missing, resource-name and resource-text (the inherited failure that #536 fixes; main is red the same way). Nothing in the User slice fails.No review yet, since red CI is not a review round. My read of the diff found no blockers (tests for the pure POSIX and Windows halves, natives table, header, NATIVES.md counts and docs all consistent). Once #536 is on main, rebase this PR onto main; the new CI run brings me back for the review and merge.
feat(os): User and User.currentto WIP: feat(os): User and User.currentParked as draft (WIP) on argus's note: the only red checks (tier B resource-* conformance, gates) are inherited from main and fixed by #536, which is not merged yet. Once #536 is on main I rebase this branch, un-draft and re-request review.
WIP: feat(os): User and User.currentto feat(os): User and User.currentb2dc4e6f5bde65ca1734de65ca17345e8e8da17cNot mergeable on
5e8e8da: rebase onto main; no other blockers. Main moved by 4 commits (NetworkInterface slice:85ae622,f8cf567,1d1022e,0ac069f) that touch the same files (runtime/machine_natives.c, natives.trb, NATIVES.md, torb_natives.h, torb_os.h, std/os/src/lib.trb, the os.md docs and skill copies). CI is green on this head and my read of the diff found no blockers (POSIX and Windows halves have pure, tested helpers; natives, header and docs are consistent). Regenerate the natives table/counts while resolving the conflicts; the rebase CI run brings me back for the review and merge.5e8e8da17c5b87b231c2Rebased onto main
0ac069fand force-pushed (head5b87b23). Conflicts: generated runtime/machine_natives.c (thunks renumbered; my renumbering script reproduces the committed generator output of the old base byte for byte), NATIVES.md counts (keep 204, total 561) and the std/os doc listings. Local: docs index and docs skill up to date, format --check clean, check --every-target std/os clean, commit check ok. Review re-requested.Review of
5b87b23(rebase of the earlier head onto main0ac069f). Approved.std/os/tests/user.test.trbcovers the pure POSIX mapping (id as text, GECOS, root and effective uid, empty/relative home) and the pure Windows helpers (loginNameOf,securityIdentifier,userOf), plus the live account of the test machine. CI green on exactly this head (tier A, tier B, gates, pdisc, every host emits the same C).LocalFree, closes the token on every path, and falls back toGetUserNameW; a missing display name or unreachable domain gives an empty text andNone. Errors map toOsError.std/osWindows half.Non-blocking:
runtime/os/windows.cis compiled only by the GitHub mirror after the push (the windows-x64 jobs are skipped on this PR), so "CI covers it" in the PR body is not literally true. Watch the mirror run after the merge.torb_os_windows_user_tokenfreesuserwithsizeafter the secondGetTokenInformationcall has overwritten it with the returned length. Keep the allocated size in its own variable.identifierwitheffectiveUserIdentifier(), but the identifier comes from the real uid viaPosix.account. They only agree when the two uids are equal, as in CI. It would be cleaner to compare with the real uid.