Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 424777

Summary: app-shells/gentoo-bashcomp - /usr/share/bash-completion/gentoo fails when make.conf is in /etc/portage
Product: Gentoo Linux Reporter: Jeroen Roovers (RETIRED) <jer>
Component: Current packagesAssignee: Gentoo Shell Tools project <shell-tools>
Status: RESOLVED FIXED    
Severity: normal CC: 1i5t5.duncan, aranea, gentoo, rhill
Priority: Normal Keywords: InVCS, PATCH
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://bugs.gentoo.org/show_bug.cgi?id=434574
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: user-side (post-install) patch

Description Jeroen Roovers (RETIRED) gentoo-dev 2012-07-04 15:15:06 UTC
--- 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
Comment 1 Mira Ressel 2012-09-10 11:57:46 UTC
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
     )
 }
Comment 2 Jeroen Roovers (RETIRED) gentoo-dev 2012-09-10 16:08:19 UTC
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.
Comment 3 Jeroen Roovers (RETIRED) gentoo-dev 2012-09-11 15:02:22 UTC
( One other issue with the caching version would be that it should still (periodically?) check whether the cached location is still correct. )
Comment 4 Duncan 2012-09-12 00:22:26 UTC
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.
Comment 6 Ryan Hill (RETIRED) gentoo-dev 2012-10-24 04:34:45 UTC
Fixed in 20121024.