Skip to content

test_bash_integration fails with bash 5.2.0-release #5629

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

Closed
lcheylus opened this issue Oct 27, 2022 · 10 comments
Closed

test_bash_integration fails with bash 5.2.0-release #5629

lcheylus opened this issue Oct 27, 2022 · 10 comments
Labels

Comments

@lcheylus
Copy link

lcheylus commented Oct 27, 2022

Describe the bug
When I try to build Kitty v0.26.4 on Debian testing/amd64, test_bash_integration test fails with bash version 5.2.0-release

To Reproduce
Steps to reproduce the behavior:

  1. Build kitty 0.26.4 with python3 setup.py build
  2. Run tests with python3 setup.py test
  3. See error
======================================================================
FAIL: test_bash_integration (kitty_tests.shell_integration.ShellIntegration)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/fox/tmp/kitty-tmp/kitty/launcher/../../kitty_tests/shell_integration.py", line 372, in test_bash_integration
    self.ae(env.get('ES'), 'a\n `b` c\n$d', f'Screen contents: {pty.screen_contents()!r}')
    env = {'BASH_SILENCE_DEPRECATION_WARNING': '1', 'KITTY_INSTALLATION_DIR': '/home/fox/tmp/kitty-tmp', 'LANG': 'en_US.UTF-8', 'PATH': '/home/fox/tmp/kitty-tmp/kitty/launcher:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games', 'PYTHONDONTWRITEBYTECODE': '1', 'TERM': 'xterm-kitty', 'TERMINFO': '/home/fox/tmp/kitty-tmp/terminfo'}
    ps1 = 'line1\nprompt> '
    pty = <kitty_tests.PTY object at 0x7f0a48c32ad0>
    q = '/tmp/tmp5q9ttnai/testing-cwd-notification-🐱'
    redrawn = <function ShellIntegration.test_bash_integration.<locals>.redrawn at 0x7f0a451e3ac0>
    run_test = <function ShellIntegration.test_bash_integration.<locals>.run_test at 0x7f0a451e3b50>
    self = <kitty_tests.shell_integration.ShellIntegration testMethod=test_bash_integration>
    setup_env = <function ShellIntegration.test_bash_integration.<locals>.setup_env at 0x7f0a45164ca0>
AssertionError: None != 'a\n `b` c\n$d' : Screen contents: '[bash.bashrc]\nclone-in-kitty\nline1\nprompt> clone-in-kitty\nline1\nprompt> '

----------------------------------------------------------------------
Ran 140 tests in 6.792s

FAILED (failures=1, skipped=5)

Bash version is 5.2.0(1)-release :

$ bash --version
GNU bash, version 5.2.0(1)-release (x86_64-pc-linux-gnu)
@lcheylus lcheylus added the bug label Oct 27, 2022
@kovidgoyal
Copy link
Owner

dup of #5473

@lcheylus
Copy link
Author

Sorry but it's not a duplicate of #5473 : my Bash release is an official one, not a RC with DEBUG enabled.

In comment #5473 (comment) you write that my output "[bash.bashrc]\nclone-in-kitty\nline1\nprompt> clone-in-kitty\nline1\nprompt>" is the expected one with a normal bash.

@kovidgoyal
Copy link
Owner

Ah OK, I saw debian testing and assumed it had DEBUG. When bash 5.2.0 comes to Arch I will investigate, dont have the time to build bash from source right now.

@jamessan
Copy link
Contributor

Should this be left open, then?

@kovidgoyal kovidgoyal reopened this Nov 15, 2022
@ctrlcctrlv
Copy link
Contributor

I can confirm this is not a Debian packaging problem. Happens for me in the exact same way when I try to run tests with a Bash compiled from bash-5.2.9.tar.gz from the official gnu.org site.

@kovidgoyal
Copy link
Owner

IIRC kitty.bash doesn't use the DEBUG trap, in fact it doesnt use traps
at all.

@ctrlcctrlv
Copy link
Contributor

Yeah I was wrong about that, deleted it 😅 but I know you tend to reply to emails, not look at the tracker. Sorry.

@ctrlcctrlv
Copy link
Contributor

Here's something I'm more sure of...the shell integration doesn't seem to be working, not only the test, in Bash 5.2.

default syntax highlighter: pygmentize
fred@mapache:~/Workspace/kitty$ echo $KITTY_^V^V
$KITTY_INSTALLATION_DIR  $KITTY_PID               $KITTY_PUBLIC_KEY        $KITTY_WINDOW_ID         
fred@mapache:~/Workspace/kitty$ echo $KITTY_

Looking at the scripts, I think this test failure is legitimate: we can no longer read from the Bash environment in the way we're expecting.

Such that this happens:

fred@mapache:~/Workspace/kitty$ export KITTY_SHELL_INTEGRATION="enabled"
fred@mapache:~/Workspace/kitty$ echo $KITTY_SHELL_INTEGRATION 
enabled
fred@mapache:~/Workspace/kitty$ . ./shell-integration/bash/kitty.bash
fred@mapache:~/Workspace/kitty$ echo $KITTY_SHELL_INTEGRATION 

fred@mapache:~/Workspace/kitty$ 

@kovidgoyal
Copy link
Owner

kitty.bash explicitly unsets KITTY_SHELL_INTEGRATION that is not a sign
of shell integration not working.

@ctrlcctrlv
Copy link
Contributor

How does Kitty get the env back from the subprocess?

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

No branches or pull requests

4 participants