Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 757897 - app-portage/gentoolkit - "equery m git" shows one of 3 packages on each run, instead of reporting "Ambiguous package name." like "equery m glib" does.
Summary: app-portage/gentoolkit - "equery m git" shows one of 3 packages on each run, ...
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Portage Tools Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-12-01 15:54 UTC by flippynelle
Modified: 2022-05-27 18:48 UTC (History)
2 users (show)

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


Attachments
"equery m git" collision fixxage (equerymgit_2.patch,2.17 KB, patch)
2020-12-02 13:39 UTC, flippynelle
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description flippynelle 2020-12-01 15:54:57 UTC
The problem is in: /usr/lib/python3.7/site-packages/portage/dbapi/cpv_expand.py
this code here:
        if len(matches) > 1:
            virtual_name_collision = False
            if len(matches) > 1:
                for x in matches:
                    print("m", mycpv, x)
                    if not x.startswith(("acct-group/", "acct-user/", "virtual/")):
                        # Assume that the non-virtual is desired.  This helps
                        # avoid the ValueError for invalid deps that come from
                        # installed packages (during reverse blocker detection,
                        # for example).
                        mykey = x
                        print("n", mycpv, x)                                    
                    else:
                        print("o", mycpv, x)
                        virtual_name_collision = True
            if not virtual_name_collision:
                # AmbiguousPackageName inherits from ValueError,
                # for backward compatibility with calling code
                # that already handles ValueError.
                raise AmbiguousPackageName(matches)
        elif matches:
            mykey=matches[0]

I added the 3 print() statements.

Reproducible: Always

Steps to Reproduce:
1. equery m git
2. equery m glib

Actual Results:  
1.
# equery m git
m git acct-group/git
o git acct-group/git
m git acct-user/git
o git acct-user/git
m git dev-vcs/git
n git dev-vcs/git
m git dev-haskell/git
n git dev-haskell/git
m git dev-ruby/git
n git dev-ruby/git
gentoolkit/query.py  git dev-ruby/git-1.7.0
m git acct-group/git
o git acct-group/git
m git acct-user/git
o git acct-user/git
m git dev-vcs/git
n git dev-vcs/git
m git dev-haskell/git
n git dev-haskell/git
m git dev-ruby/git
n git dev-ruby/git
 * dev-ruby/git [gentoo]
Maintainer:  ruby@gentoo.org (Gentoo Ruby Project)
Upstream:    Remote-ID:   schacon/ruby-git ID: github
Homepage:    https://github.com/schacon/ruby-git
Location:    /var/db/repos/gentoo/dev-ruby/git
Keywords:    1.7.0:0: amd64
Keywords:    2.29.2:0: ~alpha ~amd64 ~amd64-linux ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc-aix ~ppc-macos
                       ~ppc64 ~riscv ~s390 ~sparc ~sparc-solaris ~sparc64-solaris ~x64-cygwin ~x64-macos
                       ~x64-solaris ~x86 ~x86-linux ~x86-macos ~x86-solaris
License:     MIT

1. (next run) different git package shown:
# equery m git
m git dev-vcs/git
n git dev-vcs/git
m git acct-group/git
o git acct-group/git
m git dev-ruby/git
n git dev-ruby/git
m git dev-haskell/git
n git dev-haskell/git
m git acct-user/git
o git acct-user/git
gentoolkit/query.py  git dev-haskell/git-0.3.0
m git dev-vcs/git
n git dev-vcs/git
m git acct-group/git
o git acct-group/git
m git dev-ruby/git
n git dev-ruby/git
m git dev-haskell/git
n git dev-haskell/git
m git acct-user/git
o git acct-user/git
 * dev-haskell/git [gentoo]
Maintainer:  haskell@gentoo.org (Gentoo Haskell)
Upstream:    None specified
Homepage:    https://github.com/vincenthz/hs-git
Location:    /var/db/repos/gentoo/dev-haskell/git
Keywords:    0.3.0:0/0.3.0: ~amd64 ~x86
Keywords:    2.29.2:0: ~alpha ~amd64 ~amd64-linux ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc-aix ~ppc-macos
                       ~ppc64 ~riscv ~s390 ~sparc ~sparc-solaris ~sparc64-solaris ~x64-cygwin ~x64-macos
                       ~x64-solaris ~x86 ~x86-linux ~x86-macos ~x86-solaris
License:     BSD


2. this one is correct:
# equery m glib
m glib dev-haskell/glib
m glib dev-libs/glib
!!! Ambiguous package name. Choose from:
  dev-haskell/glib
  dev-libs/glib


Expected Results:  
"equery m git" should show:
!!! Ambiguous package name. Choose from:
acct-group/git
acct-user/git
dev-vcs/git
dev-haskell/git
dev-ruby/git


or maybe not show the "acct" ones in the list, not sure.

Portage 3.0.11
Comment 1 flippynelle 2020-12-01 16:05:30 UTC
Correction, this block:

2. this one is correct:
# equery m glib
m glib dev-haskell/glib
m glib dev-libs/glib
!!! Ambiguous package name. Choose from:
  dev-haskell/glib
  dev-libs/glib

Should've been this:

2. this one is correct:
# equery m glib
m glib dev-haskell/glib
n glib dev-haskell/glib
m glib dev-libs/glib
n glib dev-libs/glib
!!! Ambiguous package name. Choose from:
  dev-haskell/glib
  dev-libs/glib
Comment 2 flippynelle 2020-12-02 13:39:15 UTC
Created attachment 676210 [details, diff]
"equery m git" collision fixxage

I'll be using this temp-patch until an official one is made, since I cannot wait until then.

Results:

# equery m git
!!! Ambiguous package name. Choose from:
  dev-haskell/git
  acct-group/git
  dev-vcs/git
  acct-user/git
  dev-ruby/git

# equery m git
!!! Ambiguous package name. Choose from:
  dev-vcs/git
  acct-group/git
  acct-user/git
  dev-ruby/git
  dev-haskell/git
Comment 3 Pacho Ramos gentoo-dev 2022-05-12 16:38:08 UTC
It happens to other equery commands as equery uses too
Comment 4 cyrillic 2022-05-14 22:51:24 UTC
(In reply to flippynelle from comment #1)
> 2. this one is correct:
> # equery m glib
> m glib dev-haskell/glib
> m glib dev-libs/glib
> !!! Ambiguous package name. Choose from:
>   dev-haskell/glib
>   dev-libs/glib
> 

I think this is a really assinine response from gentoolkit. When more than one package matches the query, all results should be displayed.

Another way to fix this would be to get rid of dev-haskell/* from the main gentoo repo, and stick it in an overlay.
Comment 5 Brian Dolbec gentoo-dev 2022-05-27 18:48:23 UTC
(In reply to cyrillic from comment #4)
> (In reply to flippynelle from comment #1)
> > 2. this one is correct:
> > # equery m glib
> > m glib dev-haskell/glib
> > m glib dev-libs/glib
> > !!! Ambiguous package name. Choose from:
> >   dev-haskell/glib
> >   dev-libs/glib
> > 
> 
> I think this is a really assinine response from gentoolkit. When more than
> one package matches the query, all results should be displayed.
> 
> Another way to fix this would be to get rid of dev-haskell/* from the main
> gentoo repo, and stick it in an overlay.

Pacho, the problem is with changes in portage code that spits out the "!!! Ambiguous package name. Choose from:..." stuff.

@zmedico, could cpv_expand get an extra parameter (default False) that gentoolkit could pass to kill the Ambiguos error and return all matches instead?