Skip to content

Commit 32fe394

Browse files
committed
q: fix gtree generation of metadata keys
forgot to allocate space for the key-name Signed-off-by: Fabian Groffen <grobian@gentoo.org>
1 parent e751859 commit 32fe394

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

q.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,8 @@ static int q_build_gtree_cache_pkg(tree_pkg_ctx *pkg, void *priv)
191191
/* construct the common prefix */
192192
snprintf(buf, sizeof(buf), "caches/%s/%s", atom->CATEGORY, atom->PF);
193193

194-
/* keys from md5-cache except _md5_, _eclasses_ and repository (the
195-
* latter is stored at the top level)
196-
* in addition to this the required eclass names are stored in a new
197-
* key called eclasses for easy retrieval/extraction purposes
194+
/* keys from md5-cache except _md5_ and repository (the latter is
195+
* stored at the top level)
198196
* all of this is stored as key-value file, because storing it as
199197
* individual keys takes much more storage for no particular benefit */
200198

@@ -209,6 +207,7 @@ static int q_build_gtree_cache_pkg(tree_pkg_ctx *pkg, void *priv)
209207
else \
210208
qclen = 0; \
211209
if (qclen > 0) { \
210+
qclen += sizeof(#K) - 1 + 1 /*=*/; \
212211
if (ctx->cbuflen + qclen + 1 > ctx->cbufsiz) { \
213212
ctx->cbufsiz = ctx->cbuflen + qclen + 1; \
214213
ctx->cbufsiz = ((ctx->cbufsiz + (1024 - 1)) / 1024) * 1024; \
@@ -220,7 +219,8 @@ static int q_build_gtree_cache_pkg(tree_pkg_ctx *pkg, void *priv)
220219
} \
221220
} while (false)
222221
#define q_cache_add_cache_entry(K) \
223-
if (Q_##K != Q__md5_) \
222+
if (Q_##K != Q__md5_ && \
223+
Q_##K != Q_repository) \
224224
q_cache_add_cache_entry_val(K, tree_pkg_meta(pkg, Q_##K));
225225

226226
/* try all known keys */
@@ -939,7 +939,7 @@ int q_main(int argc, char **argv)
939939
warnp("could not stat produced archive");
940940
else
941941
printf("%s%s%s: %s%siB%s\n",
942-
GREEN, r ? "???" : r, NORM,
942+
GREEN, r == NULL ? "???" : r, NORM,
943943
RED, make_human_readable_str(st.st_size,
944944
1, 0), NORM);
945945
}

0 commit comments

Comments
 (0)