Skip to content

Commit 96bfeb1

Browse files
committed
[fix] Correctly handle dual SPDX/legacy license identifiers
The license inspection was incorrectly handling license identifiers that appear as both legacy identifiers in the license database as well as SPDX expressions. The core problem is that under the legacy system, there was a lot of identifier reuse. This patch refactors how the license inspection notes the dual licenses so that the inspection passes on packages that have migrated to SPDX. Fixes: rpminspect#1387 Signed-off-by: David Cantrell <[email protected]>
1 parent 15c2bf0 commit 96bfeb1

File tree

4 files changed

+208
-61
lines changed

4 files changed

+208
-61
lines changed

lib/init.c

+5-16
Original file line numberDiff line numberDiff line change
@@ -599,28 +599,17 @@ static inline void _remedy_walker(struct toml_node *node, void *data)
599599
r = toml_value_as_string(node);
600600

601601
if (r) {
602-
entry = calloc(1, sizeof(*entry));
603-
assert(entry != NULL);
604-
entry->data = r;
605-
606-
if (ri->remedy_overrides == NULL) {
607-
ri->remedy_overrides = calloc(1, sizeof(*(ri->remedy_overrides)));
608-
assert(ri->remedy_overrides != NULL);
609-
TAILQ_INIT(ri->remedy_overrides);
610-
}
602+
ri->remedy_overrides = list_add(ri->remedy_overrides, r);
611603

612-
TAILQ_INSERT_TAIL(ri->remedy_overrides, entry, items);
613-
}
614-
615-
if (!set_remedy(n, r)) {
616-
warnx("*** '%s' is not a valid remedy identifier", n);
617-
618-
if (r) {
604+
if (!set_remedy(n, r)) {
605+
warnx("*** '%s' is not a valid remedy identifier", n);
619606
TAILQ_REMOVE(ri->remedy_overrides, entry, items);
620607
free(entry->data);
621608
free(entry);
622609
}
623610
}
611+
612+
free(r);
624613
}
625614

626615
free(n);

0 commit comments

Comments
 (0)