fix(ubuntu): set HOME/USER explicitly for runAsHostUser's su call - #197
Conversation
Ports game-ci/unity-builder#838 (frostebite): with runAsHostUser=true, `su $USERNAME -c "..."` switched the effective UID but not HOME/USER - the host user inherited root's environment (HOME=/root, USER unset), so the Unity Licensing Client (which writes to ~/.config/unity3d) couldn't resolve a writable home directory. Traced in game-ci/unity-builder#739 from a symptom of `-buildTarget Android` being silently ignored: when the Licensing Client can't resolve the right entitlement, Unity falls through to a license lacking the requested platform support and produces a Linux Standalone artifact without raising an error. Now passes HOME/USER/LOGNAME explicitly on the inner shell command while preserving the rest of root's env via `su -p`. Opt-in and backwards compatible: entirely inside the runAsHostUser=="true" branch, so anyone not using it sees zero change. Since unity-builder is now a thin wrapper around this CLI (game-ci/unity-builder#844) and no longer ships its own dist/platforms at all, this fix belongs here instead - unity-builder#838 is being closed in favor of this PR.
|
Important Review skippedReview was skipped due to path filters ⛔ Files ignored due to path filters (1)
CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Ports game-ci/unity-builder#838 (@frostebite): with `runAsHostUser=true`, `su $USERNAME -c "..."` switched the effective UID but not `HOME`/`USER` - the host user inherited root's environment (`HOME=/root`, `USER` unset), so the Unity Licensing Client (which writes to `~/.config/unity3d`) couldn't resolve a writable home directory. Traced in game-ci/unity-builder#739 from a symptom of `-buildTarget Android` being silently ignored: when the Licensing Client can't resolve the right entitlement, Unity falls through to a license lacking the requested platform support and produces a Linux Standalone artifact without raising an error.
Now passes `HOME`/`USER`/`LOGNAME` explicitly on the inner shell command while preserving the rest of root's env via `su -p`. Opt-in and backwards compatible: entirely inside the `runAsHostUser=="true"` branch, so anyone not using it sees zero change.
Since unity-builder is now a thin wrapper around this CLI (game-ci/unity-builder#844) and no longer ships its own `dist/platforms` at all, this fix belongs here instead - unity-builder#838 is being closed in favor of this PR.
Test plan