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
"make" completion is overwriting readline keybindings #190
Comments
|
No idea offhand. Is make completion the only thing this happens with? |
|
To the best of my knowledge, yes. I haven't systematically tested this with any of the others, but I can say with some level of certainty that this is the first time that I've ever ran into this. I use a pretty wide array of tools that have associated completions on a frequent basis, so I'm somewhat certain that this issue stems from the make completion itself. |
|
As far as I can tell, the completion for |
|
Yes, I can reproduce it; haven't tried to narrow it down, though. |
|
I tried isolating the cause, but now (on a different machine) I am unable to reproduce. The binding isn't removed any longer. Can you reproduce with a minimal makefile, or is anything special about it? |
|
Nope, nothing special about the file. I'm able to reproduce with the following Makefile on my machine: .PHONY: foo
foo:
@echo foo
.PHONY: bar
bar:
@echo bar |
|
Can't reproduce using the given Makefile, current bash-completion master, and |
|
Hmmm, and now, on the same machine where I observed it yesterday, I can't see it any longer |
|
Update: Just tested using the official docker The plot thickens.... |
|
I used Bash 4.4.18, I think, I have to check when I'm back at the machine. Here's a way to narrow down the cause: if you set your PS4='$(bind -q menu-complete):${BASH_SOURCE##*/}:${LINENO}: 'and then attempt completion for |
|
@bewuethr Good idea! I think I spotted it... Looks like it's either the Interestingly, for whatever reason, the line numbers of those calls aren't actually 70 and 74, but 155 and 156, respectively. Thoughts? |
|
I can't figure out how to reproduce this separately; does it not happen if you remove |
|
@bewuethr I'll give that a shot when I get back to my main machine later this evening. One thing that I am doing that many (or most) other bash users probably don't do is I set |
|
I use |
|
If POSIX mode is enabled, process substitution command sed -nf <(_make_target_extract_script $mode "$cur")They don't have to do that, though. This is equivalent and doesn't require process substitution: _make_target_extract_script $mode "$cur" | command sed -n -f -This would work without messing with the POSIX shell option. |
|
Good stuff on debugging, but I'm afraid the fix is not that simple -- currently the sed command reads data it needs to operate on from stdin, so it cannot read the sed script from stdin. |
|
Forgot to note that I agree if unsetting posix mode causes this, it sounds like a bash bug and should be reported there. |
|
Oh, right, duh. Not that easy. |
|
@scop Can you explain what you mean here:
I read that like 6 times and I can't seem to wrap my head around what you mean. I'm familiar and somewhat competent in sed, so the confusion is not what sed is, but really instead just need clarification on what you're referring to when you say "it" the few times that you use it. Also....
How do you suggest going about reporting this seeing as I'm ostensibly the only person out of us 3 here that can reliably reproduce this? |
Sed can operate on either a file, like sed 's/old/new/' fileor on standard input, like cat file | sed 's/old/new/'Instead of declaring the commands directly, you can read them from a file with the cat file | sed -f sedscript.sedor, operating on a file instead of stdin: sed -f sedscript.sed fileInstead of making sed modify standard input when piping to sed (as in the second example), you can tell it to read the commands from standard input by specifying cat sedscript.sed | sed -f - fileIn the <commands> | sed -f <(other_commands)where |
|
@bewuethr Aha.. didn't catch that sneakly little |
|
What is preventing us from just passing the output of |
|
On Fri, Mar 9, 2018 at 7:26 PM, Derek Sifford ***@***.***> wrote:
it sounds like a bash bug and should be reported there.
How do you suggest going about reporting this seeing as I'm ostensibly the only person out of us 3 here that can reliably reproduce this?
Using the regular bash bug reporting instructions:
https://www.gnu.org/software/bash/manual/html_node/Reporting-Bugs.html
|
…tution Unsetting posix mode may reportedly interfere with keybindings (#190).
|
On Sat, Mar 10, 2018 at 2:01 AM, Derek Sifford ***@***.***> wrote:
What is preventing us from just passing the output of _make_target_extract_script as a parameter instead of a file redirect?
Duh, nothing I guess :). Done in 153d6d4
|
|
@dsifford @bewuethr did we ever get to the bottom of in which environments does this occur? The video thingy (?) in the original report is no longer available, the comments don't idenfify the readline version etc. I'm contemplating starting to use the Would be nice to be able to reproduce, know how widespread the problem is, which versions are affected, and if it's specifically posix mode or potentially other options (lastpipe and monitor in this case, and other options elsewhere in bash-completion) whose toggling provokes it. |
|
@scop AFAIK my issue was resolved? I'm having a hard time remembering the specifics here as well. I can try reproducing again using my example i posted and report back if you like. I attempted to unarchive the asciinima recording but unfortunately it looks like it's gone for good. |
|
It was resolved, right, but as said I'm considering use of similar constructs again, much more than just make -- perhaps even the exact one that caused problems in your scenario if we can be confident enough the conditions in which it will bite are rare "enough". See my previous comment for details. Testing and reports welcome. |
|
Happy to help test. What would you like from me? |
|
If you can source the following snippet and then invoke _completion_test_lastpipe()
{
printf "\n%s\n" "testing lastpipe"
bind -q menu-complete
local reset=$(
shopt -op monitor
shopt -p lastpipe
)
shopt -ou monitor
shopt -s lastpipe
printf "%s\n" "hello"
$reset
bind -q menu-complete
}
complete -F _completion_test_lastpipe test-lastpipe
_completion_test_posix()
{
printf "\n%s\n" "testing posix"
bind -q menu-complete
local reset=$(
shopt -op posix
)
shopt -ou posix
printf "%s\n" "hello"
$reset
bind -q menu-complete
}
complete -F _completion_test_posix test-posixI can't get any problems to arise: |
|
@scop
|
|
Ooh, excellent. Can you help me try to replicate it? What kind of environment is this -- distribution, bash, and readline versions, inputrc or other readline config, bashrc's? Feel free to send me email if you'd rather not upload configs in public. |
|
Certainly. dsifford ~
(ins) $ uname -a
Linux archlinux.desktop 5.7.2-arch1-1 #1 SMP PREEMPT Wed, 10 Jun 2020 20:36:24 +0000 x86_64 GNU/Linux
dsifford ~
(ins) $ bash --version
GNU bash, version 5.0.17(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
dsifford ~
(ins) $ pacman -Qi readline
Name : readline
Version : 8.0.004-1My dotfiles are here: https://github.com/dsifford/.dotfiles Relevant files: |
|
Thanks, got it. set editing-mode vi
Tab: menu-completeThere was a brief mention of filing a bash bug about this in the original discussion, did anyone get around to do that? |
|
From memory, I did not report this. I may have and just forgot about it though. |
|
I didn't report anything either. |
|
Apparently fixed in bash 5.1, according to Chet's response! |
|
Yep, that's nice -- however for bash-completion it means we should refrain from touching posix mode until 5.1 or later is the oldest supported version. I wonder if that's going to happen during this decade ;) |
|
Pretty crazy that they fixed this February of 2019 for Bash 5.1 and now (in nearly July 2020) they don't even have an RC for 5.1. What a wild release cycle that must be. Must be a backwards compatibility nightmare. |
Problematic because it can cause keybindings to change. #190
Problematic because it can cause keybindings to change. #190
Problematic because it can cause keybindings to change. #190

For whatever reason, the
makecompletion is overwriting the globally set tab keybinding (which I have set tomenu-complete).This is easily reproducible. Check the example below.
Why could this be happening?
The text was updated successfully, but these errors were encountered: