Skip to content

BUG: install.sh doesn't respect ZDOTDIR environment variable #56

Description

@maxrantil

Bug Description

install.sh hardcodes symlink destinations to $HOME/.zshrc but .zprofile sets ZDOTDIR=$HOME/.config/zsh (XDG Base Directory specification). This causes zsh to not find .zshrc on login, breaking starship prompt initialization.

Current Behavior

install.sh line 70:

link_file "$DOTFILES_DIR/.zshrc" "$HOME/.zshrc"

But .zprofile line 18 sets:

export ZDOTDIR="${XDG_CONFIG_HOME}/zsh"

Result: Zsh looks for .zshrc in ~/.config/zsh/ but install.sh creates it in ~/

Impact

  • Starship prompt doesn't initialize on SSH login
  • Users see plain hostname% instead of colored starship prompt
  • All zsh configurations fail to load
  • Aliases, functions, and plugins not available

Expected Behavior

install.sh should respect ZDOTDIR environment variable and create symlinks in the correct location:

  • If ZDOTDIR is set → symlink to $ZDOTDIR/.zshrc
  • If ZDOTDIR is unset → symlink to $HOME/.zshrc (current behavior)

Proposed Fix

# Determine where zsh config should go
ZSH_CONFIG_DIR="${ZDOTDIR:-$HOME}"

# Create ZDOTDIR if it doesn't exist
if [ -n "$ZDOTDIR" ] && [ ! -d "$ZDOTDIR" ]; then
    mkdir -p "$ZDOTDIR"
    echo "[CREATE] Directory: $ZDOTDIR"
fi

# Link zshrc to correct location
link_file "$DOTFILES_DIR/.zshrc" "$ZSH_CONFIG_DIR/.zshrc"

Reproduction

  1. Source .zprofile which sets ZDOTDIR=~/.config/zsh
  2. Run install.sh
  3. SSH into system
  4. Observe: Plain prompt, no starship, no aliases

Environment

  • OS: Ubuntu 22.04 LTS
  • Shell: zsh 5.8.1
  • Context: Discovered during vm-infra provisioning testing

Related

  • XDG Base Directory Specification compliance
  • Affects all users who set ZDOTDIR in their environment

Workaround

Currently using workaround in vm-infra ansible playbook to create ~/.config/zsh/ and symlink .zshrc manually after dotfiles installation. Would prefer to fix root cause in dotfiles repo.

Labels

bug, xdg-compliance, zsh

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions