diff --git a/dashboard/app/email_test.go b/dashboard/app/email_test.go index e8666426..522ebc7d 100644 --- a/dashboard/app/email_test.go +++ b/dashboard/app/email_test.go @@ -43,10 +43,10 @@ func TestEmailReport(t *testing.T) { c.expectEQ(msg.To, []string{to}) c.expectEQ(msg.Subject, crash.Title) c.expectEQ(len(msg.Attachments), 2) - c.expectEQ(msg.Attachments[0].Name, "config.txt") - c.expectEQ(msg.Attachments[0].Data, build.KernelConfig) - c.expectEQ(msg.Attachments[1].Name, "raw.log.txt") - c.expectEQ(msg.Attachments[1].Data, crash.Log) + c.expectEQ(msg.Attachments[0].Name, "raw.log.txt") + c.expectEQ(msg.Attachments[0].Data, crash.Log) + c.expectEQ(msg.Attachments[1].Name, "config.txt") + c.expectEQ(msg.Attachments[1].Data, build.KernelConfig) body := fmt.Sprintf(`Hello, syzbot hit the following crash on repo1/branch1 commit @@ -148,12 +148,12 @@ For more options, visit https://groups.google.com/d/optout. c.expectEQ(msg.To, to) c.expectEQ(msg.Subject, crash.Title) c.expectEQ(len(msg.Attachments), 3) - c.expectEQ(msg.Attachments[0].Name, "config.txt") - c.expectEQ(msg.Attachments[0].Data, build.KernelConfig) - c.expectEQ(msg.Attachments[1].Name, "raw.log.txt") - c.expectEQ(msg.Attachments[1].Data, crash.Log) - c.expectEQ(msg.Attachments[2].Name, "repro.syz.txt") - c.expectEQ(msg.Attachments[2].Data, syzRepro) + c.expectEQ(msg.Attachments[0].Name, "raw.log.txt") + c.expectEQ(msg.Attachments[0].Data, crash.Log) + c.expectEQ(msg.Attachments[1].Name, "repro.syz.txt") + c.expectEQ(msg.Attachments[1].Data, syzRepro) + c.expectEQ(msg.Attachments[2].Name, "config.txt") + c.expectEQ(msg.Attachments[2].Data, build.KernelConfig) c.expectEQ(msg.Headers["In-Reply-To"], []string{"<1234>"}) body := fmt.Sprintf(`syzbot has found reproducer for the following crash on repo1/branch1 commit kernel_commit1 (Sat Feb 3 04:05:06 0001 +0000) @@ -198,12 +198,12 @@ report1 c.expectEQ(msg.To, []string{"bar@foo.com", "bugs@syzkaller.com", "foo@bar.com"}) c.expectEQ(msg.Subject, crash.Title) c.expectEQ(len(msg.Attachments), 3) - c.expectEQ(msg.Attachments[0].Name, "config.txt") - c.expectEQ(msg.Attachments[0].Data, build.KernelConfig) - c.expectEQ(msg.Attachments[1].Name, "raw.log.txt") - c.expectEQ(msg.Attachments[1].Data, crash.Log) - c.expectEQ(msg.Attachments[2].Name, "repro.syz.txt") - c.expectEQ(msg.Attachments[2].Data, syzRepro) + c.expectEQ(msg.Attachments[0].Name, "raw.log.txt") + c.expectEQ(msg.Attachments[0].Data, crash.Log) + c.expectEQ(msg.Attachments[1].Name, "repro.syz.txt") + c.expectEQ(msg.Attachments[1].Data, syzRepro) + c.expectEQ(msg.Attachments[2].Name, "config.txt") + c.expectEQ(msg.Attachments[2].Data, build.KernelConfig) body := fmt.Sprintf(`Hello, syzbot hit the following crash on repo1/branch1 commit @@ -284,14 +284,14 @@ Content-Type: text/plain c.expectEQ(msg.To, []string{"another@another.com", "bar@foo.com", "bugs@syzkaller.com", "foo@bar.com", "new@new.com", "qux@qux.com"}) c.expectEQ(msg.Subject, crash.Title) c.expectEQ(len(msg.Attachments), 4) - c.expectEQ(msg.Attachments[0].Name, "config.txt") - c.expectEQ(msg.Attachments[0].Data, build2.KernelConfig) - c.expectEQ(msg.Attachments[1].Name, "raw.log.txt") - c.expectEQ(msg.Attachments[1].Data, crash.Log) - c.expectEQ(msg.Attachments[2].Name, "repro.syz.txt") - c.expectEQ(msg.Attachments[2].Data, syzRepro) - c.expectEQ(msg.Attachments[3].Name, "repro.c.txt") - c.expectEQ(msg.Attachments[3].Data, crash.ReproC) + c.expectEQ(msg.Attachments[0].Name, "raw.log.txt") + c.expectEQ(msg.Attachments[0].Data, crash.Log) + c.expectEQ(msg.Attachments[1].Name, "repro.syz.txt") + c.expectEQ(msg.Attachments[1].Data, syzRepro) + c.expectEQ(msg.Attachments[2].Name, "repro.c.txt") + c.expectEQ(msg.Attachments[2].Data, crash.ReproC) + c.expectEQ(msg.Attachments[3].Name, "config.txt") + c.expectEQ(msg.Attachments[3].Data, build2.KernelConfig) body := fmt.Sprintf(`syzbot has found reproducer for the following crash on repo2/branch2 commit kernel_commit2 (Sat Feb 3 04:05:06 0001 +0000) kernel_commit_title2 diff --git a/dashboard/app/jobs_test.go b/dashboard/app/jobs_test.go index cb7d0cd9..f4a5a16b 100644 --- a/dashboard/app/jobs_test.go +++ b/dashboard/app/jobs_test.go @@ -116,12 +116,12 @@ func TestJob(t *testing.T) { c.expectEQ(msg.To, []string{"default@sender.com", list}) c.expectEQ(msg.Subject, crash.Title) c.expectEQ(len(msg.Attachments), 3) - c.expectEQ(msg.Attachments[0].Name, "config.txt") - c.expectEQ(msg.Attachments[0].Data, build.KernelConfig) - c.expectEQ(msg.Attachments[1].Name, "patch.diff") - c.expectEQ(msg.Attachments[1].Data, []byte(patch)) - c.expectEQ(msg.Attachments[2].Name, "raw.log.txt") - c.expectEQ(msg.Attachments[2].Data, jobDoneReq.CrashLog) + c.expectEQ(msg.Attachments[0].Name, "patch.diff") + c.expectEQ(msg.Attachments[0].Data, []byte(patch)) + c.expectEQ(msg.Attachments[1].Name, "raw.log.txt") + c.expectEQ(msg.Attachments[1].Data, jobDoneReq.CrashLog) + c.expectEQ(msg.Attachments[2].Name, "config.txt") + c.expectEQ(msg.Attachments[2].Data, build.KernelConfig) body := `Hello, syzbot has tested the proposed patch but the reproducer still triggered crash: @@ -156,10 +156,10 @@ Raw console output is attached. { msg := <-c.emailSink c.expectEQ(len(msg.Attachments), 2) - c.expectEQ(msg.Attachments[0].Name, "config.txt") - c.expectEQ(msg.Attachments[0].Data, build.KernelConfig) - c.expectEQ(msg.Attachments[1].Name, "patch.diff") - c.expectEQ(msg.Attachments[1].Data, []byte(patch)) + c.expectEQ(msg.Attachments[0].Name, "patch.diff") + c.expectEQ(msg.Attachments[0].Data, []byte(patch)) + c.expectEQ(msg.Attachments[1].Name, "config.txt") + c.expectEQ(msg.Attachments[1].Data, build.KernelConfig) body := `Hello, syzbot tried to test the proposed patch but build/boot failed: @@ -194,10 +194,10 @@ Kernel config is attached. { msg := <-c.emailSink c.expectEQ(len(msg.Attachments), 2) - c.expectEQ(msg.Attachments[0].Name, "config.txt") - c.expectEQ(msg.Attachments[0].Data, build.KernelConfig) - c.expectEQ(msg.Attachments[1].Name, "patch.diff") - c.expectEQ(msg.Attachments[1].Data, []byte(patch)) + c.expectEQ(msg.Attachments[0].Name, "patch.diff") + c.expectEQ(msg.Attachments[0].Data, []byte(patch)) + c.expectEQ(msg.Attachments[1].Name, "config.txt") + c.expectEQ(msg.Attachments[1].Data, build.KernelConfig) body := fmt.Sprintf(`Hello, syzbot has tested the proposed patch and the reproducer did not trigger crash: diff --git a/dashboard/app/reporting_email.go b/dashboard/app/reporting_email.go index d7e0b10d..0a0f1ed1 100644 --- a/dashboard/app/reporting_email.go +++ b/dashboard/app/reporting_email.go @@ -144,12 +144,7 @@ func emailReport(c context.Context, rep *dashapi.BugReport, templ string) error } to = email.MergeEmailLists(to, rep.CC) var attachments []aemail.Attachment - if len(rep.KernelConfig) != 0 { - attachments = append(attachments, aemail.Attachment{ - Name: "config.txt", - Data: rep.KernelConfig, - }) - } + // Note: order of attachments is important. Some email clients show them inline. if len(rep.Patch) != 0 { attachments = append(attachments, aemail.Attachment{ Name: "patch.diff", @@ -174,6 +169,12 @@ func emailReport(c context.Context, rep *dashapi.BugReport, templ string) error Data: rep.ReproC, }) } + if len(rep.KernelConfig) != 0 { + attachments = append(attachments, aemail.Attachment{ + Name: "config.txt", + Data: rep.KernelConfig, + }) + } // Build error output and failing VM boot log can be way too long to inline. const maxInlineError = 16 << 10 errorText, errorTruncated := rep.Error, false