1
0
Fork 0
mirror of https://github.com/gocsaf/csaf.git synced 2025-12-22 11:55:40 +01:00

Merge pull request #441 from csaf-poc/fix_missing

Checker: Fix checking of missing files
This commit is contained in:
JanHoefelmeyer 2023-09-19 15:52:05 +02:00 committed by GitHub
commit 2a82c53585
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1115,6 +1115,8 @@ func (p *processor) checkMissing(string) error {
for _, f := range files { for _, f := range files {
v := p.alreadyChecked[f] v := p.alreadyChecked[f]
var where []string var where []string
// mistake contains which requirements are broken
var mistake whereType
for mask := rolieMask; mask <= listingMask; mask <<= 1 { for mask := rolieMask; mask <= listingMask; mask <<= 1 {
if maxMask&mask == mask { if maxMask&mask == mask {
var in string var in string
@ -1122,11 +1124,26 @@ func (p *processor) checkMissing(string) error {
in = "in" in = "in"
} else { } else {
in = "not in" in = "not in"
// Which file is missing entries?
mistake |= mask
} }
where = append(where, in+" "+mask.String()) where = append(where, in+" "+mask.String())
} }
} }
p.badIntegrities.error("%s %s", f, strings.Join(where, ", ")) // List error in all appropriate categories
if mistake&(rolieMask|indexMask|changesMask|listingMask) == 0 {
continue
}
joined := strings.Join(where, ", ")
report := func(mask whereType, msgs *topicMessages) {
if mistake&mask != 0 {
msgs.error("%s %s", f, joined)
}
}
report(rolieMask, &p.badROLIEFeed)
report(indexMask, &p.badIndices)
report(changesMask, &p.badChanges)
report(listingMask, &p.badDirListings)
} }
return nil return nil
} }