|
.zi-prepare-home() { |
|
[[ -n ${ZI[HOME_READY]} ]] && return |
|
ZI[HOME_READY]=1 |
|
if [[ ! -d ${ZI[HOME_DIR]} ]]; then |
|
command mkdir -p "${ZI[HOME_DIR]}" |
|
command chmod 700 "${ZI[HOME_DIR]}" |
|
fi |
|
# Set up $ZPFX |
|
if [[ ! -d ${ZPFX}/bin ]]; then |
|
command mkdir -p "${ZPFX}/bin" |
|
fi |
|
if [[ ! -d ${ZPFX}/lib ]]; then |
|
command mkdir -p "${ZPFX}/lib" |
|
command chmod go-w "${ZPFX}/lib" |
|
fi |
|
if [[ ! -d ${ZPFX}/share ]]; then |
|
command mkdir -p "${ZPFX}/share" |
|
command chmod go-w "${ZPFX}/share" |
|
fi |
|
if [[ ! -d ${ZI[MAN_DIR]} ]]; then |
|
command mkdir 2>/dev/null -p ${~ZI[MAN_DIR]}/man{1..9} |
|
command chmod -R go-w "${ZI[MAN_DIR]}" |
|
fi |
|
if [[ ! -d ${ZI[CACHE_DIR]} ]]; then |
|
command mkdir -p "${ZI[CACHE_DIR]}" |
|
command chmod 700 "${ZI[CACHE_DIR]}" |
|
fi |
|
if [[ ! -d ${ZI[CONFIG_DIR]} ]]; then |
|
command mkdir -p "${ZI[CONFIG_DIR]}" |
|
command chmod 700 "${ZI[CONFIG_DIR]}" |
|
fi |
|
if [[ ! -d ${ZI[LOG_DIR]} ]]; then |
|
command mkdir -p "${ZI[LOG_DIR]}" |
|
command chmod 700 "${ZI[LOG_DIR]}" |
|
fi |
|
if [[ ! -d ${ZI[ZMODULES_DIR]} ]]; then |
|
command mkdir -p "${ZI[ZMODULES_DIR]}" |
|
command chmod go-w "${ZI[ZMODULES_DIR]}" |
|
fi |
|
if [[ ! -d ${ZI[PLUGINS_DIR]}/_local---zi ]]; then |
|
command rm -rf "${ZI[PLUGINS_DIR]:-${TMPDIR:-/tmp}/132bcaCAB}/_local---zi" |
|
command mkdir -p "${ZI[PLUGINS_DIR]}/_local---zi" |
|
command chmod go-w "${ZI[PLUGINS_DIR]}" |
|
command ln -s "${ZI[BIN_DIR]}/lib/_zi" "${ZI[PLUGINS_DIR]}/_local---zi" |
|
(( ${+functions[.zi-setup-plugin-dir]} )) || builtin source "${ZI[BIN_DIR]}/lib/zsh/install.zsh" || return 1 |
|
(( ${+functions[.zi-confirm]} )) || builtin source "${ZI[BIN_DIR]}/lib/zsh/autoload.zsh" || return 1 |
|
.zi-clear-completions &>/dev/null |
|
.zi-compinit 1 &>/dev/null |
|
fi |
|
if [[ ! -d ${ZI[COMPLETIONS_DIR]} ]]; then |
|
command mkdir "${ZI[COMPLETIONS_DIR]}" |
|
command chmod go-w "${ZI[COMPLETIONS_DIR]}" |
|
# Symlink _zi completion into _local---zi directory. |
|
command ln -s "${ZI[PLUGINS_DIR]}/_local---zi/_zi" "${ZI[COMPLETIONS_DIR]}" |
|
(( ${+functions[.zi-setup-plugin-dir]} )) || builtin source "${ZI[BIN_DIR]}/lib/zsh/install.zsh" || return 1 |
|
.zi-compinit 1 &>/dev/null |
|
fi |
|
if [[ ! -d ${ZI[SNIPPETS_DIR]} ]]; then |
|
command mkdir -p "${ZI[SNIPPETS_DIR]}/OMZ::plugins" |
|
command chmod go-w "${ZI[SNIPPETS_DIR]}" |
|
( builtin cd -q ${ZI[SNIPPETS_DIR]}; command ln -s OMZ::plugins plugins; ) |
|
command mkdir -p "${ZI[SERVICES_DIR]}" |
|
command chmod go-w "${ZI[SERVICES_DIR]}" |
|
fi |
|
} # ]]] |
Problem
.zi-prepare-homemarks initialization complete before its directory work succeeds, and createsZI[SERVICES_DIR]only whenZI[SNIPPETS_DIR]is absent.Current source:
zi/zi.zsh
Lines 1172 to 1236 in 7956627
Reproduction evidence
With an isolated Zi root where
snippets/already existed andservices/did not, sourcing Zi completed but the service directory remained absent:Several directory commands also do not propagate failure, while
ZI[HOME_READY]=1prevents a later retry.Impact
Partial, migrated, or manually repaired layouts can be accepted as ready. Service startup then tries to create locks and FIFOs below a missing directory, and transient initialization failures can persist for the shell session.
Acceptance criteria
ZI[HOME_READY]only after successful completion.Next action
Define the complete home-layout invariant, then make preparation transactional at the function level.