Conversation
'sudo ln -s' left ~/.local/bin/{gcc,g++,cc,c++} owned by root inside
the user's own home directory, so they could not be inspected or
cleaned up without escalating again. The directory is user-writable and
needs no privilege.
Replace 'sudo rm -f' + 'sudo ln -s' with a plain 'ln -sf' (which also
makes the function re-runnable), declare the loop variable local, and
use 'command -v' rather than the external 'which'.
Existing root-owned links are replaced on the next run, since removal
depends on write permission to the directory rather than file
ownership.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
🟢 Approval recommended
The change is narrowly scoped, aligns with the PR rationale, and improves correctness by avoiding root-owned files in the user’s home directory.
Pull request overview
This PR updates the install_ccache portion of the setup script to create compiler shim symlinks in ~/.local/bin without using sudo, preventing root-owned symlinks inside a user’s home directory and making the operation safely re-runnable.
Changes:
- Replace
sudo rm+sudo ln -swithln -sffor idempotent symlink creation in a user-writable directory. - Resolve the
ccacheexecutable path once viacommand -vand reuse it across the shim creation loop. - Scope loop variables locally within
install_ccacheto avoid leaking shell variables.
File summaries
| File | Description |
|---|---|
| setup | Removes unnecessary sudo from ccache compiler-shim symlink creation and makes the operation idempotent. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
'sudo ln -s' left ~/.local/bin/{gcc,g++,cc,c++} owned by root inside
the user's own home directory, so they could not be inspected or
cleaned up without escalating again. The directory is user-writable and
needs no privilege.
Replace 'sudo rm -f' + 'sudo ln -s' with a plain 'ln -sf' (which also
makes the function re-runnable), declare the loop variable local, and
use 'command -v' rather than the external 'which'.
Existing root-owned links are replaced on the next run, since removal
depends on write permission to the directory rather than file
ownership.
🤖 Generated with Claude Code