# qatom foo-r1 expected result: (null) foo-r1 (null) actual result: (null) foo (null) r1 -- # qatom foo-1-1-r3 expected result: invalid PN actual result: (null) foo-1 1 r3 -- # qatom foo-1.....1 expected result: invalid PV actual result: (null) foo 1.....1 -- # qatom =/dev-bar/foo-1-1-r3 expected result: debatable, either the operator or the category is invalid, but as a result this atom could also give an error or just (null) for everything actual result: dev-bar foo (null) = -- # qatom foo=foo expected result: invalid PN actual result: (null) foo=foo (null) The above example is also true for a LOT of other invalid chars like '#' or '~' etc. It seems there is no check about that whatsoever. Other components like category and slot are probably affected as well. The valid chars are documented here https://dev.gentoo.org/~ulm/pms/head/pms.html#x1-160003
Two more examples: # qatom app-emacs/diff-mode- expected result: app-emacs diff-mode- (null) actual result: app-emacs diff-mode ("diff-mode-" is an existing package in the emacs overlay.) -- # qatom "" expected result: invalid PN (no name may be empty) actual result: (null) (null)
atom_explode is written assuming the input is valid. if you provide garbage, then you get back garbage. i'm not terribly interested in adding overhead to reject it. if there are valid atoms that don't parse, then i am interested in it. why do you care about this ?
(In reply to SpanKY from comment #2) > > if there are valid atoms that don't parse, then i am interested in it. > The first example in #c0 is a valid atom that is wrongly parsed.
% ./qatom foo-r1 # valid <unset> foo-r1 <unset> % ./qatom foo-1-1-r3 # invalid <unset> foo 1 r3 % ./qatom foo-1.....1 # invalid <unset> foo 1.....1 % ./qatom =/dev-bar/foo-1-1-r3 # invalid dev-bar foo 1 r3 = % ./qatom foo=foo # invalid <unset> foo=foo <unset> % ./qatom app-emacs/diff-mode- # valid app-emacs diff-mode- <unset> In the light of what SpanKY said, invalid atoms aren't detected/rejected, but I fixed the parsing of the valid cases.
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=89a388678c4975b541d24931b0916e2959ed70be commit 89a388678c4975b541d24931b0916e2959ed70be Author: Fabian Groffen <grobian@gentoo.org> AuthorDate: 2018-04-05 12:10:26 +0000 Commit: Fabian Groffen <grobian@gentoo.org> CommitDate: 2018-04-05 12:10:26 +0000 atom_explode: fix parsing of some valid corner cases Extract the version part of the atom, such that we can more reliably parse the version components without worrying about accidentially taking parts of the package name. Bug: https://bugs.gentoo.org/526596 libq/atom_explode.c | 78 +++++++++++++++++++++++++++++------------------------ tests/qatom/dotest | 13 ++++++--- 2 files changed, 53 insertions(+), 38 deletions(-)}
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=34b636503cc7dcabe32b9b377c2eb77cb5fd5575 commit 34b636503cc7dcabe32b9b377c2eb77cb5fd5575 Author: Fabian Groffen <grobian@gentoo.org> AuthorDate: 2018-04-05 19:02:10 +0000 Commit: Fabian Groffen <grobian@gentoo.org> CommitDate: 2018-04-05 19:02:34 +0000 app-portage/portage-utils: version bump to 0.70 This release fixes multiple bugs lingering around for a while. Closes: https://bugs.gentoo.org/651546 Closes: https://bugs.gentoo.org/646310 Closes: https://bugs.gentoo.org/645554 Closes: https://bugs.gentoo.org/643820 Closes: https://bugs.gentoo.org/638032 Closes: https://bugs.gentoo.org/608960 Closes: https://bugs.gentoo.org/607498 Closes: https://bugs.gentoo.org/558306 Closes: https://bugs.gentoo.org/526596 Closes: https://bugs.gentoo.org/470168 Closes: https://bugs.gentoo.org/351100 Closes: https://bugs.gentoo.org/335453 Package-Manager: Portage-2.3.24, Repoman-2.3.6 app-portage/portage-utils/Manifest | 2 +- .../portage-utils/portage-utils-0.62.ebuild | 2 +- .../portage-utils/portage-utils-0.63.ebuild | 43 ---------------------- ...ls-0.64-r1.ebuild => portage-utils-0.70.ebuild} | 16 +------- 4 files changed, 4 insertions(+), 59 deletions(-)