aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/report/linux.go
diff options
context:
space:
mode:
authorPedro Lopes <pedrolopes@google.com>2020-07-28 15:55:14 -0500
committerDmitry Vyukov <dvyukov@google.com>2020-07-31 17:18:29 +0200
commit242b0eb219dbb269deacdae76de2f8b0b788ac40 (patch)
tree2a1350d88d2550069a295ca7b093b00664209e64 /pkg/report/linux.go
parent68aca71e8de884b64dc78a5d5406ca232460c1cf (diff)
pkg: get and store Maintainers data
Create a struct on pkg/vcs to store data of syzkaller email recipients and update its users. The struct contains default name, email, and a label to divide user into To and Cc when sending the emails.
Diffstat (limited to 'pkg/report/linux.go')
-rw-r--r--pkg/report/linux.go23
1 files changed, 7 insertions, 16 deletions
diff --git a/pkg/report/linux.go b/pkg/report/linux.go
index de906adf9..85b62a89b 100644
--- a/pkg/report/linux.go
+++ b/pkg/report/linux.go
@@ -7,7 +7,6 @@ import (
"bufio"
"bytes"
"fmt"
- "net/mail"
"path/filepath"
"regexp"
"strconv"
@@ -16,6 +15,7 @@ import (
"github.com/google/syzkaller/pkg/osutil"
"github.com/google/syzkaller/pkg/symbolizer"
+ "github.com/google/syzkaller/pkg/vcs"
)
type linux struct {
@@ -351,7 +351,7 @@ func (ctx *linux) Symbolize(rep *Report) error {
if err != nil {
return err
}
- rep.Maintainers = maintainers
+ rep.Recipients = maintainers
}
return nil
}
@@ -466,14 +466,14 @@ nextFile:
return ""
}
-func (ctx *linux) getMaintainers(file string) ([]string, error) {
+func (ctx *linux) getMaintainers(file string) (vcs.Recipients, error) {
if ctx.kernelSrc == "" {
return nil, nil
}
return GetLinuxMaintainers(ctx.kernelSrc, file)
}
-func GetLinuxMaintainers(kernelSrc, file string) ([]string, error) {
+func GetLinuxMaintainers(kernelSrc, file string) (vcs.Recipients, error) {
mtrs, err := getMaintainersImpl(kernelSrc, file, false)
if err != nil {
return nil, err
@@ -487,9 +487,9 @@ func GetLinuxMaintainers(kernelSrc, file string) ([]string, error) {
return mtrs, nil
}
-func getMaintainersImpl(kernelSrc, file string, blame bool) ([]string, error) {
+func getMaintainersImpl(kernelSrc, file string, blame bool) (vcs.Recipients, error) {
// See #1441 re --git-min-percent.
- args := []string{"--no-n", "--no-rolestats", "--git-min-percent=15"}
+ args := []string{"--git-min-percent=15"}
if blame {
args = append(args, "--git-blame")
}
@@ -499,16 +499,7 @@ func getMaintainersImpl(kernelSrc, file string, blame bool) ([]string, error) {
if err != nil {
return nil, err
}
- lines := strings.Split(string(output), "\n")
- var mtrs []string
- for _, line := range lines {
- addr, err := mail.ParseAddress(line)
- if err != nil {
- continue
- }
- mtrs = append(mtrs, addr.Address)
- }
- return mtrs, nil
+ return vcs.ParseMaintainersLinux(output), nil
}
func (ctx *linux) extractFiles(report []byte) []string {