Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 909853 - sys-apps/portage: incorrect output on no ebuilds found
Summary: sys-apps/portage: incorrect output on no ebuilds found
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core - Interface (emerge) (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS, PullRequest
Depends on: 908971
Blocks:
  Show dependency tree
 
Reported: 2023-07-08 04:58 UTC by Greg Kubaryk
Modified: 2023-08-09 02:57 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 Greg Kubaryk 2023-07-08 04:58:58 UTC
introduced in 0b21a5a392bd84c07b94373991f59108fbe98516, around line 6461 of lib/_emerge/depgraph.py says:
if self._frozen_config.myopts.get("--usepkgonly", "y"): 

...which is always true, so it always says "there are no binary packages to satisfy" instead of "there are no ebuilds to satisfy"

perhaps needs == True or != "n" or whatever you think is best; no strong opinions. Sam asked me to file in case there were other cases that you find while fixing this one.
Comment 1 Oskari Pirhonen 2023-07-08 05:38:47 UTC
The original code built up the string like so:

    "binary packages"
    if self._frozen_config.myopts.get("--usepkgonly", "y") == True
    else "ebuilds"

I don't think this was correct either. Just below that, there's:

    self._frozen_config.myopts.get("--misspell-suggestions", "y") != "n"

I think this may be the way to go.
Comment 2 Oskari Pirhonen 2023-07-09 04:52:24 UTC
Actually, adding some debug output to dump self._frozen_config.myopts and self._frozen_config.myopts.get("--usepkgonly", "y") it looks like -K/--usepkgonly/--usepkgonly=y set the entry in the dict to True. Leaving out the arg, or giving --usepkgonly=n leaves the entry unset in the dict.

$ emerge -p fjdksljfdsd
FEATURES variable contains unknown value(s): jobserver

These are the packages that would be merged, in order:

Calculating dependencies  ... done!
Dependency resolution took 1.11 s.

self._frozen_config.myopts = {'--ask-enter-invalid': True, '--pretend': True, '--jobs': 16, '--regex-search-auto': 'y', '--verbose': True}
self._frozen_config.myopts.get("--usepkgonly", "y") = 'y'

emerge: there are no binary packages to satisfy "fjdksljfdsd".

emerge: searching for similar names... nothing similar found.


$ emerge -p -K fjdksljfdsd
FEATURES variable contains unknown value(s): jobserver

These are the packages that would be merged, in order:

Calculating dependencies  ... done!
Dependency resolution took 0.94 s.

self._frozen_config.myopts = {'--ask-enter-invalid': True, '--pretend': True, '--jobs': 16, '--regex-search-auto': 'y', '--usepkgonly': True, '--verbose': True, '--usepkg': True}
self._frozen_config.myopts.get("--usepkgonly", "y") = True

emerge: there are no binary packages to satisfy "fjdksljfdsd".

emerge: searching for similar names... nothing similar found.


(--ask-enter-invalid, --jobs, and --verbose come from my EMERGE_DEFAULT_OPTS)

What is, perhaps, even more interesting is that some have "y"/"n" while others are True/unset...

For now, I think the best course of action would actually be `.get("--usepkgonly", False)` and later figure out why there's a discrepancy between how the myopts dict is populated.

Side note: in depgraph.py, def _backtrack_depgraph(...) (line 11431) annotates the myopts arg as Dict[str, Any] and def _resume_depgraph(...) (line 11553) annotates it as Dict[str, str]...
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-07-09 05:01:47 UTC
(ccing ninpo as they're interested in the argparsing side wrt the general investigation bit)
Comment 4 Larry the Git Cow gentoo-dev 2023-07-09 06:25:41 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/portage.git/commit/?id=b199d0307b47f9fb06dbe533d7e24926a561c238

commit b199d0307b47f9fb06dbe533d7e24926a561c238
Author:     Oskari Pirhonen <xxc3ncoredxx@gmail.com>
AuthorDate: 2023-07-09 05:08:27 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2023-07-09 06:24:28 +0000

    depgraph.py: fix "no ebuilds/binpkgs" message
    
    The "there are no binary packages to satisfy" was being unconditionally
    output for packages that could not be found. Fix the logic for choosing
    between the "binary packages" and "ebuilds" form of the message.
    
    This is a temporary stopgap as alluded to by me in the bug, but the
    tl;dr is that some entries in the `myopts` dict have "y"/"n" values
    whereas some are True/unset, and this discrepancy should be sorted out.
    
    [sam: Add NEWS and Fixes, although the change in that commit _shouldn't_
    have been wrong, it is because of a quirk for now...]
    
    Bug: https://bugs.gentoo.org/909853
    Signed-off-by: Oskari Pirhonen <xxc3ncoredxx@gmail.com>
    Closes: https://github.com/gentoo/portage/pull/1065
    Fixes: 0b21a5a392bd84c07b94373991f59108fbe98516
    Signed-off-by: Sam James <sam@gentoo.org>

 NEWS                    | 3 +++
 lib/_emerge/depgraph.py | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)
Comment 5 Larry the Git Cow gentoo-dev 2023-07-15 03:45:38 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=67e33dbaf367adfc465f322d0b6b5793c76207a8

commit 67e33dbaf367adfc465f322d0b6b5793c76207a8
Author:     Oskari Pirhonen <xxc3ncoredxx@gmail.com>
AuthorDate: 2023-07-15 03:20:05 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2023-07-15 03:44:01 +0000

    sys-apps/portage: backport message fix
    
    Backport the "no ebuilds/binpkgs" message fix from the unreleased 3.0.50
    to the affected versions.
    
    Bug: https://bugs.gentoo.org/909853
    Signed-off-by: Oskari Pirhonen <xxc3ncoredxx@gmail.com>
    Closes: https://github.com/gentoo/gentoo/pull/31891
    Signed-off-by: Sam James <sam@gentoo.org>

 ...epgraph.py-fix-no-ebuilds-binpkgs-message.patch | 43 ++++++++++++++++++++++
 ...0.48.1-r1.ebuild => portage-3.0.48.1-r2.ebuild} |  5 +++
 ...tage-3.0.49.ebuild => portage-3.0.49-r1.ebuild} |  5 +++
 3 files changed, 53 insertions(+)
Comment 6 Larry the Git Cow gentoo-dev 2023-08-09 02:57:26 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=858dfd771ac4c6c9315ac5851f4aeeb233fc21d5

commit 858dfd771ac4c6c9315ac5851f4aeeb233fc21d5
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2023-08-09 02:54:12 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2023-08-09 02:54:12 +0000

    sys-apps/portage: add 3.0.50
    
    Closes: https://bugs.gentoo.org/908971
    Closes: https://bugs.gentoo.org/640658
    Closes: https://bugs.gentoo.org/894398
    Closes: https://bugs.gentoo.org/895908
    Closes: https://bugs.gentoo.org/909067
    Closes: https://bugs.gentoo.org/909148
    Closes: https://bugs.gentoo.org/909853
    Closes: https://bugs.gentoo.org/910035
    Closes: https://bugs.gentoo.org/910376
    Closes: https://bugs.gentoo.org/911594
    Closes: https://bugs.gentoo.org/911574
    Signed-off-by: Sam James <sam@gentoo.org>

 sys-apps/portage/Manifest              |   1 +
 sys-apps/portage/portage-3.0.50.ebuild | 229 +++++++++++++++++++++++++++++++++
 2 files changed, 230 insertions(+)