Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 301582 - [PATCH] app-shells/gentoo-bashcomp `_pkgname -A` doesn't filter categories
Summary: [PATCH] app-shells/gentoo-bashcomp `_pkgname -A` doesn't filter categories
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo Shell Tools project
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks:
 
Reported: 2010-01-20 00:01 UTC by Jacek Sowiński
Modified: 2010-06-13 02:29 UTC (History)
0 users

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


Attachments
patch fixing both issues in a way described above (gentoo-pkgname-A_category_completion.patch,1.19 KB, patch)
2010-01-20 00:04 UTC, Jacek Sowiński
Details | Diff
Do not show our variables to the world ;) (gentoo-pkgname-A_category_completion.patch,1.24 KB, patch)
2010-01-20 14:29 UTC, Jacek Sowiński
Details | Diff
Sorry, bad filenames in header. (gentoo-pkgname-A_category_completion.patch,1.21 KB, patch)
2010-01-20 23:58 UTC, Jacek Sowiński
Details | Diff
patch for issue described in comment #5 (gentoo-pkgname-A_filter_packages_duplicates.patch,1.03 KB, patch)
2010-01-21 00:39 UTC, Jacek Sowiński
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jacek Sowiński 2010-01-20 00:01:55 UTC
1. The exact number of categories in portage tree is (at the time of writing this bug-report) 153 (152 '*-*' categories + 'virtual'). '_pkgname -A' returns… 155, becouse it uses ${portdir}/metadata/cache for completion.

2. If system makes use of overlays, then every duplicated category won't be filtered. This results in premature end of completion, becouse test below fails in case of duplicates: 'if [[ ${#COMPREPLY[@]} == 1 ]]; then' (line #122).

Possible resolution consists of two parts:

1. use ${portdir} to look for categories. It is safe if you use proper filter;
2. filter duplicates, using hack from emerge completion command.

Reproducible: Always

Steps to Reproduce:
a)
1. # equery list<Tab><Tab>

b)
1. install any overlay (sunrise for instance) 
2. # equery list mail-m<Tab>
Actual Results:  
a) 'Display all 155 possibilities? (y or n)'

b) '# equery list mail-mta/ '
Don't miss the space after completed category, to continue completion you must hit 'backspace'

Expected Results:  
a) 'Display all 153 possibilities? (y or n)'

b) '# equery list mail-mta/'
Comment 1 Jacek Sowiński 2010-01-20 00:04:05 UTC
Created attachment 216952 [details, diff]
patch fixing both issues in a way described above
Comment 2 Jacek Sowiński 2010-01-20 00:16:24 UTC
Ebuild containing patches for this bug and #298919 and #298916:
http://bitbucket.org/mruwek/larrytheant/src/tip/app-shells/gentoo-bashcomp/
Comment 3 Jacek Sowiński 2010-01-20 14:29:03 UTC
Created attachment 216978 [details, diff]
Do not show our variables to the world ;)
Comment 4 Jacek Sowiński 2010-01-20 23:58:08 UTC
Created attachment 217026 [details, diff]
Sorry, bad filenames in header.
Comment 5 Jacek Sowiński 2010-01-21 00:04:54 UTC
Looks like analogical issue exists with packages completion.

Steps to reproduce:

1. install mpd overlay
2. enable 'gentoo' from app-shells/gentoo-bashcomp
3. # equery list media-sound/sona<Tab>

Actual results:

'# equery list media-sound/sonata '
To complete version you must hit <Backspace> and <Tab> again.

Patch in few minutes.
Comment 6 Jacek Sowiński 2010-01-21 00:39:03 UTC
Created attachment 217032 [details, diff]
patch for issue described in comment #5
Comment 7 Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2010-05-04 03:19:39 UTC
Thanks, applied to trunk
Comment 8 Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2010-06-13 02:29:23 UTC
Thanks again for the patches. 20100613 is in the tree!

+  13 Jun 2010; Jeremy Olexa <darkside@gentoo.org>
+  +gentoo-bashcomp-20100613.ebuild:
+  Version bump to fix bugs: 298919, 298916, 301582, 269498, 287092. Add
+  Gentoo Prefix support.