bash_kernel icon indicating copy to clipboard operation
bash_kernel copied to clipboard

Unexpected "preexec" characters with every output in Fedora 35

Open moneroexamples opened this issue 3 years ago • 3 comments

When echoing anything I'm getting strange output:

]777;preexec

image

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:

image

Related to https://github.com/takluyver/bash_kernel/issues/115 and https://github.com/takluyver/bash_kernel/issues/107

moneroexamples avatar Feb 05 '22 13:02 moneroexamples

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.

gsauthof avatar Jul 03 '22 17:07 gsauthof

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.

takluyver avatar Jul 04 '22 10:07 takluyver

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.

gsauthof avatar Jul 06 '22 20:07 gsauthof

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 avatar Aug 24 '22 10:08 kdm9

@kdm9 Thanks for your help.

moneroexamples avatar Aug 24 '22 11:08 moneroexamples