Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 385523 - app-shells/bash-completion-1.3 'base' file incomplete
Summary: app-shells/bash-completion-1.3 'base' file incomplete
Status: RESOLVED WORKSFORME
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Shell Tools project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-03 17:44 UTC by Paul Davis
Modified: 2011-10-10 16:30 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Davis 2011-10-03 17:44:31 UTC
In the src_install() function of the ebuild, the bash_completion file is awk'ed into three files 'base' / '.pre' / '.post' which based on the nomenclature I would guess was meant to be stitched back together. As it is not, a number of functions deposited in '.pre' are consequently missing (for example: _usergroup() ). The result is certain completions (such as chown in the coreutils file) will not work as intended.

The solution is expect is a subsequent 'cat "${ED}"/usr/share/bash-completion/.pre "${ED}"/usr/share/bash-completion/base "${ED}"/usr/share/bash-completion/.post > "${ED}"/usr/share/bash-completion/base' after the awk. Or something equivalent anyway.

Reproducible: Always
Comment 1 Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2011-10-10 03:37:21 UTC
Huh? It isn't meant to be "stitched back together" ... Please post the output of "eselect bashcomp list|grep \*"
Comment 2 Paul Davis 2011-10-10 13:54:10 UTC
The result of the eselect bashcomp list includes base and coreutils amongst many (hence my discovery after trying to understand what had happened so long ago to the auto-completion of users during chown's bash completion). This is due to the incomplete base file that has a number of requisite functions missing (for this example _usergroup() ). This is due to the ebuild having awk'ed them into the out '.pre' file as opposed to the out 'base' file.

My cursory glance at the differences between bash-completion v1.2 and v1.3 would seem a number of functions seemed to have been redistributed into the bash-completion executable file (the progenitor of the base file). My subsequent simple code review found that for some unknown reason the file was dissected into 4 parts: base, .pre, .post, and the remainder (I would guess those parts which could cause interference). With such named sections it would seem logical that they were to be cat'ed back together (sans the troublesome portions), but that the one line which would do so was missing.

The other explanation was that the new version somehow missed regression testing when adding the newly redistributed functions, but that would not seem to explain the necessity for the two additional files '.pre' and '.post' (not to mention missing a host of completions which depend on those functions).

However it is, I look forward to your solution. Please let me know how I can help if you need it.
Comment 3 Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2011-10-10 15:03:56 UTC
Hello again, if you look at /etc/profile.d/bash-completion.sh you will see where .pre gets sourced. As I already stated, the "missing functions" should not be in the base file.

Anyway, I can't reproduce your issue (missing _usergroup()) and the chown completion works just fine for me.
Comment 4 Paul Davis 2011-10-10 15:21:52 UTC
Yep, definitely can see in _load_completions() where they should be sourced, but a quick test seems that this is not called when starting a new shell. I'll look into this more this evening when I have time.

Thanks for looking into this.

FYI: my test case is 'chown uucp <file>' if this helps.
Comment 5 Paul Davis 2011-10-10 16:30:16 UTC
OK, made some time and figured it out (my mistake).

It does run .pre (my quick test checked for running _usergroup() which didn't, but going back checked that the .pre runs). Which made me scratch my head, some sort of persistence problem.

In the .bashrc I had:
 [[ -f /etc/profile.d/bash-completion.sh ]] &&  /etc/profile.d/bash-completion.sh
instead of the correct
 [[ -f /etc/profile.d/bash-completion.sh ]] && . /etc/profile.d/bash-completion.sh
or more properly
 [[ -f /etc/profile.d/bash-completion.sh ]] && source /etc/profile.d/bash-completion.sh

So files would autocomplete (99% of what I use it for) but the bash-completion never would (sort of the point)!

Perhaps a quick double-check in the TAB-Completion wiki entry that might check the the .pre file functions are operational (not just file completion) would be just the thing to ensure people like me don't make a similar mistake (although I can't seem to find such an example that exists in base, being the only eselect that runs regardless of set).

Thanks again for checking this!