commit: d7cf583b6be5b29e5607fe0d90b8f566baf65f34 Author: Fabian Groffen <grobian <AT> gentoo <DOT> org> AuthorDate: Fri Oct 26 13:49:05 2018 +0000 Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org> CommitDate: Fri Oct 26 13:49:05 2018 +0000 URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=d7cf583b
depends: fix matching atoms for bug #668418 atoms in dependency strings can contain built-with-use declarations in bracket notation, so ensure we ignore that when feeding this into atom_explode. Bug: https://bugs.gentoo.org/668418 qatom.c | 3 ++- qdepends.c | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/qatom.c b/qatom.c index f079299..d7782ea 100644 --- a/qatom.c +++ b/qatom.c @@ -133,7 +133,8 @@ int qatom_main(int argc, char **argv) for (i = optind; i < argc; ++i) { switch (action) { case _COMPARE: - printf("%s %s %s\n", argv[i], booga[atom_compare_str(argv[i], argv[i+1])], argv[i+1]); + printf("%s %s %s\n", argv[i], + booga[atom_compare_str(argv[i], argv[i+1])], argv[i+1]); ++i; break; case _EXPLODE: diff --git a/qdepends.c b/qdepends.c index e89216b..3ff0ebb 100644 --- a/qdepends.c +++ b/qdepends.c @@ -555,10 +555,13 @@ qdepends_vdb_deep_cb(q_vdb_pkg_ctx *pkg_ctx, void *priv) if (ret != 0) break; - /* find the boundaries for matched atom */ + /* find the boundaries for matched atom, dep specifications can + * include built-with-use deps using [xxx] notation, so ensure + * we exclude that as part of the atom */ while (match.rm_so > 0 && !isspace(ptr[match.rm_so - 1])) match.rm_so--; - while (ptr[match.rm_eo] != '\0' && !isspace(ptr[match.rm_eo])) + while (ptr[match.rm_eo] != '\0' && ptr[match.rm_eo] != '[' && + !isspace(ptr[match.rm_eo])) match.rm_eo++; snprintf(qbuf, sizeof(qbuf), "%.*s",