| Summary: | app-admin/eselect - Output from 'eselect profile show' is not suitable for setting profile | ||
|---|---|---|---|
| Product: | Gentoo Linux | Reporter: | Thomas Bellman <bellman> |
| Component: | Current packages | Assignee: | Gentoo eselect Team <eselect> |
| Status: | RESOLVED FIXED | ||
| Severity: | minor | CC: | darkside |
| Priority: | Normal | ||
| Version: | 2008.0 | ||
| Hardware: | All | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Package list: | Runtime testing required: | --- | |
| Attachments: | Patch making 'show' display relative pathname | ||
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.
also in -r2, thx for the patch |
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.