bash_kernel
bash_kernel copied to clipboard
Unexpected "preexec" characters with every output in Fedora 35
When echoing anything I'm getting strange output:
]777;preexec
This seems to be caused by the following lines in /etc/profile.d/vte.sh
:
if [[ -n "${BASH_VERSION:-}" ]]; then
# Newer bash versions support PROMPT_COMMAND as an array. In this case
# only add the __vte_osc7 function to it, and leave setting the terminal
# title to the outside setup.
# On older bash, we can only overwrite the whole PROMPT_COMMAND, so must
# use the __vte_prompt_command function which also sets the title.
if [[ "$(declare -p PROMPT_COMMAND 2>&1)" =~ "declare -a" ]]; then
PROMPT_COMMAND+=(__vte_osc7) && PS0=$(printf "\033]777;preexec\033\\")
else
PROMPT_COMMAND="__vte_prompt_command" && PS0=$(printf "\033]777;preexec\033\\")
fi
elif [[ -n "${ZSH_VERSION:-}" ]]; then
precmd_functions+=(__vte_osc7)
fi
Commenting out the entire code above and adding bind 'set enable-bracketed-paste off'
seems to fix the issue:
Related to https://github.com/takluyver/bash_kernel/issues/115 and https://github.com/takluyver/bash_kernel/issues/107
FWIW, I'm also on Fedora 35, and I'm only affected by #107.
That means even with /etc/profile.d/vte.sh
I can't reproduce this issue after disabling bracketed paste.
My /etc/profile.d/vte.sh
contains a check that it's running under VTE, which skips the VTE integration if not:
# Not running under vte?
[ "${VTE_VERSION:-0}" -ge 3405 ] || return 0
Does yours have this? I guess it might be inheriting VTE_VERSION
if you've started Jupyter from a VTE based terminal (gnome-terminal or similar). So maybe bash_kernel
should just look for this and unset it, so bash doesn't think it's running in VTE.
Yes, my /etc/profile.d/vte.sh
also has that line.
And I'm also starting Jupyter from a terminal (that runs zsh - which probably doesn't make a difference).
But it isn't VTE based.
It's kitty.
I've recently taken on co-maintaining bash_kernel
, and I'm currently closing all old/stale issues.
I'm closing this issue as it should have been solved in version 0.8 with PR #120. Please reopen if you need further help.
@kdm9 Thanks for your help.