From 435d66aad226fc3b0ae70d12f20f1d651025c6aa Mon Sep 17 00:00:00 2001 From: mk Date: Tue, 28 Jul 2026 06:16:45 +0300 Subject: [PATCH] =?UTF-8?q?shell-zsh:=20derive=20ZSH/ZDOTDIR=20from=20$TAR?= =?UTF-8?q?GET=5FHOME=20unconditionally=20=E2=80=94=20ignore=20inherited?= =?UTF-8?q?=20$ZSH=20env=20var=20(omz=20exports=20it,=20which=20pinned=20p?= =?UTF-8?q?aths=20to=20the=20old=20home=20e.g.=20/root=20while=20the=20cho?= =?UTF-8?q?wn=20step=20retargeted=20to=20the=20new=20user,=20causing=20'in?= =?UTF-8?q?secure=20completion=20dirs'=20owned=20by=20the=20wrong=20user)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/30-shell-zsh.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/modules/30-shell-zsh.sh b/modules/30-shell-zsh.sh index 6790a6d..3528c52 100755 --- a/modules/30-shell-zsh.sh +++ b/modules/30-shell-zsh.sh @@ -6,9 +6,13 @@ step_desc="zsh + oh-my-zsh + plugins, set default shell, ship config" step_run="run_zsh" # All paths resolve against the config TARGET (set by 05-create-user). -ZSH="${ZSH:-$TARGET_HOME/.oh-my-zsh}" -ZSH_CUSTOM="${ZSH_CUSTOM:-$ZSH/custom}" -ZDOTDIR_TARGET="${ZDOTDIR_TARGET:-$TARGET_HOME/.config/zsh}" +# NOTE: we deliberately do NOT honor an inherited $ZSH env var — oh-my-zsh exports +# ZSH when it loads, so a setup.sh run from an omz-equipped shell would otherwise +# pin these to the *old* home (e.g. /root) while the chown step retargets to the +# *new* user, mis-owning the wrong tree (the 'insecure completion dirs' bug). +ZSH="$TARGET_HOME/.oh-my-zsh" +ZSH_CUSTOM="$ZSH/custom" +ZDOTDIR_TARGET="$TARGET_HOME/.config/zsh" run_zsh() { log "installing zsh + oh-my-zsh"