aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/subsystem/linux
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2023-01-18 16:22:07 +0100
committerAleksandr Nogikh <wp32pw@gmail.com>2023-02-10 14:34:44 +0100
commit8d41190df0b6184bac7d8b34765fc84395f27cf4 (patch)
tree92f65cc62e184c1d357bdeece9382f679946c07a /pkg/subsystem/linux
parent7ab1cfa1ba21428ff54bc4d6890628074326e339 (diff)
pkg/subsystem/linux: keep one list for list-merged groups
Otherwise we can get too many mailing lists at the same time.
Diffstat (limited to 'pkg/subsystem/linux')
-rw-r--r--pkg/subsystem/linux/subsystems.go19
-rw-r--r--pkg/subsystem/linux/subsystems_test.go3
2 files changed, 13 insertions, 9 deletions
diff --git a/pkg/subsystem/linux/subsystems.go b/pkg/subsystem/linux/subsystems.go
index 9d9688758..8d8716bf9 100644
--- a/pkg/subsystem/linux/subsystems.go
+++ b/pkg/subsystem/linux/subsystems.go
@@ -79,7 +79,7 @@ func (ctx *linuxCtx) getSubsystems() ([]*entity.Subsystem, error) {
ret := []*entity.Subsystem{}
for _, raw := range ctx.groupByList() {
s := &entity.Subsystem{}
- mergeRawRecords(s, raw.records)
+ raw.mergeRawRecords(s)
ret = append(ret, s)
}
if err := setSubsystemNames(ret); err != nil {
@@ -98,7 +98,7 @@ func (ctx *linuxCtx) applyExtraRules(list []*entity.Subsystem) {
}
}
-func mergeRawRecords(subsystem *entity.Subsystem, records []*maintainersRecord) {
+func (candidate *subsystemCandidate) mergeRawRecords(subsystem *entity.Subsystem) {
unique := func(list []string) []string {
m := make(map[string]struct{})
for _, s := range list {
@@ -111,19 +111,22 @@ func mergeRawRecords(subsystem *entity.Subsystem, records []*maintainersRecord)
sort.Strings(ret)
return ret
}
- var lists, maintainers []string
- for _, record := range records {
+ var maintainers []string
+ for _, record := range candidate.records {
rule := record.ToPathRule()
if !rule.IsEmpty() {
subsystem.PathRules = append(subsystem.PathRules, rule)
}
- lists = append(lists, record.lists...)
maintainers = append(maintainers, record.maintainers...)
}
- subsystem.Lists = unique(lists)
- // But there's a risk that we collect too many unrelated maintainers, so
+ if candidate.commonEmail != "" {
+ // For list-grouped subsystems, we risk merging just too many lists.
+ // Keep the list short in this case.
+ subsystem.Lists = []string{candidate.commonEmail}
+ }
+ // There's a risk that we collect too many unrelated maintainers, so
// let's only merge them if there are no lists.
- if len(records) <= 1 {
+ if len(candidate.records) <= 1 {
subsystem.Maintainers = unique(maintainers)
}
}
diff --git a/pkg/subsystem/linux/subsystems_test.go b/pkg/subsystem/linux/subsystems_test.go
index b4f0818ff..09d835e3f 100644
--- a/pkg/subsystem/linux/subsystems_test.go
+++ b/pkg/subsystem/linux/subsystems_test.go
@@ -75,7 +75,7 @@ func TestLinuxSubsystemPaths(t *testing.T) {
// For the list of subsystems, see TestLinuxSubsystemsList.
// Here we rely on the same ones.
repo := prepareTestLinuxRepo(t, []byte(testMaintainers))
- subsystems, err := listFromRepoInner(repo, testRules)
+ subsystems, err := listFromRepoInner(repo, nil)
if err != nil {
t.Fatal(err)
}
@@ -106,6 +106,7 @@ func TestLinuxSubsystemPaths(t *testing.T) {
list: []string{"kernel", "mm"},
},
{
+ // Shmem has no mailing list.
path: `mm/shmem.c`,
list: []string{"kernel", "mm"},
},