-bash: __bp_set_ret_value: command not found on MacOS - bash - powerline

I am trying to set up atuin on MacOS with bash (5.2) and powerline, all installed from homebrew. Installation for both ble.sh and atuin was straight forward, but I am getting this error when I open up a new terminal and after I run any command:

-bash: __bp_set_set_value: command not found

I have edited .bashrc to turn on and off both ble.sh and atuin, and the problem goes away when I don’t load atuin.

~/.bashrc
source ~/.local/share/blesh/ble.sh
#eval "$(atuin init bash)"

If I uncomment this, it will come back. After some searching around, I’m not sure what is causing this or how to fix it. Did I miss a step?

Which version of Atuin do you use? You can check the version by running atuin --version. This problem is supposed to be fixed by PR #1465, which was included in Release v17.2.0 (2024-01-03). If the Atuin version is older than 17.2.0, could you try the latest version of Atuin?

I am using atuin 18.3.0 and ble.sh 0.4.0-devel4+fcbf1ed (noarch).

Thanks for the version information. I again checked the codebase, but I don’t find any string __bp_set_ret_valuein either Atuin 18.3.0 and ble.sh. One possibility is that you have two different versions of Atuin in your system, and the integration is set up by an old atuin but the new atuin is called by precmd. What are the results of the following commands?

$ declare -p PATH
$ type -a atuin
1 Like

Good morning. As requested:

$ declare -p PATH
declare -x PATH="/opt/anaconda3/bin:/opt/anaconda3/condabin:/Users/Comnenus/.rd/bin:/Users/Comnenus/.rd/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/opt/X11/bin:/Library/Apple/usr/bin:/Applications/VMware Fusion Tech Preview.app/Contents/Public:/Applications/iTerm.app/Contents/Resources/utilities"
$ type -a atuin
atuin is /opt/homebrew/bin/atuin
atuin is /opt/homebrew/bin/atuin

Thank you for the result. Does the problem happen with the following setup?

# ~/.bashrc

# ...

source ~/.local/share/blesh/ble.sh
eval "$(/opt/homebrew/bin/atuin init bash)"

# ...

Also, what are the results of the following commands?

$ /opt/homebrew/bin/atuin | grep __bp_set_ret_value
$ /opt/homebrew/bin/atuin --version

After adding those lines to the end of ~/.bashrc, I still get the error:

Last login: Wed Jul 24 07:22:42 on ttys001
-bash: __bp_set_ret_value: command not found
-bash: __bp_set_ret_value: command not found
-bash: __bp_set_ret_value: command not found

Running those two commands gives me the same output:

$ /opt/homebrew/bin/atuin |grep __bp_set_ret_value
atuin 18.3.0
Ellie Huxtable <ellie@atuin.sh>
Magical shell history

Usage:
  atuin <COMMAND>

Commands:
  history          Manipulate shell history
  import           Import shell history from file
  stats            Calculate statistics for your history
  search           Interactive history search
  sync             Sync with the configured server
  login            Login to the configured server
  logout           Log out
  register         Register with the configured server
  key              Print the encryption key for transfer to another machine
  status           Display the sync status
  account          Manage your sync account
  kv               Get or set small key-value pairs
  store            Manage the atuin data store
  dotfiles         Manage your dotfiles with Atuin
  init             Print Atuin's shell init script
  info             Information about dotfiles locations and ENV vars
  doctor           Run the doctor to check for common issues
  daemon
  default-config   Print example configuration
  server           Start an atuin server
  uuid             Generate a UUID
  contributors
  gen-completions  Generate shell completions
  help             Print this message or the help of the given subcommand(s)

Options:
  -h, --help     Print help
  -V, --version  Print version
[ble: exit 1]
$ /opt/homebrew/bin/atuin |grep --version
atuin 18.3.0
Ellie Huxtable <ellie@atuin.sh>
Magical shell history

Usage:
  atuin <COMMAND>

Commands:
  history          Manipulate shell history
  import           Import shell history from file
  stats            Calculate statistics for your history
  search           Interactive history search
  sync             Sync with the configured server
  login            Login to the configured server
  logout           Log out
  register         Register with the configured server
  key              Print the encryption key for transfer to another machine
  status           Display the sync status
  account          Manage your sync account
  kv               Get or set small key-value pairs
  store            Manage the atuin data store
  dotfiles         Manage your dotfiles with Atuin
  init             Print Atuin's shell init script
  info             Information about dotfiles locations and ENV vars
  doctor           Run the doctor to check for common issues
  daemon
  default-config   Print example configuration
  server           Start an atuin server
  uuid             Generate a UUID
  contributors
  gen-completions  Generate shell completions
  help             Print this message or the help of the given subcommand(s)

Options:
  -h, --help     Print help
  -V, --version  Print version
grep (BSD grep, GNU compatible) 2.6.0-FreeBSD

However, I think I isolated the conflict, it’s the iterm2 shell integrations. After commenting out source ~/.iterm2_shell_integration.bash the errors have gone away.

The function is small.

__bp_set_ret_value() {
    return ${1:-}
}

And is called six times.

I wonder if this is an issue for anybody else using the iterm2 shell integrations? I verified I am using the latest revision.

Also, thank you for your help!

Ah, OK. Thank you for the information. I now understand what was happening.

Atuin’s integration enables ble.sh’s module called integration/bash-preexec, which provides an alternative implementation of bash-preexec.sh’s interface better integrated with ble.sh.

The problem is that iTerm’s shell integration appears to depend on __bp_set_ret_value, which is an “internal” interface of bash-preexec. integration/bash-preexec only provides the interface considered public (i.e., the documented one, the one starting with bash_preexec_, and the one starting with BP_). Therefore, if bash-preexec.sh is replaced with ble.sh’s integration/bash-preexec, iTerm’s shell integration fails. I’ll consider adding __bp_set_ret_value in integration/bash-preexec later.

I added a fix 803852c@akinomgayo/blesh-contrib for ble.sh/contrib/integration/bash-preexec. You can update ble.sh by running ble-update in a ble session. I think the combination of blesh + atuin + iTerm2 integration would work now.

1 Like

The updated ble.sh has fixed this problem, thank you again!

1 Like