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

Bug 838484

Summary: dev-util/pkgcheck-0.10.9-r1: mystery invalid package atom causes exception
Product: Gentoo Hosted Projects Reporter: Philippe Chaintreuil <gentoo_bugs_peep>
Component: PkgCoreAssignee: PkgCore project <pkgcore>
Status: UNCONFIRMED ---    
Severity: normal CC: mgorny
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Philippe Chaintreuil 2022-04-15 13:20:51 UTC
This GURU commit[1] on the dev branch causes an exception to be thrown

===============================================================================
pkgcheck scan: error: Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/pkgcore/ebuild/atom.py", line 261, in __init__
    sf(self, "_cpv", cpv.CPV(self.cpvstr, versioned=bool(self.op)))
  File "/usr/lib/python3.9/site-packages/pkgcore/ebuild/cpv.py", line 317, in __init__
    raise InvalidCPV(cpvstr, f"invalid version '{pkg_chunks[-1]}'")
pkgcore.ebuild.errors.InvalidCPV: app-misc/vocabsieve-.4: invalid version '.4'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/pkgcheck/pipeline.py", line 227, in _run
    self._queue_work(sync_pipes, work_q)
  File "/usr/lib/python3.9/site-packages/pkgcheck/pipeline.py", line 172, in _queue_work
    for restrict in unversioned_source.itermatch(restriction):
  File "/usr/lib/python3.9/site-packages/pkgcheck/sources.py", line 378, in itermatch
    for pkg in super().itermatch(restrict, **kwargs):
  File "/usr/lib/python3.9/site-packages/pkgcheck/sources.py", line 247, in itermatch
    yield from super().itermatch(restrict, raw_pkg_cls=RawCPV, **kwargs)
  File "/usr/lib/python3.9/site-packages/pkgcore/repository/prototype.py", line 298, in _internal_match
    for pkg in self._internal_gen_candidates(candidates, **kwargs):
  File "/usr/lib/python3.9/site-packages/pkgcore/repository/prototype.py", line 295, in _internal_gen_candidates
    yield from sorter(pkg_filter(pkgs))
  File "/usr/lib/python3.9/site-packages/pkgcheck/packages.py", line 41, in __lt__
    return self.versioned_atom < other.versioned_atom
  File "/usr/lib/python3.9/site-packages/pkgcheck/packages.py", line 33, in versioned_atom
    return atom.atom(f'={self}')
  File "/usr/lib/python3.9/site-packages/snakeoil/caching.py", line 115, in __call__
    instance = super(WeakInstMeta, cls).__call__(*a, **kw)
  File "/usr/lib/python3.9/site-packages/pkgcore/ebuild/atom.py", line 263, in __init__
    raise errors.MalformedAtom(orig_atom) from e
pkgcore.ebuild.errors.MalformedAtom: invalid package atom: '=app-misc/vocabsieve-.4'
===============================================================================

1.  I'd expect an error to be output, not an exception to be thrown
2.  I only see the commit referencing "6.4", never ".4"

[1] https://github.com/gentoo/guru/commit/318009746930e0b83ed39e6b74968f2a44720b1c

Reproducible: Always

Steps to Reproduce:
1. git clone -b dev git@git.gentoo.org:repo/proj/guru.git
2. git checkout 318009746930e0b83ed39e6b74968f2a44720b1c
3. pkgcheck scan --net
Comment 1 Philippe Chaintreuil 2022-04-15 13:30:43 UTC
Original commit author identified what's wonky.  There's an ebuild with the wrong name present after the package got renamed from ssmtool to vocabsieve.

app-misc/vocabsieve/ssmtool-0.6.4.ebuild

Hope that helps.
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-07-31 04:01:49 UTC
I'd say the exception isn't crazy for what the issue is. The only question is whether pkgcheck would detect such a problem before committing. I think it would but I haven't verified.