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
Summary
Two environment-handling gaps in
public/sh/install.shsurfaced 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
ZDOTDIRorZI_HOMEis used after a directory changeThe installer runs
cd /tmp/zi(progress-bar fetch) and latercd "${ZI_HOME}"orcd "${ZI_HOME}/${ZI_BIN_DIR_NAME}"beforeMAIN_PROFILEresolvesTHE_ZDOTDIR="${ZDOTDIR:-${HOME}}". A relativeZDOTDIRtherefore points under the checkout when.zshrcis probed and appended. A relativeZI_HOMEis created withmkdir -prelative to the caller's directory, thencd "${ZI_HOME}"aftercd /tmp/ziresolves 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 ruleis_absolute_pathalready applies toXDG_*).2.
-a loaderwith an explicitZI_HOMEproduces a checkout the loader never usesZI_HOMEselects the clone root, but the loader block written to.zshrcandpublic/zsh/init.zshnever readZI_HOME(zero mentions ininit.zsh); the loader resolvesZI[HOME_DIR]from the legacy home or the XDG data base. AfterZI_HOME=/custom sh install.sh -a loader, the firstzzinitclones a second checkout under$XDG_DATA_HOME/zior~/.local/share/zi, and the requested root is never loaded. Proposed: either refuseZI_HOMEwith-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 writingZI[HOME_DIR]into the loader block or into thesetup/pre.zshtarget that ADR-0025 defines for exactly this kind of pre-loader setting (#208).Evidence
public/sh/install.shandpublic/zsh/init.zshonmainat a1ac6d2.git show main:public/zsh/init.zsh | grep -c ZI_HOMEprints 0.Related
ZDOTDIRorZI_HOME; do not setZI_HOMEunless asked)