scop / bash-completion

Programmable completion functions for bash
GNU General Public License v2.0
2.8k stars 377 forks source link

[Regression] make autocompletion skips install #1219

Open tsdgeos opened 2 weeks ago

tsdgeos commented 2 weeks ago

Describe the bug

To reproduce

  1. rename the Makefile.txt to Makefile (github won't let me upload it with it's correct name) and put it in a folder
  2. cd to 'directory_that_contains_attached_Makefile'
  3. Type 'make inst' and press the TAB key
  4. See that it autocompletes to make install/

Expected behavior

It should autocomplete to make install like it used to (given that there is an install target in the Makefile)

Versions (please complete the following information)

Additional context

This used to work with bash completion 2.11

akinomyoga commented 2 weeks ago
  1. rename the Makefile.txt

Minimal reproducer:

install:
.PHONY : install
install/fast:
.PHONY : install/fast
install/local:
.PHONY : install/local
akinomyoga commented 2 weeks ago

The current implementation of the make completion assumes install to be a directory name when other targets like install/fast and install/local exist. Then, it considers that the main targets are install/fast and install/local and removes the target install assuming it is a secondary target just to prepare a directory for the main targets.

Maybe we can preserve the phony targets as is, but in the current implementation, the stages of generating targets and filtering the paths are separated. The latter stage doesn't know which ones were generated as phony targets.

tsdgeos commented 2 weeks ago

The current implementation of the make completion assumes install to be a directory name when other targets like install/fast and install/local exist.

Please don't do that :)