Skip to content

fix(executor): real uid/euid identity instead of root emulation - #698

Merged
caomengxuan666 merged 2 commits into
masterfrom
fix/prompt-uid-identity
Oct 17, 2026
Merged

caomengxuan666 merged 2 commits into
masterfrom
fix/prompt-uid-identity

Conversation

@caomengxuan666

@caomengxuan666 caomengxuan666 commented Oct 17, 2026 •

Copy link
Copy Markdown
Member

fix(executor): real uid/euid identity instead of root emulation

What

Non-root hosts reported UID/EUID as 0 and \$ rendered #:
uid_value() fell back to a hardcoded "0", emulating a dev baseline
that ran as root. GNU variables.c:984 uidset binds the real
uid/euid, readonly; an inherited $UID/$EUID is kept.

Fix

Env when set, else getuid()/geteuid() (Windows persona keeps 0).
The 4 parameter_transform prompt tests pinned the author's account
(alice) and root-ness — green nowhere but the author's box; they now
calibrate account+mark from a throwaway Executor (\u itself stays
pinned by the issue421 tests).

Verification

  • Probe: $EUID/$UID 10275 and \$ → $, byte-identical to GNU.
  • parameter_transform_tests 13+4 → 17/17; issue421 3/3; prompt
    executor subset 20/20; lib 596/596.
  • Full serial failure-set gate vs master: the 4 fixed prompt tests
    are the DISAPPEARED set; the single NEW test pinned the old
    root-emulation # marker and is fixed in-branch (hermetic
    per-host mark; file now 10/10). Any remaining diffs are the known
    coproc flakes (isolated green).
  • niubash product A/B (niubash pinned 6295367, only rubash [patch]
    switched): failure sets byte-identical (8=8).

uid_value fell back to hardcoded 0 (emulating a dev baseline that ran
as root): every non-root host reported UID/EUID 0 and $ rendered #.
GNU variables.c:984 uidset binds the real uid/euid, readonly; an
inherited $UID/$EUID is kept. Now: env when set, else
getuid()/geteuid() (Windows persona keeps 0).

The 4 parameter_transform prompt tests pinned the author's account
(alice) and root-ness; they now calibrate account+mark from a
throwaway Executor (\u itself stays pinned by issue421 tests).
17/17 green on Android.
The default-prompt expectation pinned the root-emulation # marker;
calibrate per host (geteuid on unix, # on Windows persona).
@caomengxuan666
caomengxuan666 force-pushed the fix/prompt-uid-identity branch from 874c21b to 1b89878 Compare October 17, 2026 02:24
@caomengxuan666
caomengxuan666 merged commit a85f699 into master Oct 17, 2026
6 checks passed
@caomengxuan666
caomengxuan666 deleted the fix/prompt-uid-identity branch October 17, 2026 02:29
caomengxuan666 added a commit that referenced this pull request Oct 17, 2026
#736)

run_stdin inherited the developer HOME: a themed ~/.bashrc overrode
the default prompt under test. Empty temp HOME per run. The # mark
is euid-dependent (correct post-#698): calibrate per host via
geteuid (unix) instead of pinning root.

8/8 green on Android.

Co-authored-by: caomengxuan666 <[email protected]>
caomengxuan666 added a commit that referenced this pull request Oct 17, 2026
…ts (#740)

* fix(tests): hermetic HOME and root marker in repl channel tests (#419)

run_stdin inherited the developer HOME: a themed ~/.bashrc overrode
the default prompt under test. Empty temp HOME per run. The # mark
is euid-dependent (correct post-#698): calibrate per host via
geteuid (unix) instead of pinning root.

8/8 green on Android.

* fix(tests): hermetic HOME, real paths, last-prompt match in pb10k tests

Empty temp HOME per run (themed ~/.bashrc overrode PS1); deep dir
uses the real temp path (/c-anchored cannot exist off Windows);
post-cd prompt is the LAST matching line (startup prompt trims on
deep checkouts). 2/2 green on Android.

---------

Co-authored-by: caomengxuan666 <[email protected]>
caomengxuan666 added a commit that referenced this pull request Oct 17, 2026
* fix(tests): hermetic HOME and root marker in repl channel tests (#419)

run_stdin inherited the developer HOME: a themed ~/.bashrc overrode
the default prompt under test. Empty temp HOME per run. The # mark
is euid-dependent (correct post-#698): calibrate per host via
geteuid (unix) instead of pinning root.

8/8 green on Android.

* fix(tests): hermetic HOME, real paths, last-prompt match in pb10k tests

Empty temp HOME per run (themed ~/.bashrc overrode PS1); deep dir
uses the real temp path (/c-anchored cannot exist off Windows);
post-cd prompt is the LAST matching line (startup prompt trims on
deep checkouts). 2/2 green on Android.

* fix(tests): pin signal death for fatal SIGINT/SIGTERM (#526)

Untrapped INT/TERM kill non-interactive shells BY signal (GNU sig.c
kill_shell; verified GNU itself reports signaled under a direct
waiter — rc 130 exists only via the parent's jobs.c translation).
The 130/143 expectations were unsatisfiable under this harness.
Pin signaled (-1) + empty stdout instead.

---------

Co-authored-by: caomengxuan666 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant