Currently, when: - multiple packages have different categories and the same name - but only one of them is installed then the emerge prefers the one that is installed rather than displaying the conflict. For example, if I 'emerge zstd': - if neither of the packages are installed, or both, it will display an ambiguity message - but if app-arch/zstd is installed, it will try to rebuild it without warning In my opinion, this behavior is not only confusing but makes very little sense. After all, how often do users actually want to rebuild or upgrade some individual package manually (vs via @world upgrade)? I think it's more common for 'emerge zstd' to be used to actually install something new.
It might make sense to check installed packages when performing an unmerge action (emerge --unmerge or emerge --depclean).
From what I've seen, package matching for uninstall is handled separately.
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/proj/portage.git/commit/?id=f85f0991a90b17009e02d342c58fb5b066d7b0c9 commit f85f0991a90b17009e02d342c58fb5b066d7b0c9 Author: Michał Górny <mgorny@gentoo.org> AuthorDate: 2021-12-03 07:27:18 +0000 Commit: Michał Górny <mgorny@gentoo.org> CommitDate: 2021-12-04 04:56:20 +0000 emerge: Do not resolve ambiguous package names via installed pkgs When dealing with ambiguous package names on command-line, do not use installed packages to resolve them. This is counterintuitive in the best case, and probably the wrong answer most of the time. After all, if a user calls emerge with a specific package name, it is quite likely that he intends to install a missing package rather than rebuild or upgrade an individual package (though the latter can also happen). Rather than making assumptions that can go wrong, just display the ambiguity message as usual. Bug: https://bugs.gentoo.org/828059 Closes: https://github.com/gentoo/portage/pull/775 Signed-off-by: Michał Górny <mgorny@gentoo.org> lib/_emerge/depgraph.py | 15 --------------- 1 file changed, 15 deletions(-)