Skip to content

Commit

Permalink
Show the tag number for unknown tags in --xml output
Browse files Browse the repository at this point in the history
--xml is only really useful for diagnostics, and for that purpose in
particular, showing "(unknown)" text instead of the tag number
for unknown tags is just offensively dumb. No more!
  • Loading branch information
pmatilai committed Jun 13, 2023
1 parent 0830d48 commit 119350c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/headerfmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,12 @@ static char * singleSprintf(headerSprintfArgs hsa, sprintfToken token,

if (isxml) {
const char * tagN = rpmTagGetName(spft->u.tag.tag);
char *tagval = NULL;

if (rstreq(tagN, "(unknown)")) {
rasprintf(&tagval, "[%u]", spft->u.tag.tag);
tagN = tagval;
}

need = sizeof(" <rpmTag name=\"\">\n") - 1;
if (tagN != NULL)
Expand All @@ -782,6 +788,8 @@ static char * singleSprintf(headerSprintfArgs hsa, sprintfToken token,
te = stpcpy(te, tagN);
te = stpcpy(te, "\">\n");
hsa->vallen += (te - t);

free(tagval);
}

t = hsaReserve(hsa, need);
Expand Down

0 comments on commit 119350c

Please sign in to comment.