Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 653032 - app-portage/portage-utils-0.70: invalid atom parsing with version-like name parts
Summary: app-portage/portage-utils-0.70: invalid atom parsing with version-like name p...
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Tools (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Fabian Groffen
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-04-12 16:57 UTC by Hans Vercammen
Modified: 2018-05-18 12:27 UTC (History)
0 users

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 Hans Vercammen 2018-04-12 16:57:06 UTC
Atom name parts that start with '-' followed by a number are incorrectly assumed to be the version.

With portage-utils-0.65:

$ qatom media-fonts/font-adobe-100dpi-1.0.3-r1
media-fonts font-adobe-100dpi 1.0.3 r1

With portage-utils-0.70:

$ qatom media-fonts/font-adobe-100dpi-1.0.3-r1
media-fonts font-adobe <unset> r1

Other utilities like for example qlist also return erroneous results:
$ qlist -CIS abobe
media-fonts/font-adobe:0
Comment 1 Fabian Groffen gentoo-dev 2018-04-12 17:20:44 UTC
The problem with these is that PMS mandates that package names may not contain a hyphen followed by a version string.  A version string starts with a digit.

See https://dev.gentoo.org/~ulm/pms/head/pms.html#x1-160003.1

Now I guess what Portage does, is try to parse 100dpi as version, and concludes it is invalid, therefore should belong to package name.

Ultimately atom parsing should do the same, I guess.
Comment 2 Hans Vercammen 2018-04-12 17:49:46 UTC
Yes, it is tricky. The previous algorithm did the parsing starting from the end without validation.

For example this should probably be invalid:
$ qatom media-fonts/font-adobe-100-1.0.3-r1
media-fonts font-adobe-100 1.0.3 r1
Comment 3 Fabian Groffen gentoo-dev 2018-04-12 17:59:06 UTC
Yes, per PMS spec that should be invalid.  For other bugs/misparsings, I had to change the parse order somewhat, so this remains a fun game :)
Comment 4 Larry the Git Cow gentoo-dev 2018-04-12 18:30:02 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=712cbd379172e444c399a48d08d76a402e822697

commit 712cbd379172e444c399a48d08d76a402e822697
Author:     Fabian Groffen <grobian@gentoo.org>
AuthorDate: 2018-04-12 18:28:20 +0000
Commit:     Fabian Groffen <grobian@gentoo.org>
CommitDate: 2018-04-12 18:28:20 +0000

    atom_explode: try harder to find correct PV
    
    It's not enough to find a hyphen followed by something that looks like a
    version, it needs to be verified it really is, else it is part of the
    package name.
    
    Bug: https://bugs.gentoo.org/653032

 libq/atom_explode.c | 51 ++++++++++++++++++++++++---------------------------
 tests/qatom/dotest  |  3 +++
 2 files changed, 27 insertions(+), 27 deletions(-)}
Comment 5 Larry the Git Cow gentoo-dev 2018-05-18 12:27:37 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=47d5c9788b9550078e17aad238fa03cabe20fd46

commit 47d5c9788b9550078e17aad238fa03cabe20fd46
Author:     Fabian Groffen <grobian@gentoo.org>
AuthorDate: 2018-05-18 12:27:07 +0000
Commit:     Fabian Groffen <grobian@gentoo.org>
CommitDate: 2018-05-18 12:27:23 +0000

    app-portage/portage-utils: version bump to v0.71
    
    Closes: https://bugs.gentoo.org/619988
    Closes: https://bugs.gentoo.org/653202
    Closes: https://bugs.gentoo.org/652312
    Closes: https://bugs.gentoo.org/652720
    Closes: https://bugs.gentoo.org/653032
    Package-Manager: Portage-2.3.24, Repoman-2.3.6

 app-portage/portage-utils/Manifest                                | 2 +-
 .../{portage-utils-0.65.ebuild => portage-utils-0.71.ebuild}      | 8 --------
 2 files changed, 1 insertion(+), 9 deletions(-)