From bb549c47a2b29ec68a0b0788519c23dd92d06083 Mon Sep 17 00:00:00 2001 From: Preston Hunt Date: Fri, 28 Aug 2026 12:22:30 -0700 Subject: [PATCH] ccache: create the compiler shims without sudo '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) --- setup | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/setup b/setup index df939ed..661799e 100755 --- a/setup +++ b/setup @@ -314,11 +314,12 @@ install_development_packages() { install_ccache() { install_package ccache local dest="$HOME/.local/bin" + local ccache i + ccache=$(command -v ccache) mkdir -p "$dest" + # no sudo: these live in the user's own home directory for i in gcc g++ cc c++; do - local targ="$dest/$i" - sudo rm -f "$targ" - sudo ln -s "$(which ccache)" "$targ" + ln -sf "$ccache" "$dest/$i" done }