-
Notifications
You must be signed in to change notification settings - Fork 391
fix(gcc): explicitly check existence of the commands #772
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
Conversation
c842946
to
322b263
Compare
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
322b263
to
96ac410
Compare
It's not yet completed, but I think I need to ask for the opinion from @scop. Let me change this from a Draft PR to a normal PR. There are still many other cases that can be affected by Instead of prepending _comp_command() {
type -- "$1" &>/dev/null && command "$@"
} What do you think? |
My general mindset is still the same as in #390; we'd have to do this in a lot of places, and I'm not a fan of that at all. But I suppose our options are
Regarding 1), note that we already have a recipe for Line 257 in a855714
|
I was thinking that maybe we can add workarounds only when there is a report. If we would like to cover them at once, we can actually search for
I received reports for Fedora 35 (akinomyoga/ble.sh#192) and 36 (akinomyoga/ble.sh#203). In Fedora, the |
OK, I found it: PackageKit/PackageKit#67 The code is still there in the current version, |
I think I need to withdraw this PR because it turned out that this is an issue specific to ble.sh (as far as This is still an issue when |
Cool. Reported https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1015215 for Debian, guess it'll trickle to various derivatives from there. |
When at least one of the commands
cc
,c++
,f77
, andf95
is not found in the system, on the first load ofgcc
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 PR fixes the issue by checking the existence of commands before running these commands.As suggested in #390, maybe we could ask for some support by the upstream Bash, e.g., an option to turn off the
command_not_found_handle
hook or just totally disablingcommand_not_found_handle
for the programmable completions. Nonetheless, I think we can eliminate the chances of unintendedcommand_not_found_handle
calls for the existing Bash versions.Refs.
Sorry, this PR is again draft. I'm kind of busy so let me open the PR so I don't forget about it and revisit it later. I think I need to survey similar cases in the codebase. Also, I need to test it.