1 |
commit: 84c003caddc16e7455d6d8d07d60d1c868ea5aa1 |
2 |
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Sep 26 12:59:46 2019 +0000 |
4 |
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Sep 26 12:59:46 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=84c003ca |
7 |
|
8 |
libq/tree: fix tree_get_atoms not to use atom_format |
9 |
|
10 |
atom_format uses colour escapes, which messes up the hashing used in the |
11 |
set. |
12 |
|
13 |
Thanks Alexander Wetzel. |
14 |
|
15 |
Bug: https://bugs.gentoo.org/695586 |
16 |
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org> |
17 |
|
18 |
libq/tree.c | 11 ++++++++--- |
19 |
1 file changed, 8 insertions(+), 3 deletions(-) |
20 |
|
21 |
diff --git a/libq/tree.c b/libq/tree.c |
22 |
index 2797450..f8d90ce 100644 |
23 |
--- a/libq/tree.c |
24 |
+++ b/libq/tree.c |
25 |
@@ -1058,12 +1058,17 @@ static int tree_get_atoms_cb(tree_pkg_ctx *pkg_ctx, void *priv) |
26 |
{ |
27 |
struct get_atoms_state *state = (struct get_atoms_state *)priv; |
28 |
depend_atom *atom = tree_get_atom(pkg_ctx, false); |
29 |
+ char abuf[BUFSIZ]; |
30 |
|
31 |
if (state->fullcpv) { |
32 |
- state->cpf = add_set(atom_format("%[CATEGORY]%[PF]", atom), state->cpf); |
33 |
+ size_t len = snprintf(abuf, sizeof(abuf), "%s/%s-%s", |
34 |
+ atom->CATEGORY, atom->PN, atom->PV); |
35 |
+ if (atom->PR_int > 0) |
36 |
+ snprintf(abuf + len, sizeof(abuf) - len, "-r%d", atom->PR_int); |
37 |
+ state->cpf = add_set(abuf, state->cpf); |
38 |
} else { |
39 |
- state->cpf = add_set_unique(atom_format("%[CATEGORY]%[PN]", atom), |
40 |
- state->cpf, NULL); |
41 |
+ snprintf(abuf, sizeof(abuf), "%s/%s", atom->CATEGORY, atom->PN); |
42 |
+ state->cpf = add_set_unique(abuf, state->cpf, NULL); |
43 |
} |
44 |
|
45 |
return 0; |