ohmyzsh: Breezy causes zsh to hang

Describe the bug With Breezy installed on Debian Bullseye the zsh prompt might hang while waiting for breezy to show the commit revision. (git-status)

Additionally within bigger git repositories breezy will hang for enormous amounts of time and produce a git revision like this:

 master  bzr@revision-id: git-v1:0xvery_long_shasum

To Reproduce

  1. Either use a theme with git status or enable git-prompt (bzr-prompt)
  2. Clone a bigger repository or use oh-my-zsh
  3. Chdir into that folder
  4. Wait for the prompt
  5. Bonus: see some useless information

Expected behavior within a git repository do not call bzr and do not show its output

Screenshots or recordings

System:

  • OS: Linux (Debian Bullseye)
  • Zsh version 5.7.1
  • Gnome-Terminal

Additional context It seems that breezy will provide a bzr and brz binary. I guess it is a drop in replacement for Bazar that additionally supports git.

I could fix the issue with uninstalling breezy, but there might be people out there who use that versioning tool and their experience will be really bad.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 2
  • Comments: 20 (7 by maintainers)

Most upvoted comments

This just started happening to me as well. My Arch install updated breezy (replaced a conflicting module) than suddenly /usr/bin/bzr was on the system PATH and I got the hanging prompt when cd’ing to a directory that contains a git repo. I’m using a slightly modified version of the Agnoster theme that I keep in sync with the original. By removing the prompt_bzr routine from the theme I can avoid the hanging. Anyone using Agnoster out of the box will be affected by this Breezy bug.

The agnoster theme bundled in OMZ strays very far from the official one and is in need of a big revamp. That said, this changed prompt_bzr function may fix your issue until we refactor the agnoster theme (copy-paste it to the terminal and enter a git repository):

prompt_bzr() {
  (( $+commands[bzr] )) || return

  # Test if bzr repository in directory hierarchy
  local dir="$PWD"
  while [[ ! -d "$dir/.bzr" ]]; do
    [[ "$dir" = "/" ]] && return
    dir="${dir:h}"
  done

  local bzr_status status_mod status_all revision
  if bzr_status=$(bzr status 2>&1); then
    status_mod=$(echo -n "$bzr_status" | head -n1 | grep "modified" | wc -m)
    status_all=$(echo -n "$bzr_status" | head -n1 | wc -m)
    revision=$(bzr log -r-1 --log-format line | cut -d: -f1)
    if [[ $status_mod -gt 0 ]] ; then
      prompt_segment yellow black "bzr@$revision ✚"
    else
      if [[ $status_all -gt 0 ]] ; then
        prompt_segment yellow black "bzr@$revision"
      else
        prompt_segment green black "bzr@$revision"
      fi
    fi
  fi
}

Just ran into this after upgrading to Pop!_OS 20.04.

Commenting out prompt_bzr in the oh-my-zsh Agnoster theme’s build_prompt() function seems to have solved it. (I also commented out prompt_hg.

Why run bzr status inside a git repository in the first place?

From what I see in the agnoster theme source, it is actually run everywhere, just like git. All integrations run independently. It just isn’t so slow when not in a git repository.

Sounds like a huge waste of resources to me, surely a simple if [ -d .git ] would be lighter (and certainly smarter) than running git status everywhere. For instance prezto only runs git and bzr commands where it makes sense, haven’t had any issue with git repositories since the breezy switch.