fix: hand bind-mount writes back to the host user after container commands - #1
Open
lucasmundim wants to merge 2 commits into
Open
lucasmundim wants to merge 2 commits into
lucasmundim wants to merge 2 commits into
Conversation
…mands The toolchain containers run as root over the /app/src bind mount, so on Linux every build left dist/ (and plugin scaffolding under crates/) owned by root:root. The visible failure was 'renzora run': the editor's plugin loader stages a shadow copy of each plugin into plugins/.reload/ before loading, and a root-owned dist/ made that fail with 'Permission denied (os error 13)' for every plugin, booting the editor with no Lua, no audio and no post-processing. A root-owned dist/ also could not be removed without sudo. Fix: after any container command that writes to the bind mount (build, run, upx, add, remove), chown the written paths back to the checkout's owner from inside the container, where we are root anyway. Running the whole container as the host uid was rejected because the images keep root-owned toolchains (rustup, osxcross, xwin, NDK) and cargo caches under root's home. The chown is best-effort and runs even when the command fails, since a failed build usually leaves partial output behind.
The standalone-plugin workspace keeps its cargo target dir on the bind mount (plugins/.cargo/config.toml in the engine sets target-dir there so all plugins share one cache), so container builds root-own it too and a later native plugin build fails on permissions.
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.
Fixes #2
Problem
The toolchain containers run as root over the
/app/srcbind mount, so on Linux hosts everything a build writes to the checkout —dist/, plugin scaffolding undercrates/— lands owned byroot:root.The visible failure is
renzora runon Linux: the engine editor's plugin loader stages a shadow copy of each plugin intoplugins/.reload/before loading it (that is what makes hot-reload possible), and a root-owneddist/makes creating that directory fail, so every plugin fails to load and the editor boots with no Lua, no audio and no post-processing:A root-owned
dist/also cannot be deleted by the user withoutsudo.Fix
After any container command that writes to the bind mount (
build,run,upx,add,remove), chown the written paths back to the checkout's owner from inside the container, where we are root anyway (dexec_owned→chown_to_host).Design notes:
docker create --user $(id -u): the images keep root-owned toolchains (rustup, osxcross, xwin, the NDK) and cargo's caches under root's home, so running the container as the host uid breaks builds. A targeted chown after the write is safe regardless of image internals.sudo renzora buildstill hands files back to whoever owns the checkout.|| true, output ignored): an ownership fixup must never fail a build that just succeeded.add/removechowncrates/rather than just the new crate dir because the scaffold also rewritescrates/renzora_runtime/Cargo.toml.Testing
cargo clippy --all-targetsclean,cargo testpassing.docker exec <container> chown -R 1000:1000 distrestored host ownership of a root-owneddist/, after which the editor loads all 67 plugins again.