diff --git a/public/checksum.txt b/public/checksum.txt index 43774b1..3e47e88 100644 --- a/public/checksum.txt +++ b/public/checksum.txt @@ -1,4 +1,4 @@ 6de66efba021ebcf462e7672577d9f6876f13db55691f04e7009ff7e78d658b8 public/sh/install_zpmod.sh -eff43da44827d4774eed21d31d841df04b9cd8fe089c1b59d38bef3608920754 public/sh/install.sh +2308d14ff74b9bb5928c4d0abfb9ae0d4268cd253fb871cd3d23d4bbbede6b10 public/sh/install.sh 08cc893ceb982fc99d17db1966c6c30790cc571e16e4f5392352d995f5252952 public/sh/sync-init.sh c979e39748d1d86ace17a61ff2b1bf6e1224a43291c25bf7fad985d1e9e11af1 public/zsh/init.zsh diff --git a/public/sh/install.sh b/public/sh/install.sh index 9d740da..a7a0f36 100755 --- a/public/sh/install.sh +++ b/public/sh/install.sh @@ -318,16 +318,21 @@ ANNEX_PROFILE() { printf '%s\n' "â–“â–’â–‘ .zshrc already loads z-shell/z-a-meta-plugins - annex block not added again" return 0 fi + # The burst file holds only the recipe; zicompinit belongs to .zshrc and + # must not run in the non-interactive burst shell (compinit aborts there). file="${WORKDIR}/temp-zsh-config" if [ "${AOPT}" = annex ]; then command cat <<-EOF >"${file}" zi light-mode for \\ z-shell/z-a-meta-plugins \\ @annexes # <- https://wiki.zshell.dev/ecosystem/category/-annexes +EOF + printf '%s\n' "â–“â–’â–‘ Installing annexes" + command cat "${file}" >>"${THE_ZDOTDIR}/.zshrc" + command cat <<-EOF >>"${THE_ZDOTDIR}/.zshrc" # examples here -> https://wiki.zshell.dev/community/gallery/collection zicompinit # <- https://wiki.zshell.dev/docs/guides/commands EOF - printf '%s\n' "â–“â–’â–‘ Installing annexes" else command cat <<-EOF >"${file}" zi light-mode for \\ @@ -335,8 +340,8 @@ zi light-mode for \\ @annexes @zunit EOF printf '%s\n' "â–“â–’â–‘ Installing annexes + zunit" + command cat "${file}" >>"${THE_ZDOTDIR}/.zshrc" fi - command cat "${file}" >>"${THE_ZDOTDIR}/.zshrc" ANNEX_BURST "${file}" } diff --git a/tests/installers.sh b/tests/installers.sh index b1ee218..5b4c5b3 100755 --- a/tests/installers.sh +++ b/tests/installers.sh @@ -471,6 +471,13 @@ for arg; do esac [ "${arg}" != "-c" ] || break done +# Whatever the burst sources must not run compinit: it aborts without a tty. +for arg; do + if [ -f "${arg}" ] && grep -q '^zicompinit' "${arg}" 2>/dev/null; then + printf '%s\n' "zsh test double: burst sources zicompinit from ${arg}" >&2 + exit 67 + fi +done [ -z "${ZI_SRC_TEST_ZSH_LOG:-}" ] || printf '%s\n' "zsh $*" >>"${ZI_SRC_TEST_ZSH_LOG}" EOF @@ -787,6 +794,11 @@ test_annex_rerun_is_idempotent() { contains "${zsh_log}" 'zsh -f -c ' contains "${zsh_log}" "${data}/zi/bin/zi.zsh" contains "${zsh_log}" 'temp-zsh-config' + # The annex-specific zicompinit reaches .zshrc (directly after the gallery + # comment), not only the one the default block writes. + if ! grep -A1 -F '# examples here -> https://wiki.zshell.dev/community/gallery/collection' "${home}/.zshrc" | grep -q '^zicompinit'; then + fail "annex profile did not write zicompinit after its gallery comment" + fi pass "annex profile is idempotent across reruns and never starts an interactive shell" }