Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 610424 - app-portage/eix-0.32.5 doesn't find dev-perl/PGPLOT when searching for PGPLOT
Summary: app-portage/eix-0.32.5 doesn't find dev-perl/PGPLOT when searching for PGPLOT
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Michael Weber (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-02-21 23:45 UTC by Ulrich Müller
Modified: 2018-11-23 11:08 UTC (History)
4 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ulrich Müller gentoo-dev 2017-02-21 23:45:57 UTC
Searching for "pgplot" turns up two packages:

   $ eix --only-names pgplot
   dev-perl/PGPLOT
   sci-libs/pgplot
   $ 

Whereas specifying "PGPLOT" results in an empty list:

   $ eix --only-names PGPLOT
   $ eix --only-names -e PGPLOT
   $ 

For "FCGI" things work as expected, though:

   $ eix --only-names FCGI
   dev-libs/fcgi
   dev-perl/FCGI
   dev-perl/FCGI-ProcManager
   dev-ruby/fcgi
   www-apache/mod_fcgid
   www-misc/fcgiwrap
   www-servers/spawn-fcgi
   $ eix --only-names -e FCGI
   dev-perl/FCGI
   $
Comment 1 Martin Väth 2017-02-22 08:27:49 UTC
It's not a bug, it's a feature:
Due to your search string containing GPL, eix defaults to searching the license field, see "eix --print DEFAULT_MATCH_FIELD".
You explicitly have to specify --name to avoid that eix chooses the default field by the DEFAULT_MATCH_FIELD heuristics.
Comment 2 Ulrich Müller gentoo-dev 2017-02-22 09:13:52 UTC
Note that the problem also occurs with the -e option:

       -e, --exact
              Pattern  is  an  exact  (full) string. For example, "eix -e gcc"
              will only show packages with the name "gcc".

PGPLOT isn't an exact match for GPL, so even with your heuristic, why would it match that string in DEFAULT_MATCH_FIELD?

(Also, by generalisation of the man page's example, I would expect that: '"eix -e PGPLOT" will only show packages with the name "PGPLOT".')
Comment 3 Martin Väth 2017-02-22 11:39:04 UTC
(In reply to Ulrich Müller from comment #2)
> Note that the problem also occurs with the -e option:

Of course, because -e only specifies the search _algorithm_, not the search _field_. Both must be specified if you do not want them to be chosen by some heuristic, each.
The heuristic for the search algorithm is specified in DEFAULT_MATCH_ALGORITHM, the heuristic for the field in DEFAULT_MATCH_FIELD.

> PGPLOT isn't an exact match for GPL, so even with your heuristic, why would
> it match that string in DEFAULT_MATCH_FIELD?

Because the heuristic works by regular expressions. If you would want an exact match only, one would have to specify ^GPL$, but this would be a bad idea, because it would miss e.g. LGPL or GPL-2.

I am aware that this is only a heuristics and sometimes confusing: This is not the first bug report caused by a misunderstanding of the mechanism.
OTOH, the number of false guesses is rather low meanwhile, and in most cases the heuristics gives the user "more expected" results than if a fixed default without any heuristics would be used. (Of course, you can simply change this by specifying DEFAULT_MATCH_FIELD and DEFAULT_MATCH_ALGORITHM on your own in e.g. /etc/eixrc).
"G_GPL_OT" is really an unlikely unfortunate false positive for the expression.
Comment 4 Ulrich Müller gentoo-dev 2017-02-22 13:46:54 UTC
This goes against the principle of least surprise. It is reasonable when the heuristic is triggered by strings like " ", "/", or "@" which are not allowed in package names. But IMHO it should never kick in on strings like "BSD" or "GPL" which are legal as part of a package name. (And both actually occur in the tree, namely in dev-perl/BSD-Resource and dev-perl/PGPLOT, so this is a real issue and not just an academic example.)

I would therefore suggest to drop GPL|BSD|Art from DEFAULT_MATCH_FIELD.
Comment 5 Martin Väth 2017-02-22 17:34:23 UTC
(In reply to Ulrich Müller from comment #4)
> This goes against the principle of least surprise.

Any heuristic goes against the principle of least surprise.

But such a heuristic was built into eix from almost the first version, so removing it now would also go against the principle of least surprise.

> dev-perl/BSD-Resource

That's a very good argument.

> I would therefore suggest to drop GPL|BSD|Art from DEFAULT_MATCH_FIELD.

I agree. Maybe the same should happen for the eapi heuristics which also already confused users. I still have to think about how to do this without destroying the meaning of the MATCH_FIELD_LICENSE and MATCH_FIELD_EAPI variables which some users might have configured.
Comment 6 Martin Väth 2017-02-22 19:11:03 UTC
Fixed on eix master branch on github
Comment 7 Ulrich Müller gentoo-dev 2017-02-22 19:29:22 UTC
(In reply to Martin Väth from comment #5)
> Maybe the same should happen for the eapi heuristics [...]

Well, technically an all-digits package name would be valid. On the other hand, EAPI names aren't bound to be numerical only (though currently all council approved ones are).
Comment 8 Martin Väth 2017-02-23 10:02:46 UTC
(In reply to Ulrich Müller from comment #7)
> EAPI names aren't bound to be numerical only

_Practically_ they are (except testing ones), and there is no reason to assume that this practice will change. Even if it does some day (e.g. if after "9" there will be "a"), it would be easy enough to change in the heuristics: new EAPI features sometimes require certain changes in eix, anyway.

However, I have removed the eapi heuristics now for another reason:

> an all-digits package name would be valid.

The problem is that an all-digits query does not mean that the user is looking for an all-digits field. One would have to make the heuristic even smarter and make it dependent on whether e.g. the user explicitly specified "-e" or something similar. The current heuristics has confused already at least some users.
Comment 9 Mikle Kolyada (RETIRED) archtester Gentoo Infrastructure gentoo-dev Security 2018-11-23 11:08:07 UTC
Seems to be fixed long ago