Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 92479 - gentoo-bashcomp appends "\*" when completing "emerge =pkgname-wrongversion"
Summary: gentoo-bashcomp appends "\*" when completing "emerge =pkgname-wrongversion"
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High minor (vote)
Assignee: Gentoo Shell Tools project
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks:
 
Reported: 2005-05-13 02:28 UTC by Ryan Hill (RETIRED)
Modified: 2005-05-15 23:54 UTC (History)
0 users

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


Attachments
do shopt -qs nullglob in subshell (bash-compl.pkg-vers2.patch,473 bytes, patch)
2005-05-13 10:03 UTC, Emil Beinroth
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ryan Hill (RETIRED) gentoo-dev 2005-05-13 02:28:30 UTC
if you're emerging a specific version of a package (=pkgname-1.0.0), and you attempt to tab-complete when the version number entered so far is illegitimate, instead of not completing, you'll get "\* " appended to the command line.



Reproducible: Always
Steps to Reproduce:
1. emerge -aDtv =gentoo-bashcomp-1<tab>

Actual Results:  
root ~ # emerge -aDtv =gentoo-bashcomp-1\* 

Expected Results:  
since there is no version of gentoo-bashcomp starting with 1...

<beep>
root ~ # emerge -aDtv =gentoo-bashcomp-1

this occurs with any non-existant package version, subversion, beta date,
r-bump, etc.

my installed version is gentoo-bashcomp-20050506.
Comment 1 Aaron Walker (RETIRED) gentoo-dev 2005-05-13 07:01:39 UTC
doesnt seem to just happen with versions either

emerge =non-existent<TAB> does the same thing.
Comment 2 Emil Beinroth 2005-05-13 10:03:56 UTC
Created attachment 58824 [details, diff]
do shopt -qs nullglob in subshell

The completion uses the cache in PORTDIR/metadata/cache to complete versions of
packages. There is a for-loop that removes the 'category/' prefix for every
expansion of *-*/COMPLETEME*.
Thus, if *-*/COMPLETEME* expands to nothing, '*-*/' is removed and
'COMPLETEME<tab>' becomes 'COMPLETEME*'.

There are two fixes I can think of (The patch uses the first one):
1) shopt -qs nullglob in the subshell ("If the nullglob option is set, and no
matches are found, the word is removed") or
2) [[ -f $i ]] && echo ${i##*/}
Comment 3 Aaron Walker (RETIRED) gentoo-dev 2005-05-13 10:20:35 UTC
heh victim of my own advice.  I was just telling slarti the other day how you should always check for existence when using glob loops :)

Anyways, it's fixed upstream.  Will be fixed next release.
Comment 4 Aaron Walker (RETIRED) gentoo-dev 2005-05-15 23:54:42 UTC
20050516 released.