--- a/gentoo +++ b/gentoo @@ -23,6 +23,7 @@ ( source @GENTOO_PORTAGE_EPREFIX@/etc/make.globals 2>/dev/null source @GENTOO_PORTAGE_EPREFIX@/etc/make.conf 2>/dev/null + source @GENTOO_PORTAGE_EPREFIX@/etc/portage/make.conf 2>/dev/null echo ${PORTDIR} if [[ $1 == '-o' ]] ; then
Wouldn't this be a more future-proof fix? --- a/gentoo +++ b/gentoo @@ -21,12 +21,9 @@ _portdir() { ( - source /etc/make.globals 2>/dev/null - source /etc/make.conf 2>/dev/null - - echo ${PORTDIR} + echo $(portageq portdir) if [[ $1 == '-o' ]] ; then - echo ${PORTDIR_OVERLAY} + echo $(portageq portdir_overlay) fi ) }
That would be both utterly canonically correct and terribly slow, especially when not caching the result. First checking for a "private" environment variable, say $_GENTOO_BASHCOMP_PORTDIR, and setting it if unset, would mitigate this problem, of course, but you would still be running it in every single shell.
( One other issue with the caching version would be that it should still (periodically?) check whether the cached location is still correct. )
Created attachment 323564 [details] user-side (post-install) patch This patch is based on the first one, but works better when applied (by normal users not prefix) after src_prepare or post-installation. Here, I was able to simply drop it in /etc/portage/patches/app-shells/gentoo-baskcomp/ as make.conf.patch, and remerge. However, it doesn't appear the ebuild would trigger epatch_user on its own, so it's only applied by my local /etc/portage/bashrc hack that forces epatch_user in post_src_prepare, and thus simply dropping it in the appropriate place under /etc/portage/patches/ and remerging won't work for most people. But it should be easier to apply to the live filesystem version post-install than the first one, too. Apply it either manually, or via the usual patch -pX from the appropriate subdir. The target file is /usr/share/bash-completion/gentoo.
http://git.overlays.gentoo.org/gitweb/?p=proj/gentoo-bashcomp.git;a=commit;h=5760ed3e83158ab70dc43de5bbf21431f3f1ecd4
Fixed in 20121024.