Bug 1352312

Summary: Bash completion regression - doesn't work for Makefiles
Product: [Fedora] Fedora Reporter: Pavel Stehule <pavel.stehule>
Component: bash-completionAssignee: Ville Skyttä <ville.skytta>
Status: CLOSED WONTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 24CC: ooprala, pavel.stehule, sheltren, ville.skytta
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-07 13:35:31 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
trace log none

Description Pavel Stehule 2016-07-03 16:21:02 UTC
Description of problem:

Bash completion is not well configured for Makefiles.

How reproducible:

go to some directory with "Makefile" file. Try to write
make and the completion list is based on files, not on Makefile entries.

Comment 1 Ville Skyttä 2016-07-03 18:23:02 UTC
Works fine for me, for example in the prepared bash-completion development dir. Need (much) more details and exact reproducer to be able to say more.

Comment 2 Pavel Stehule 2016-07-03 18:35:45 UTC
I am using PostgreSQL source directory

[pavel@nemesis postgresql]$ pwd
/home/pavel/src/postgresql
[pavel@nemesis postgresql]$ ls 
aclocal.m4  config.log     configure     contrib    doc          GNUmakefile     HISTORY   README      src
config      config.status  configure.in  COPYRIGHT  finitdb_log  GNUmakefile.in  Makefile  README.git  tmp_install
[pavel@nemesis postgresql]$ make 
config.status  GNUmakefile    src/           
[pavel@nemesis postgresql]$ make 


expected: all check install installdirs installcheck installcheck-parallel ...

I tested another source - bash - and it doesn't work too.

My installation is fresh Fedora 24.

Comment 3 Ville Skyttä 2016-07-04 07:27:26 UTC
Works for me on F24 and prepared bash source dir. For some reason producing the completions takes a long time the first time, but the expected ones eventually appear, and it's quick afterwards.

Still need more info, see Troubleshooting in bash-completion's README.md, and post the generated output somewhere for examination.

Comment 4 Pavel Stehule 2016-07-04 14:33:50 UTC
Created attachment 1176081 [details]
trace log

trace log for auto complete in PostgreSQL src directory

Comment 5 Pavel Stehule 2016-07-04 14:50:12 UTC
I found some example of using  _make_target_extract_script

It doesn't work on my comp

sed -nrf <(_make_target_extract_script --) Makefile

sed -nrf <(_make_target_extract_script --) Makefile
+ sed -nrf /dev/fd/63 Makefile
_make_target_extract_script --
++ _make_target_extract_script --
++ local mode=--
++ shift
++ local prefix=
+++ command sed 's/[][\,.*^$(){}?+|/]/\\&/g'
+++ sed 's/[][\,.*^$(){}?+|/]/\\&/g'
++ local prefix_pat=
++ local basename=
++ local dirname_len=0
++ [[ -- == -d ]]
++ local 'output=\1\2'
++ cat
++ [[ -z '' ]]
++ cat
sed: file /dev/fd/63 line 22: invalid reference \2 on `s' command's RHS

Comment 6 Ville Skyttä 2016-07-04 17:58:02 UTC
(In reply to Pavel Stehule from comment #5)
> It doesn't work on my comp
> 
> sed -nrf <(_make_target_extract_script --) Makefile

That's most likely because of the "r" in -nrf. I don't know where you got it, we don't call "sed -nrf" but "sed -nf".

(I haven't looked at your trace yet.)

Comment 7 Pavel Stehule 2016-07-04 19:31:24 UTC
(In reply to Ville Skyttä from comment #6)
> (In reply to Pavel Stehule from comment #5)
> > It doesn't work on my comp
> > 
> > sed -nrf <(_make_target_extract_script --) Makefile
> 
> That's most likely because of the "r" in -nrf. I don't know where you got
> it, we don't call "sed -nrf" but "sed -nf".
> 
> (I haven't looked at your trace yet.)

It returns nothing

Comment 8 Ville Skyttä 2016-07-05 05:51:06 UTC
Reproduced with the PostgreSQL build dir also on F-23, moving discussion to upstream at https://github.com/scop/bash-completion/issues/53

Comment 9 Ville Skyttä 2016-07-07 13:35:31 UTC
Closing as WONTFIX per upstream resolution wrt PostgreSQL dir. If you find other Makefiles for which completion doesn't work, feel free to file new bugs (preferably upstream), one per case.