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

Two potential bugs #192

Closed
telometto opened this issue May 2, 2022 · 11 comments
Closed

Two potential bugs #192

telometto opened this issue May 2, 2022 · 11 comments

Comments

@telometto
Copy link

telometto commented May 2, 2022

ble version: 0.4.0-devel3+d340233
Bash version: 5.1.8(1)-release (x86_64-redhat-linux-gnu)
Distro: Fedora 35

I do not know what is causing it, but there's an issue I discovered by chance when I tried to pass the command gcc -v: as soon as i enter the v it prompts me to install a package, which is impossible to escape. I've tried both N and y, but the terminal is stuck and I have to exit it by pressing the 'x' (a pop-up window then shows up and asks me if I really want to kill the terminal window when there's a process still running). Please refer to the image below.

bug

Also, not an issue per sé, but maximizing and minimizing the terminal does the following (I maximized and minimized several times for the screenshots):

Minimizing
min

Maximizing
max

EDIT: edited to reflect correct OS version.

@akinomyoga
Copy link
Owner

Thank you for the report.

  • Could you provide me with the result of pressing Ctrl+x Ctrl+v?
  • What would be the result of the following commands?
$ complete -p gcc
$ type command_not_found

Also, not an issue per sé, but maximizing and minimizing the terminal does the following (I maximized and minimized several times for the screenshots):

Could you describe it more? Is the picture of minimizing the expected behavior? Or is the picture of maximizing the expected one? I do not have information about what is your prompt setup (such as prompt_rps1, prompt_ps1_transient, etc.) and thus do not know what would be the expected result. For example, What is the result of the following commands:

$ declare -p PS1 | cat -v
$ bleopt prompt_@

@telometto
Copy link
Author

telometto commented May 3, 2022

  • Ctrl + X Ctrl + V yields this:
GNU bash, version 5.1.8(1)-release (x86_64-redhat-linux-gnu)
ble.sh, version 0.4.0-devel3+d340233 (noarch)
bash-completion, version 2.11 (hash:3503cc3400612a3c6b4373391bc2835efb70e1d6, 76322 bytes) (noarch)
locale: LANG=en_US.UTF-8 LC_COLLATE=C LC_MEASUREMENT=nb_NO.UTF-8 LC_MONETARY=nb_NO.UTF-8 LC_NUMERIC=nb_NO.UTF-8 LC_PAPER=nb_NO.UTF-8 LC_TIME=nb_NO.UTF-8
terminal: TERM=xterm-256color wcwidth=14.0-west/14.0-2+ri, vte:6602 (65;6602;1)
$ complete -p gcc
bash: complete: gcc: no completion specification

$ type command_not_found
bash: type: command_not_found: not found

Could you describe it more?

Yes, well, the thing that happens is that the input prompt comes up again. Same as if you press Enter inside the terminal without typing anything, if that makes sense?

  • The two commands:
$ declare -p PS1 | cat -v
declare -- PS1="\\[\\e[1;35m\\]\\u\\[\\e[0m\\]@\\[\\e[1;36m\\]\\H\\[\\e[0m\\]:\\[\\e[1;32m\\]\\w\\[\\e[0m\\]\\n\\[\\e[1;32m\\]\$\\[\\e[0m\\] "

$ bleopt prompt_@
bleopt prompt_command_changes_layout=
bleopt prompt_eol_mark=$'\e[94m[ble: EOF]\e[m'
bleopt prompt_ps1_final=
bleopt prompt_ps1_transient=
bleopt prompt_rps1=
bleopt prompt_rps1_final=
bleopt prompt_rps1_transient=
bleopt prompt_ruler=
bleopt prompt_screen_title=
bleopt prompt_status_align=$'justify=\r'
bleopt prompt_status_line=
bleopt prompt_term_status=
bleopt prompt_xterm_title=

EDIT: code block formatting.

@akinomyoga
Copy link
Owner

akinomyoga commented May 4, 2022

Thank you for the information.

$ complete -p gcc
bash: complete: gcc: no completion specification

Does it change after the error message has been shown?

$ type command_not_found
bash: type: command_not_found: not found

Thank you. Hmm, then, I don't have an idea. Maybe I need to set up Fedora 36. It doesn't reproduce at least in Fedora 35.

Is gcc installed in your Fedora 36? I'd like to know whether the problem arises when gcc is installed or when gcc is not installed.


Could you describe it more?

Yes, well, the thing that happens is that the input prompt comes up again. Same as if you press Enter inside the terminal without typing anything, if that makes sense?

OK, then this is actually a duplicate of #142, #154, #168, and #173. This behavior is an intended one and is related to the general problem of terminal implementations of text reflowing, which vary largely among terminals. The reasoning behind the current behavior of ble.sh is explained in #142 (comment). This general problem is also discussed in README of powerlevel10k.

The behavior of ble.sh can be configured by bleopt canvas_winch_action. As explained in #173 (comment), duplicate prompt lines on resizing can be suppressed by the following setting (though it might possibly delete previous command outputs on resizing):

# blerc
bleopt canvas_winch_action=redraw-prev

@telometto
Copy link
Author

Maybe I need to set up Fedora 36. It doesn't reproduce at least in Fedora 35.

No need to install F36: I noticed yesterday that I had written 36, so I corrected it to 35 😅

Hmm, then, I don't have an idea.

If you can't reproduce it, then the problem is on my end... it's my configuration that's causing this. Thanks for the help, though!

This behavior is an intended

Then everything is in order! I'll configure the canvas the way I like. Many thanks for the help 😊

akinomyoga added a commit to akinomyoga/bash-completion that referenced this issue Jul 8, 2022
When either one of the commands "cc", "c++", "f77", and "f95" is not
found in the system, on the first load of "gcc" completions,
"command_not_found_handle" hook (typically set by distributions) is
invoked in the middle of completion, breaks the terminal layout by
outputting messages, and eats user inputs.  This commit fixes the
issue by checking the existence of commands before running these
commands.

Refs.
akinomyoga/ble.sh#203
akinomyoga/ble.sh#192
scop#390
akinomyoga added a commit to akinomyoga/bash-completion that referenced this issue Jul 8, 2022
When at least one of the commands "cc", "c++", "f77", and "f95" is not
found in the system, on the first load of "gcc" completions,
"command_not_found_handle" hook (typically set by distributions) is
invoked in the middle of completion, breaks the terminal layout by
outputting messages, and eats user inputs.  This commit fixes the
issue by checking the existence of commands before running these
commands.

Refs.
scop#390
akinomyoga/ble.sh#192
akinomyoga/ble.sh#203
@akinomyoga
Copy link
Owner

I do not know what is causing it, but there's an issue I discovered by chance when I tried to pass the command gcc -v: as soon as i enter the v it prompts me to install a package, which is impossible to escape. I've tried both N and y, but the terminal is stuck and I have to exit it by pressing the 'x' (a pop-up window then shows up and asks me if I really want to kill the terminal window when there's a process still running). Please refer to the image below.

@telometto There has been an issue #203 about the same problem. I've identified the cause and added a workaround in commit 64d471a.

@telometto
Copy link
Author

@akinomyoga oh, so it wasn't a problem on my end?

I'll update as soon as I'm back from work and give you an update 👌

@akinomyoga
Copy link
Owner

This seems to happen only when the packages bash-completion and PackageKit are installed in Fedora. I hadn't installed PackageKit in my Fedora 35/36 (I've upgraded to Fedora 36 recently), which was the reason that it didn't reproduce in my environment.

@telometto
Copy link
Author

This seems to happen only when the packages bash-completion and PackageKit are installed in Fedora.

You're probably right. I tried disabling PackageKit using # systemctl disable --now packagekit and re-running gcc -v after updating ble but the problem still persists; I get the "pop-up" again and I force quit the window, I reopen a terminal and check the systemctl status packagekit and it is magically enabled again. It's not much of a problem, since I do not check GCC's version and happened to stumble across it. Thanks for the update ^_^

@akinomyoga
Copy link
Owner

re-running gcc -v after updating ble but the problem still persists;

Ah, OK. Thank you for the information. I have again tried to reproduce the problem, and finally, I could reproduce it in my environment after installing the package PackageKit-command-not-found (sorry it was not the package PackageKit). Then, I added an additional workaround d5fe1d1. Sorry for disturbing you repeatedly, but if you have time, could you again update ble.sh and see if it is finally fixed?

@telometto
Copy link
Author

@akinomyoga

Sorry for disturbing you repeatedly

Not at all! If anything, I've been the one disturbing you 😅

if you have time, could you again update ble.sh and see if it is finally fixed?

I've updated it, and it works a charm! The fix worked 🚀
Thanks a lot for fixing this!

@akinomyoga
Copy link
Owner

Thank you!

akinomyoga added a commit to akinomyoga/bash-completion that referenced this issue Jul 10, 2022
When at least one of the commands "cc", "c++", "f77", and "f95" is not
found in the system, on the first load of "gcc" completions,
"command_not_found_handle" hook (typically set by distributions) is
invoked in the middle of completion, breaks the terminal layout by
outputting messages, and eats user inputs.  This commit fixes the
issue by checking the existence of commands before running these
commands.

Refs.
scop#390
akinomyoga/ble.sh#192
akinomyoga/ble.sh#203
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