Skip to content

fix(ubuntu): set HOME/USER explicitly for runAsHostUser's su call - #197

Merged
frostebite merged 1 commit into
mainfrom
fix/ubuntu-runashostuser-home-env
Aug 27, 2026
Merged

frostebite merged 1 commit into
mainfrom
fix/ubuntu-runashostuser-home-env

Conversation

@frostebite

Copy link
Copy Markdown
Member

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

  • `bash scripts/validate-platform-scripts.sh` passes
  • CI green

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.
@coderabbitai

coderabbitai Bot commented Aug 27, 2026

Copy link
Copy Markdown

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (1)
  • dist/platforms/ubuntu/entrypoint.sh is excluded by !**/dist/**

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 8608dfb7-3614-49d9-8efb-e6853d59f033

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@frostebite
frostebite merged commit de19728 into main Aug 27, 2026
15 checks passed
@frostebite
frostebite deleted the fix/ubuntu-runashostuser-home-env branch August 27, 2026 03:50
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