bash-completion 20041017-r{1,2,3} specifically gentoo-bashcomp-1.0_beta4 can not retrieve PORTDIR location when the rute is inside quotes. Ej. emerge <TAB> -bash: cd: "/usr/portage: No such file or directory clean depclean inject metadata prune regen search sync system unmerge world Suggested Solutions. Fix the regex (Attached) or Use `portageq` (Attached)
Try this regrex: sed -n -e '/^PORTDIR=/ { s/^[^=]\+="\([^"]\+\|\S\+\).*/\1/p ; q }' /etc/make.conf /etc/make.globals
Created attachment 46202 [details, diff] gentoo-bashcomp-1.0_beta4-sedregexfix.diff Fix _portdir() function modifying sed regular expression. Based on Javier's suggestion.
Created attachment 46203 [details, diff] gentoo-bashcomp-1.0_beta4-sedregex2portageq.diff Fix _portdir() function using portageq instead sed regular expression. /usr/bin/portageq is part of portage.
GRrr, did not see it before... usefull info on bug #73266
While that regex works in cases where PORTDIR is quoted, it breaks on cases when it's not (try it, there's some interesting possible completions ;p).
sed -n -e '/^PORTDIR=/ { s/^[^=]\+="\?\([^"]\+\|\S\+\).*"\?/\1/p ; q }' \ /etc/make.conf /etc/make.globals can you guys test this? it works for me with or without quotes in make.conf.
Bah sorry there was an unneeded "\? on the end. sed -n -e '/^PORTDIR=/ { s/^[^=]\+="\?\([^"]\+\|\S\+\).*/\1/p ; q }' \ /etc/make.conf /etc/make.globals
Created attachment 46221 [details, diff] gentoo-bashcomp-1.0_beta4-sedregexfix.diff Right, my fault.. doesnt work when dont have quotes :-S Now it works for me too with or without quotes using your regex.
Fixed in upstream CVS; will close this bug next time Zach does a release (btw Zach, I've got a couple things to fix before you do).
Hrm, the better fix would be to fix your make.* files so that they always use double quotes... They're not bash files.
Ciaran, that'd be great and all but the default make.global itself doesn't use quotes and therefore it'd be broken by default.
> Hrm, the better fix would be to fix your make.* > files so that they always use double quotes... > They're not bash files. In my case, always have double quotes, in fact the problem (the bug) is only when it uses double quotes (") in PORTDIR No problem when not using it.
Problem remains on bash-completion-20050103. Still there are no upstream release. 20050103 is based on RELEASE_1_0_BETA_4. Is it possible to patch the sources via epatch until upstream release a new beta version?
20050103-r1 is in cvs. Diff against gentoo-bashcomp cvs HEAD has been committed until next release of gentoo-bashcomp (Zach, I'd like to fix bug 75225 before doing so).