ohmybash / oh-my-bash

A delightful community-driven framework for managing your bash configuration, and an auto-update tool so that makes it easy to keep up with the latest updates from the community.
https://ohmybash.github.io
MIT License
5.55k stars 626 forks source link

[distrobox] Agnoster theme broken #464

Closed AlbertoFabbri93 closed 9 months ago

AlbertoFabbri93 commented 11 months ago

As written in the title I am using Agnoster and it breaks when I enter a folder with a git repo and it shows the various git info. This is an example:

image

I am using a Powerline font.

akinomyoga commented 11 months ago

Thanks for the report.

AlbertoFabbri93 commented 11 months ago
  • What is the output of echo "$PS1" | cat -v?

I do not think this makes any sense but the output is: \[^[[0m\]\[^[[0;40m\] albi@\h \[^[[30;44m\]M-nM-^BM-0\[^[[0;44;30m\] \w \[^[[0;34m\]M-nM-^BM-0 \[^[[0m\]

  • What is your terminal?

Gnome Terminal

  • What is your operating system or distribution?

OpenSuse Aeon

akinomyoga commented 11 months ago

Thanks.

  • What is the output of echo "$PS1" | cat -v?

I do not think this makes any sense but the output is: \[^[[0m\]\[^[[0;40m\] albi@\h \[^[[30;44m\]M-nM-^BM-0\[^[[0;44;30m\] \w \[^[[0;34m\]M-nM-^BM-0 \[^[[0m\]

What is the result when the problem arises, i.e., could you try echo "$PS1" | cat -v in a working tree of any git repository?

  • What is your operating system or distribution?

OpenSuse Aeon

Ah, OK. Thanks! I hadn't noticed that you are an identical user as in #413.

AlbertoFabbri93 commented 11 months ago

What is the result when the problem arises, i.e., could you try echo "$PS1" | cat -v in a working tree of any git repository?

\[^[[0m\]\[^[[0;40m\] albi@\h \[^[[30;44m\]M-nM-^BM-0\[^[[0;44;30m\] \w \[^[[34;42m\]M-nM-^BM-0\[^[[0;42;30m\] M-nM-^BM- main^M \[^[[0;32m\]M-nM-^BM-0 \[^[[0m\]

Ah, OK. Thanks! I hadn't noticed that you are an identical user as in #413.

No problem :)

akinomyoga commented 11 months ago

... M-nM-^BM- main^M \[^[[0;32m\]M-nM-^BM-0 \[^[[0m\]

OK, ^M (CR, Carriage Return) after main is the issue.

AlbertoFabbri93 commented 11 months ago

OK, ^M (CR, Carriage Return) after main is the issue.

image Makes sense :)

What is the output of the command git symbolic-ref HEAD | cat -v in a working tree of any git repository?

refs/heads/main^M

akinomyoga commented 11 months ago

I guess this is again a Distrobox matter related to the TTY settings. The TTY converts the newlines between LF <-> CR LF for terminals. The terminal basically accepts CR LF so the TTY sitting between the terminal and the application converts LF -> CR LF in the application-to-terminal stream. However, this time the recipient is not a terminal but another command, so the conversion shouldn't take place. This could also be reported to Distrobox later.

AlbertoFabbri93 commented 11 months ago

Ah ok, thank you for the explanation, very interesting! It seems like distrobox introduces a lot of issue when it comes to customizing bash.

It is really a pity :( and I will probably stop using oh-my-bash until this is fixed but it should definitely be reported. I will have a look if anybody already reported something similar.

Thank you very much!

AlbertoFabbri93 commented 11 months ago

I was thinking that I do not really need to disable oh-my-bash completely, I only have problems when executing binaries through distrobox so disabling the git plugin should fix the problem for me. I will lose those functionality but I should be able to keep using the rest of oh-my-bash.

Better than nothing :)

akinomyoga commented 9 months ago

The problem has been fixed in the upstream Distrobox https://github.com/89luca89/distrobox/issues/965. It should be applied to the next release of Distrobox. Let me close the issue. Thank you for your report.