Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

]777;preexec\ before and : 1 after the output #147

Open
willianrampazzo opened this issue May 22, 2024 · 5 comments
Open

]777;preexec\ before and : 1 after the output #147

willianrampazzo opened this issue May 22, 2024 · 5 comments

Comments

@willianrampazzo
Copy link

I have just installed bash_kernel for some testing and all my cell outputs have ]777;preexec�\ before and : 1 after the output. The : 1 output is show on a red line. Is it expected?

Example:

�]777;preexec�\ls: cannot access 'foo': No such file or directory
: 1

image

Software versions:

$ bash --version
GNU bash, version 5.2.26(1)-release (x86_64-redhat-linux-gnu)
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
$ jupyter --version
Selected Jupyter core packages...
IPython          : 8.24.0
ipykernel        : 6.29.4
ipywidgets       : not installed
jupyter_client   : 8.6.1
jupyter_core     : 5.7.2
jupyter_server   : 2.14.0
jupyterlab       : 4.2.0
nbclient         : 0.10.0
nbconvert        : 7.16.4
nbformat         : 5.10.4
notebook         : 7.2.0
qtconsole        : not installed
traitlets        : 5.14.3
@takluyver
Copy link
Owner

It's not expected - it's probably something to do with your local config of bash.

This script from pexpect tries to reset bash to a predictable state for bash_kernel & similar programs to use, while still picking up things you probably want like custom aliases:

https://github.com/pexpect/pexpect/blob/master/pexpect/bashrc.sh

But bash is pretty flexible, so it's probably missing something.

@willianrampazzo
Copy link
Author

Thanks for the quick reply!

I've spawned a fresh Fedora 40 virtual machine and tested the bash kernel. The output is still the same. The script you mentioned did not help.

I'll investigate deeper when I have some spare time.

@takluyver
Copy link
Owner

Ah, I think it's something Fedora is setting in /etc/bash_profile.d/vte.sh. We/Pexpect might want to reset PS0 as well as PS1, and/or unset VTE_VERSION so the vte (GTK terminal library) customisations don't get used.

The script you mentioned did not help.

Sorry, I wasn't very clear: bash_kernel already uses that script to set up bash. I wouldn't expect running it again to fix it.

@willianrampazzo
Copy link
Author

That was it!

Without investigating the cause, I've just removed the /etc/profile.d/vte.sh file and commands that succeed now show correctly using the bash kernel. Commands that return anything other than 0 still show the return code with a red line at the bottom of the output.

Feel free to close this issue as a "user-side problem" or use it to track the change you suggested in the previous comment.

Thanks again for your quick replies and help!

@willianrampazzo
Copy link
Author

FYI, as a workaround on my side, I added "VTE_VERSION": "" to https://github.com/takluyver/bash_kernel/blob/master/bash_kernel/install.py#L16, and it did the trick.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants