`-bash: ble/builtin/trap/.handler: [...] -bash: ble/util/setexit: No such file or directory`
$ ble summary
GNU bash, version 5.3.3(1)-release (aarch64-apple-darwin24.4.0)
ble.sh, version 0.4.0-devel4+14f98dd (noarch) [git 2.50.1, GNU Make 3.81, GNU Awk 5.3.1, API 4.0, (GNU MPFR 4.2.2, GNU MP 6.3.0)]
locale: LANG=en_US.UTF-8
terminal: TERM=xterm-kitty wcwidth=16.0-west/16.0-2+ri, tmux:0 (84;0;0)
options: -emacs +notify +vi +autocd +cdspell +inherit_errexit +login_shell
These lines are printed after each execution when using the vscode/cursor integrated terminal and I also get this in kitty sometimes, but only sometimes, vscode/cursor it's every time.
-bash: ble/builtin/trap/.handler: No such file or directory
-bash: ble/util/setexit: No such file or directory
This typically happens when set -o posix is set, but the problem doesn't arise with my environment (which is not VS Code or kitty).
- Q1: What are the result of the following commands?
$ declare -p SHELLOPTS
$ builtin trap
- Q2: Do you set
set -o posixorPOSIXLY_CORRECT=...in your shell configuration? Or do you setshas the shell in the terminal's setting?
Yes, posix is set. Shell is bash.
$ declare -p SHELLOPTS
bash: ble/builtin/trap/.handler: No such file or directory
bash: ble/util/setexit: No such file or directory
declare -r SHELLOPTS="braceexpand:hashall:histexpand:history:interactive-comments:monitor:notify:posix:vi"
And I can confirm that the lines disappear when opting out of posix.
So this is expected behavior then I assume, and one should disable posix when using ble.sh?
- Q1: What is the result of the following command?
$ builtin trap
So this is expected behavior then I assume, and one should disable
posixwhen using ble.sh?
Bash 5.3 started to disable any function names containing / in the POSIX mode, so all ble.sh functions containing / in their function names as a namespace separator started to fail to work. Nevertheless, ble.sh tries to switch between POSIX (for user commands) and non-POSIX modes (for ble.sh's internal processing), so it is supposed to work. Ideally, all functions that can be called in the context of the user commands could be renamed to or wrapped in functions without / in their names, but what kind of functions may be called in the user-command context depends, so the information is needed.
Aha interesting!
$ builtin trap
bash: ble/builtin/trap/.handler: No such file or directory
bash: ble/util/setexit: No such file or directory
trap -- 'ble/builtin/trap/.handler 0 "$BASH_COMMAND" "$@"; builtin eval -- "${_ble_builtin_trap_postproc[0]}" \# "${_ble_builtin_trap_lastarg[0]}"' EXIT
trap -- 'ble/builtin/trap/.handler 2 "$BASH_COMMAND" "$@"; builtin eval -- "${_ble_builtin_trap_postproc[2]}" \# "${_ble_builtin_trap_lastarg[2]}"' INT
trap -- 'ble/builtin/trap/.handler 28 "$BASH_COMMAND" "$@"; builtin eval -- "${_ble_builtin_trap_postproc[28]}" \# "${_ble_builtin_trap_lastarg[28]}"' WINCH
trap -- 'ble/builtin/trap/.handler 1000 "$BASH_COMMAND" "$@"; builtin eval -- "${_ble_builtin_trap_postproc[1000]}" \# "${_ble_builtin_trap_lastarg[1000]}"' DEBUG
OK, so the DEBUG trap is present in your setup, and the trap string set by ble.sh is called through the DEBUG trap even in the user-command context. I could reproduce the problem:
$ bash --norc
$ source /path/to/ble.sh --norc
$ trap 'echo DEBUG' DEBUG
DEBUG
DEBUG
DEBUG
DEBUG
$ set -o posix
DEBUG
$ echo hello
bash: ble/builtin/trap/.handler: No such file or directory
bash: ble/util/setexit: No such file or directory
hello
I'll think about a good way to work around this.
Appreciated!