Skip to content

Z4H breaks if you uninstall direnv while having the direnv integration active #375

Description

@Syphdias

Hi, probably quite unlikely to happen but I wanted to see if the builtin direnv integration worked without direnv installed. (No, it does not). I managed to break z4h this way, so I thought the workaround might be useful to someone.

Error on launch of new zsh

--- stack trace (most recent call first) ---
/root/.cache/zsh4humans/v5/zsh4humans/fn/-z4h-direnv-init:6
/root/.zshrc:406
/root/.cache/zsh4humans/v5/zsh4humans/main.zsh:208
/root/.cache/zsh4humans/v5/zsh4humans/main.zsh:465
/root/.zshrc:56
zsh:0
--- end of stack trace ---
--- stack trace (most recent call first) ---
/root/.zshrc:406
/root/.cache/zsh4humans/v5/zsh4humans/main.zsh:208
/root/.cache/zsh4humans/v5/zsh4humans/main.zsh:465
/root/.zshrc:56
zsh:0

Step to reproduce

  1. run:
docker run -e TERM -e COLORTERM -e LC_ALL=C.UTF-8 -w /root -it --detach-keys="ctrl-^,ctrl-@" --rm alpine sh -uec '
  apk add zsh curl tmux direnv
  sh -c "$(curl -fsSL https://raw.githubusercontent.com/romkatv/zsh4humans/v5/install)"'
  1. Go through wizard with: 11nyy and q to quit p10k wizard
  2. apk del direnv
  3. Check a file (foreshadowing):
# cat ~/.cache/zsh4humans/v5/cache/direnv
typeset direnv=/usr/bin/direnv
  1. exec zsh (q p10k wizard) and check file again. It is still there but empty.
  2. exec zsh yields the error from above

Workaround

Delete ~/.cache/zsh4humans/v5/cache/direnv

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions