fix(ide): keep ~/.local user-owned after code-server settings install - #768
Conversation
code-server's installSettings ran os.MkdirAll for ~/.local/share/code-server as the root setup process, creating the intermediate ~/.local and ~/.local/share parents root-owned. The scoped ChownR only covered the code-server subtree, leaving the parents unwritable to a non-root remote user and breaking pip --user, pipx, and other user-level installs. Add copy.MkdirAllChown (os.MkdirAll that chowns only the dirs it creates to the given user) and use it in installSettings so newly-created XDG parents are owned by the workspace user.
✅ Deploy Preview for images-devsy-sh canceled.
|
|
Warning Review limit reached
Next review available in: 5 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (7)
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 |
✅ Deploy Preview for devsydev canceled.
|
setupPreferences ran os.MkdirAll for ~/.config/rstudio as the root setup process, orphaning the intermediate ~/.config parent root-owned; the scoped ChownR only covered ~/.config/rstudio. Reuse copy.MkdirAllChown so the newly-created ~/.config parent is owned by the workspace user, matching the code-server fix.
Summary
Devsy's IDE setup runs as root and, in two IDEs, created a multi-level settings/data path under $HOME with
os.MkdirAll, then chowned only the leaf subtree — leaving the intermediate XDG parents (~/.local,~/.config) root-owned and unwritable to a non-root remote user. Fresh workspaces then failed user-level installs:Affected IDEs
installSettingscreated~/.local/share/code-server, orphaning~/.localand~/.local/share.setupPreferencescreated~/.config/rstudio, orphaning~/.config($XDG_CONFIG_HOME).Not affected (audited)
openvscode, vscode-web, vscode desktop (all flavors), fleet, jetbrains install into a single component under $HOME and
ChownR(location)covers the whole subtree; rstudio's other dirs are system paths; vscodesettings.goruns host-side as the user; jupyter/marimo/zed write nothing under $HOME.Fix
copy.MkdirAllChown— likeos.MkdirAll, but chowns only the directories it newly creates to the given user. Pre-existing dirs are untouched, preserving the intent of not clobbering sibling ownership.CodeServer.installSettingsandrstudio.setupPreferences.Tests
pkg/copy/copy_test.go— unit tests forMkdirAllChown(creates+owns new dirs, idempotent, no-op for empty user).e2e/tests/ide/browser_returns.go— integration test:devsy up --ide=code-serverwith a non-rootremoteUser, asserts~/.local+~/.local/shareare user-owned andmkdir -p ~/.local/libsucceeds (the exact operation that failed). rstudio uses the same helper via the identical path.