Configure file ownership for mounts & volumes - #26
Merged
Conversation
Replace the `user: "<name>"` config field with `guestUser: { uid, gid }`
(numeric), enforced to root ({ uid: 0, gid: 0 }) for now.
We plan on using the UID/GID later for ownership for mounted files &
directories, so this change sidesteps doing guest-side username <> ID mapping.
Also drop the `su` wrapper when launching the guest shell/command: the shell
already runs as root (Gondolin's default exec user) with the guest init
environment, so we exec `/bin/sh` directly. This is shell-behavior-preserving on
Alpine (/bin/sh is ash, which `su root` launched anyway); the switch to bash is
planned as a follow-up. `guestHomeDir` now defaults to a hard-coded `/root`
(inferGuestHomeDir removed) since only root is supported.
Switch the interactive shell and command exec from /bin/sh to /bin/bash, matching Gondolin's own default command (["/bin/bash", "-i"]). bash is present in the base image. Done as its own commit after the `su` removal: while `su` was in place it launched root's passwd shell (ash on Alpine) regardless of the argv we passed, so the switch only takes effect now. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The top-level `guestHomeDir` config option is now a field of `guestUser` (`guestUser.homedir`), keeping all guest-user settings in one place. It still defaults to /root and is used for `~` expansion in guest paths. Config layers now deep-merge `guestUser` field-by-field, so a child layer that sets `guestUser` without `homedir` inherits the parent's homedir rather than clobbering it.
Add an OwnershipProvider that wraps a VirtualProvider and rewrites the uid/gid
reported to the guest via stat/lstat (and an open handle's stat), so mounted
host files appear owned by a configured owner regardless of their real on-host
ownership. It clones the Stats (preserving the prototype so isDirectory() etc.
keep working) rather than mutating the backend's object, and forwards every
other operation verbatim.
buildVfsMounts/buildVfsVolumes now wrap each provider outermost with
OwnershipProvider, so ownership is consistent across all mount modes (incl.
overlay upper-layer and guest-created files).
Mounts and volumes accept an `owner: { uid?, gid? }` config option; unset fields
fall back to the guest user (`guestUser`). This is display-only — it does not
change on-host ownership, and the guest's chown remains a no-op.
The default owner is now the guest user (root, 0:0), so mounts/volumes no longer
surface the raw host uid/gid — avoiding e.g. git's "detected dubious ownership".
codethief
force-pushed
the
feat/file_ownership
branch
from
July 24, 2026 13:42
c59f6f7 to
4edb29f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.