Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 248487 - app-admin/eselect - Output from 'eselect profile show' is not suitable for setting profile
Summary: app-admin/eselect - Output from 'eselect profile show' is not suitable for se...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal minor (vote)
Assignee: Gentoo eselect Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-11-23 23:17 UTC by Thomas Bellman
Modified: 2009-04-08 05:37 UTC (History)
1 user (show)

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


Attachments
Patch making 'show' display relative pathname (eselect-profile-show-relative.patch,1.34 KB, patch)
2008-11-23 23:26 UTC, Thomas Bellman
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Bellman 2008-11-23 23:17:09 UTC
When running 'eselect profile show', the shown path is an
absolute path, that can't be passed back to 'eselect profile set':

    # eselect --no-color profile show
    Current make.profile symlink:
      /usr/portage/profiles/default/linux/x86/2008.0/server

    # eselect --no-color profile set /usr/portage/profiles/default/linux/x86/2008.0/server
    !!! Error: Target "/usr/portage/profiles/default/linux/x86/2008.0/server" doesn't appear to be valid!
    Killed

I *believe* the intent is for 'eselect profile show' to display
just "default/linux/x86/2008.0/server".  There is code that seems
to try to do that.  The function do_show() in profile.eselect has
this line:

    link=${link##..${ROOT}/${portdir}/profiles/}

However, $link has been set using readlink -f (via the canonicalise()
function), which gives us an absolute pathname.  I think this would
be a proper rewrite:

		local link=$(canonicalise "${ROOT}/etc/make.profile")
		local portdir=$(portageq portdir)
		local profiledir=$(canonicalise "${ROOT}/${portdir}/profiles")
		link=${link##${profiledir}/}
		write_kv_list_entry "${link}" ""

(Let's just hope that $ROOT or $portdir never contains ? or *...)

Another possibility would be to match against "*profiles/", which
is what do_list() does when it tries to determine which profile is
the active one.  However, I feel that it would be more prudent to
change do_list() to be more conservative in what it strips, similar
to my suggested changes for do_show(); currently it can give a
false positive for symlinks that point to other places.
Comment 1 Thomas Bellman 2008-11-23 23:26:37 UTC
Created attachment 173096 [details, diff]
Patch making 'show' display relative pathname

This patch makes 'eselect profile show' display the name of the current
profile relative to /usr/portage/profiles.  A symlink pointing to somewhere
outside /usr/portage/profiles will still be shown as an absolute path.

It also makes 'eselect profile list' not identify a profile as active when
the make.profile symlink points somewhere outside of /usr/portage/profiles
that just happens to end in the same way as a valid profile.
Comment 2 Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2009-04-08 05:37:16 UTC
also in -r2, thx for the patch