Skip to content

installer: validate relative ZDOTDIR and ZI_HOME, and carry ZI_HOME into the loader profile #218

Description

@ss-o

Summary

Two environment-handling gaps in public/sh/install.sh surfaced while writing and reviewing the wiki's Agent installation tab (z-shell/wiki#922). The tab works around both with rules for the agent; the installer should handle them itself.

1. Relative ZDOTDIR or ZI_HOME is used after a directory change

The installer runs cd /tmp/zi (progress-bar fetch) and later cd "${ZI_HOME}" or cd "${ZI_HOME}/${ZI_BIN_DIR_NAME}" before MAIN_PROFILE resolves THE_ZDOTDIR="${ZDOTDIR:-${HOME}}". A relative ZDOTDIR therefore points under the checkout when .zshrc is probed and appended. A relative ZI_HOME is created with mkdir -p relative to the caller's directory, then cd "${ZI_HOME}" after cd /tmp/zi resolves somewhere else. Proposed: require both to be absolute when set, refuse with a message naming the variable and its value, before any mutation (the same rule is_absolute_path already applies to XDG_*).

2. -a loader with an explicit ZI_HOME produces a checkout the loader never uses

ZI_HOME selects the clone root, but the loader block written to .zshrc and public/zsh/init.zsh never read ZI_HOME (zero mentions in init.zsh); the loader resolves ZI[HOME_DIR] from the legacy home or the XDG data base. After ZI_HOME=/custom sh install.sh -a loader, the first zzinit clones a second checkout under $XDG_DATA_HOME/zi or ~/.local/share/zi, and the requested root is never loaded. Proposed: either refuse ZI_HOME with -a loader (the tab already tells agents not to set it), or have the installer carry the root into the loader path, for example by writing ZI[HOME_DIR] into the loader block or into the setup/pre.zsh target that ADR-0025 defines for exactly this kind of pre-loader setting (#208).

Evidence

Related

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

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions