Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 394187 - app-admin/eselect: package-manager.bash should use EROOT instead of ROOT for portageq calls
Summary: app-admin/eselect: package-manager.bash should use EROOT instead of ROOT for ...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: eselect (show other bugs)
Hardware: All All
: Normal normal (vote)
Assignee: Gentoo eselect Team
URL: http://archives.gentoo.org/gentoo-alt...
Whiteboard:
Keywords: InVCS
Depends on:
Blocks:
 
Reported: 2011-12-09 20:11 UTC by Zac Medico
Modified: 2012-01-21 19:41 UTC (History)
1 user (show)

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


Attachments
fix package-manager.bash to use EROOT instead of ROOT for portageq calls (eselect-eroot.patch,2.50 KB, patch)
2011-12-09 20:11 UTC, Zac Medico
Details | Diff
fix package-manager.bash to use EROOT instead of ROOT for portageq calls (eselect-eroot.patch,2.45 KB, patch)
2011-12-09 21:44 UTC, Zac Medico
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Zac Medico gentoo-dev 2011-12-09 20:11:49 UTC
Created attachment 295317 [details, diff]
fix package-manager.bash to use EROOT instead of ROOT for portageq calls

This fixes `eselect news` for compatibility with >=sys-apps/portage-2.2.01.19833 (prefix branch), as well as mainline portage when installed in a prefix, as discussed here:

http://archives.gentoo.org/gentoo-alt/msg_4097bbff93bb737f2976d60facb67dc9.xml
Comment 1 Ulrich Müller gentoo-dev 2011-12-09 20:22:46 UTC
Shouldn't it be "${EROOT:-/}" instead of "${EROOT}" everywhere? AFAICS, portageq (from stable Portage) doesn't like an empty second argument.
Comment 2 Zac Medico gentoo-dev 2011-12-09 20:26:05 UTC
I think the follwing lines from bin/eselect.in guarantee that EROOT is set:

# Support variables for Gentoo Prefix
EPREFIX="@EPREFIX@"
EROOT="${ROOT}${EPREFIX}"
Comment 3 Ulrich Müller gentoo-dev 2011-12-09 20:30:55 UTC
Yes, it is guaranteed that EROOT is set, but still it may be the empty string.
Comment 4 Zac Medico gentoo-dev 2011-12-09 20:35:23 UTC
This should fix it:

  EROOT=${EROOT%/}/

Like ROOT, it's standard for EROOT to have a trailing slash.
Comment 5 Fabian Groffen gentoo-dev 2011-12-09 20:46:03 UTC
EROOT="${ROOT%/}${EPREFIX%/}/"

(although EPREFIX is not supposed to end with a /)
Comment 6 Ulrich Müller gentoo-dev 2011-12-09 21:35:39 UTC
Sorry, but I don't think that anything is broken with the way eselect currently assigns the EROOT variable. EROOT will be identical with ROOT if EPREFIX is empty, and I believe that's how it's supposed to be. (Also I don't know how many of the external eselect modules such a change would break.)

It should be fixed in the place where portageq is called in the package-manager module. What's the problem with passing ${EROOT:-/} as argument, which will just avoid the case of an empty string?
Comment 7 Zac Medico gentoo-dev 2011-12-09 21:44:37 UTC
Created attachment 295321 [details, diff]
fix package-manager.bash to use EROOT instead of ROOT for portageq calls

(In reply to comment #6)
> It should be fixed in the place where portageq is called in the package-manager
> module. What's the problem with passing ${EROOT:-/} as argument, which will
> just avoid the case of an empty string?

That will work fine. Here's an updated patch.
Comment 8 Ulrich Müller gentoo-dev 2011-12-09 22:08:27 UTC
Revision 856 in trunk.
Comment 9 Ulrich Müller gentoo-dev 2012-01-21 19:41:03 UTC
Fixed in eselect-1.3.