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

bash: seeing extra leading character '[' in command output #4494

Open
jparise opened this issue Jan 3, 2025 · 5 comments
Open

bash: seeing extra leading character '[' in command output #4494

jparise opened this issue Jan 3, 2025 · 5 comments

Comments

@jparise
Copy link
Collaborator

jparise commented Jan 3, 2025

Discussed in #3566

Originally posted by jharshman December 27, 2024
After compiling from source and running I am seeing an extra character in the output of every command. Is anyone else experiencing this? Shell is Bash and no modifications to the PS1.

[josh@serenity ghostty]$ echo hi
[hi
[josh@serenity ghostty]$ pwd
[/home/josh/Projects/ghostty
info: ghostty version=1.0.1-dev+0000000
info: ghostty build optimize=ReleaseFast
info: runtime=apprt.Runtime.gtk
info: font_backend=font.main.Backend.fontconfig_freetype
info: dependency harfbuzz=8.4.0
info: dependency fontconfig=21402
info: renderer=renderer.OpenGL
info: libxev backend=main.Backend.io_uring
info(os): setlocale from env result=en_US.UTF-8
info(gtk): GTK version build=4.12.4 runtime=4.16.5
```</div>
@mitchellh
Copy link
Contributor

@jparise Thanks for converting. I can't tell from the discussion but did you get a lead on what is causing this? More importantly: do you have an easy reproduction?

@mitchellh mitchellh changed the title Seeing extra leading character '[' in command output bash: seeing extra leading character '[' in command output Jan 3, 2025
@jparise
Copy link
Collaborator Author

jparise commented Jan 3, 2025

@jparise Thanks for converting. I can't tell from the discussion but did you get a lead on what is causing this? More importantly: do you have an easy reproduction?

Unfortunately, no to both. I tried a bunch of things myself (details in the discussion), but I haven't been able to reproduce or identify the root cause. Multiple people have seen it in various Linux environments though.

@jharshman
Copy link

@jparise I'm happy to assist in creating an environment in which this is reproducible. Let me know if you want an extra set of hands on this.

@jparise
Copy link
Collaborator Author

jparise commented Jan 5, 2025

@jparise I'm happy to assist in creating an environment in which this is reproducible. Let me know if you want an extra set of hands on this.

Yes, that would be very helpful. Thanks for the offer!

@vhodges
Copy link

vhodges commented Jan 5, 2025

I have replicated the issue outside of Ghostty (eg in Gnome Terminal) on NixOS.

Setup:

mkdir -p temp/share/ghostty/shell-integration/bash/
cp $GHOSTTY_RESOURCES_DIR/shell-integration/bash/* temp/share/ghostty/shell-integration/bash/ #(or from src/shell-integration/bash)

# Then run the following (I put them into a test.sh file I could 'source' repeatably)

export GHOSTTY_BASH_INJECT=true
export GHOSTTY_RESOURCES_DIR=$HOME/temp/share/ghostty
builtin source $GHOSTTY_RESOURCES_DIR/shell-integration/bash/ghostty.bash

I tried putting traces before and after all of the printf calls as well as the PS* entries and the '[' still prints before all of them. I don't believe the issue to be related to the prompt.

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

4 participants