Skip to content

Commit

Permalink
[fix] Fallback on fedora_name only if the _abbrev fields are empty
Browse files Browse the repository at this point in the history
In the license inspection, fallback on the fedora_name field if it
contains text and both fedora_abbrev and spdx_abbrev are empty.  An
abbrev field with text that begins with '#' is considered a comment
and the field is treated as empty in the code.

Fixes: #546

Signed-off-by: David Cantrell <dcantrell@redhat.com>
  • Loading branch information
dcantrell committed Nov 3, 2021
1 parent 3067c50 commit f2ac130
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/inspect_license.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,15 @@ static bool check_license_abbrev(const char *lic)
}
}

/* handle "commented out" fields */
if (strlen(fedora_abbrev) > 0 && *fedora_abbrev == '#') {
fedora_abbrev = "";
}

if (strlen(spdx_abbrev) > 0 && *spdx_abbrev == '#') {
spdx_abbrev = "";
}

/*
* no full tag match and no abbreviations, license entry invalid
*/
Expand Down

0 comments on commit f2ac130

Please sign in to comment.