From 67ef0ea2b648fd72cc7f0e3ec50c5b2fa144b80c Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Fri, 10 Oct 2025 17:45:29 +0200 Subject: pkg/email/lore: wrap the Email object Wrapping the email.Email object will let us add lore-specific fields to it at a later point. --- syz-cluster/email-reporter/main.go | 8 ++++---- syz-cluster/email-reporter/stream.go | 7 +++---- syz-cluster/email-reporter/stream_test.go | 4 ++-- syz-cluster/series-tracker/main.go | 2 +- 4 files changed, 10 insertions(+), 11 deletions(-) (limited to 'syz-cluster') diff --git a/syz-cluster/email-reporter/main.go b/syz-cluster/email-reporter/main.go index bef55eb2b..58617549e 100644 --- a/syz-cluster/email-reporter/main.go +++ b/syz-cluster/email-reporter/main.go @@ -10,7 +10,7 @@ import ( "log" "time" - "github.com/google/syzkaller/pkg/email" + "github.com/google/syzkaller/pkg/email/lore" "github.com/google/syzkaller/syz-cluster/pkg/api" "github.com/google/syzkaller/syz-cluster/pkg/app" "github.com/google/syzkaller/syz-cluster/pkg/emailclient" @@ -48,7 +48,7 @@ func main() { emailConfig: cfg.EmailReporting, sender: sender, } - msgCh := make(chan *email.Email, 16) + msgCh := make(chan *lore.Email, 16) eg, loopCtx := errgroup.WithContext(ctx) if cfg.EmailReporting.LoreArchiveURL != "" { fetcher := NewLKMLEmailStream("/lore-repo/checkout", reporterClient, cfg.EmailReporting, msgCh) @@ -56,14 +56,14 @@ func main() { } eg.Go(func() error { for { - var newEmail *email.Email + var newEmail *lore.Email select { case newEmail = <-msgCh: case <-loopCtx.Done(): return nil } log.Printf("received email %q", newEmail.MessageID) - err := handler.IncomingEmail(loopCtx, newEmail) + err := handler.IncomingEmail(loopCtx, newEmail.Email) if err != nil { // Note that we just print an error and go on instead of retrying. // Some retrying may be reasonable, but it also comes with a risk of flooding diff --git a/syz-cluster/email-reporter/stream.go b/syz-cluster/email-reporter/stream.go index a27f71d9f..7b14a3336 100644 --- a/syz-cluster/email-reporter/stream.go +++ b/syz-cluster/email-reporter/stream.go @@ -10,7 +10,6 @@ import ( "strings" "time" - "github.com/google/syzkaller/pkg/email" "github.com/google/syzkaller/pkg/email/lore" "github.com/google/syzkaller/pkg/vcs" "github.com/google/syzkaller/syz-cluster/pkg/api" @@ -23,13 +22,13 @@ type LKMLEmailStream struct { reporterName string repoFolder string client *api.ReporterClient - newMessages chan *email.Email + newMessages chan *lore.Email lastCommitDate time.Time lastCommit string } func NewLKMLEmailStream(repoFolder string, client *api.ReporterClient, - cfg *app.EmailConfig, writeTo chan *email.Email) *LKMLEmailStream { + cfg *app.EmailConfig, writeTo chan *lore.Email) *LKMLEmailStream { var ownEmails []string if cfg.Dashapi != nil { ownEmails = append(ownEmails, cfg.Dashapi.From) @@ -141,7 +140,7 @@ func (s *LKMLEmailStream) fetchMessages(ctx context.Context) error { } // If the message was sent via the dashapi sender, the report ID wil be a part of the email address. -func (s *LKMLEmailStream) extractMessageID(msg *email.Email) string { +func (s *LKMLEmailStream) extractMessageID(msg *lore.Email) string { if s.cfg.Dashapi == nil { // The mode is not configured. return "" diff --git a/syz-cluster/email-reporter/stream_test.go b/syz-cluster/email-reporter/stream_test.go index db92ce927..ba35489ff 100644 --- a/syz-cluster/email-reporter/stream_test.go +++ b/syz-cluster/email-reporter/stream_test.go @@ -10,7 +10,7 @@ import ( "testing" "time" - "github.com/google/syzkaller/pkg/email" + "github.com/google/syzkaller/pkg/email/lore" "github.com/google/syzkaller/pkg/vcs" "github.com/google/syzkaller/syz-cluster/pkg/api" "github.com/google/syzkaller/syz-cluster/pkg/app" @@ -38,7 +38,7 @@ func TestEmailStream(t *testing.T) { // Emulate the lore archive and set up the loop. loreArchive := newLoreArchive(t) - writeTo := make(chan *email.Email, 16) + writeTo := make(chan *lore.Email, 16) emailCfg := &app.EmailConfig{ LoreArchiveURL: loreArchive.remoteRef(), SMTP: &app.SMTPConfig{ diff --git a/syz-cluster/series-tracker/main.go b/syz-cluster/series-tracker/main.go index 015f69290..4f57f99cf 100644 --- a/syz-cluster/series-tracker/main.go +++ b/syz-cluster/series-tracker/main.go @@ -111,7 +111,7 @@ func (sf *SeriesFetcher) Update(ctx context.Context, from time.Time) error { list = append(list, repoList...) } - var emails []*email.Email + var emails []*lore.Email idToReader := map[string]lore.EmailReader{} for _, item := range list { // TODO: this could be done in several threads. -- cgit mrf-deployment