commit: 84c003caddc16e7455d6d8d07d60d1c868ea5aa1 Author: Fabian Groffen <grobian <AT> gentoo <DOT> org> AuthorDate: Thu Sep 26 12:59:46 2019 +0000 Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org> CommitDate: Thu Sep 26 12:59:46 2019 +0000 URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=84c003ca
libq/tree: fix tree_get_atoms not to use atom_format atom_format uses colour escapes, which messes up the hashing used in the set. Thanks Alexander Wetzel. Bug: https://bugs.gentoo.org/695586 Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org> libq/tree.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/libq/tree.c b/libq/tree.c index 2797450..f8d90ce 100644 --- a/libq/tree.c +++ b/libq/tree.c @@ -1058,12 +1058,17 @@ static int tree_get_atoms_cb(tree_pkg_ctx *pkg_ctx, void *priv) { struct get_atoms_state *state = (struct get_atoms_state *)priv; depend_atom *atom = tree_get_atom(pkg_ctx, false); + char abuf[BUFSIZ]; if (state->fullcpv) { - state->cpf = add_set(atom_format("%[CATEGORY]%[PF]", atom), state->cpf); + size_t len = snprintf(abuf, sizeof(abuf), "%s/%s-%s", + atom->CATEGORY, atom->PN, atom->PV); + if (atom->PR_int > 0) + snprintf(abuf + len, sizeof(abuf) - len, "-r%d", atom->PR_int); + state->cpf = add_set(abuf, state->cpf); } else { - state->cpf = add_set_unique(atom_format("%[CATEGORY]%[PN]", atom), - state->cpf, NULL); + snprintf(abuf, sizeof(abuf), "%s/%s", atom->CATEGORY, atom->PN); + state->cpf = add_set_unique(abuf, state->cpf, NULL); } return 0;
