Broken tab completed on make under linux

I have no idea how tabs work, but suddenly my mine is broken. I don’t even know what information to provide, except for use. there is a clean target in the makefile.

$ make c<tab> results in

$ make c23:set: command not found lean

EDIT: I believe that somehow I ruined the built-in set bash, as man set says No manual entry for set and which set doesn't say anything. However, the calling set on the terminal gives the result.

I use: GNU bash, version 4.3.11 (1) -release (x86_64-pc-linux-gnu) and GNU Make 3.81

+7
linux bash tab-completion makefile
source share
3 answers

thanks to Etan's comment and Aaron's tip on where the makefiles are, I was able to debug this.

I ran set -x to keep track of what happens when performing a tab. The output of make c<tab> consists mainly of commands from the bash completion file for make located in /usr/share/bash-completion/completions/make (1). However, I noticed a mismatch between the output and the file. Towards the end, the exit said:

 + local mode=-- + (( COMP_TYPE != 9 )) ++ set +o ++ grep --colour=auto -n -F posix + local 'reset=23:set +o posix' + set +o posix 

which I identified as matching these lines from the file:

 if (( COMP_TYPE != 9 )); then mode=-d # display-only mode fi local reset=$( set +o | grep -F posix ); set +o posix # for <(...) 

So the output was grep --colour=auto -n instead of grep . Indeed, I set this alias for grep

Do the job as soon as I remove the alias.

I hope this helps others debug their problems.

EDIT: I sent an error report here: https://alioth.debian.org/tracker/index.php?func=detail&aid=315108&group_id=100114&atid=413095

+12
source share

See /etc/bash_completion , /etc/bash_completion.d and / or /usr/share/bash-completion/completions . You should find a make file that contains a script that will be called when Tab is pressed.

Use the packaging system of your Linux distribution to verify the file (or possibly revert to an older version).

Another reason for this may be something in the Makefile that the parser issues at the end of the BASH script from the track.

+2
source share

Do not try to get any loans here, but the best solution is actually a little hidden in the comments ... Please vote this comment instead of my answer!

simple steps to fix this:

 sudo vi /usr/share/bash-completion/completions/make 

find the line with the grep instruction. It should look like this:

 local reset=$( set +o | grep -F posix ); set +o posix # for <(...) 

add " \ " before the "grep" command:

 local reset=$( set +o | \grep -F posix ); set +o posix # for <(...) 
+1
source share

All Articles