Skip to content

fix(ide): keep ~/.local user-owned after code-server settings install - #768

Merged
skevetter merged 2 commits into
mainfrom
tasty-albatross
Jul 26, 2026
Merged

fix(ide): keep ~/.local user-owned after code-server settings install#768
skevetter merged 2 commits into
mainfrom
tasty-albatross

Conversation

@skevetter

@skevetter skevetter commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

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:

ERROR: Could not install packages due to an OSError: [Errno 13] Permission denied: '/home/vscode/.local/lib'

Affected IDEs

  • code-serverinstallSettings created ~/.local/share/code-server, orphaning ~/.local and ~/.local/share.
  • rstudiosetupPreferences created ~/.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; vscode settings.go runs host-side as the user; jupyter/marimo/zed write nothing under $HOME.

Fix

  • Add copy.MkdirAllChown — like os.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.
  • Use it in CodeServer.installSettings and rstudio.setupPreferences.

Tests

  • pkg/copy/copy_test.go — unit tests for MkdirAllChown (creates+owns new dirs, idempotent, no-op for empty user).
  • e2e/tests/ide/browser_returns.go — integration test: devsy up --ide=code-server with a non-root remoteUser, asserts ~/.local + ~/.local/share are user-owned and mkdir -p ~/.local/lib succeeds (the exact operation that failed). rstudio uses the same helper via the identical path.

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

netlify Bot commented Jul 26, 2026

Copy link
Copy Markdown

Deploy Preview for images-devsy-sh canceled.

Name Link
🔨 Latest commit 8150822
🔍 Latest deploy log https://app.netlify.com/projects/images-devsy-sh/deploys/6a6682ae056b180008649a64

@coderabbitai

coderabbitai Bot commented Jul 26, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@skevetter, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 5 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: dad367a3-dba6-47ab-a554-8e096805b682

📥 Commits

Reviewing files that changed from the base of the PR and between de0c687 and 8150822.

📒 Files selected for processing (7)
  • e2e/tests/ide/browser_returns.go
  • e2e/tests/ide/testdata-codeserver-nonroot/.devcontainer.json
  • e2e/tests/ide/testdata-codeserver-nonroot/Dockerfile
  • pkg/copy/copy.go
  • pkg/copy/copy_test.go
  • pkg/ide/codeserver/codeserver.go
  • pkg/ide/rstudio/rstudio.go

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.

@netlify

netlify Bot commented Jul 26, 2026

Copy link
Copy Markdown

Deploy Preview for devsydev canceled.

Name Link
🔨 Latest commit 8150822
🔍 Latest deploy log https://app.netlify.com/projects/devsydev/deploys/6a6682ae289f7400084afaa6

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.
@skevetter
skevetter marked this pull request as ready for review July 26, 2026 23:43
@skevetter
skevetter merged commit 7a3e416 into main Jul 26, 2026
65 checks passed
@skevetter
skevetter deleted the tasty-albatross branch July 26, 2026 23:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant