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

Bug 403215

Summary: profile.eselect breaks when overlay contains '-gentoo' substring
Product: Gentoo Hosted Projects Reporter: Ulrich Müller <ulm>
Component: eselectAssignee: Gentoo eselect Team <eselect>
Status: RESOLVED FIXED    
Severity: normal CC: slyfox
Priority: Normal Keywords: InVCS
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: Patch for profile.eselect

Description Ulrich Müller gentoo-dev 2012-02-11 22:05:54 UTC
Created attachment 301609 [details, diff]
Patch for profile.eselect

Reported by Sergei Trofimovich <slyfox@gentoo.org>:

Before patching:
    $ ./_inst/bin/eselect profile list
    !!! Error: Cannot get list of repositories
    !!! Error: Failed to get a list of valid profiles
    exiting
After patching:
    $ ./_inst/bin/eselect profile list
    !!! Warning: Both /etc/make.profile and /etc/portage/make.profile exist.
    !!! Warning: Using /etc/make.profile for now.
    Available profile symlink targets:
      [1]   default/linux/amd64/10.0 *
      [2]   default/linux/amd64/10.0/selinux
      [3]   default/linux/amd64/10.0/desktop
      ...

List of my repository names:
   gentoo gentoo-haskell local-cross-overlay slyfox-gentoo
The last one 'slyfox-gentoo' matched against '\bgentoo\b'
('-' is a nonword character) and broke horribly.
Comment 1 Ulrich Müller gentoo-dev 2012-02-11 22:30:58 UTC
Thanks for pointing this out. There's a small problem with your patch: ^ and $ don't match beginning and end of line, but beginning and end of pattern. Therefore the second substitution won't have any effect at all.

However, this can be cured by adding the "m" flag to the substitution. Can you try if the following change fixes the problem for you:

-		| sed "s/[[:space:]]\+/\n/g;s/\b${DEFAULT_REPO}\b/ &/" \
+		| sed "s/[[:space:]]\+/\n/g;s/^${DEFAULT_REPO}\$/ &/gm" \
Comment 2 Sergei Trofimovich (RETIRED) gentoo-dev 2012-02-12 05:19:31 UTC
(In reply to comment #1)
> Thanks for pointing this out. There's a small problem with your patch: ^ and $
> don't match beginning and end of line, but beginning and end of pattern.
> Therefore the second substitution won't have any effect at all.
> 
> However, this can be cured by adding the "m" flag to the substitution. Can you
> try if the following change fixes the problem for you:
> 
> -        | sed "s/[[:space:]]\+/\n/g;s/\b${DEFAULT_REPO}\b/ &/" \
> +        | sed "s/[[:space:]]\+/\n/g;s/^${DEFAULT_REPO}\$/ &/gm" \

Oh, my sed is very weak. Looks like I was very lucky having 'gentoo' alphasorted properly.

Your change works for me as well.

Thanks!
Comment 3 Ulrich Müller gentoo-dev 2012-02-12 08:21:47 UTC
<http://sources.gentoo.org/cgi-bin/viewvc.cgi/eselect?view=revision&revision=865>

+2012-02-12  Ulrich Müller  <ulm@gentoo.org>
+
+       * modules/profile.eselect (get_repos): Fix regular expression
+       for overlays, bug 403215. Thanks to Sergei Trofimovich
+       <slyfox@gentoo.org>.
+
Comment 4 Ulrich Müller gentoo-dev 2012-04-11 19:32:03 UTC
This is fixed in eselect-1.3.1.