From bfb20202da73451f997b711447ee68bc3635868e Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Wed, 12 Jul 2023 15:34:46 +0200 Subject: dashboard: always return full UserSpaceArch Currently we return an empty value for amd64, so that it's not reported. Let's make the API more flexible -- return the value as is and let specific reporters decide whether to mention amd64 or not. --- dashboard/app/reporting.go | 2 -- dashboard/app/reporting_email.go | 5 +++++ dashboard/app/reporting_test.go | 2 ++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/dashboard/app/reporting.go b/dashboard/app/reporting.go index 071d67339..e29d2da16 100644 --- a/dashboard/app/reporting.go +++ b/dashboard/app/reporting.go @@ -1569,8 +1569,6 @@ func kernelArch(arch string) string { switch arch { case targets.I386: return "i386" - case targets.AMD64: - return "" // this is kinda the default, so we don't notify about it default: return arch } diff --git a/dashboard/app/reporting_email.go b/dashboard/app/reporting_email.go index 35f104d71..071def054 100644 --- a/dashboard/app/reporting_email.go +++ b/dashboard/app/reporting_email.go @@ -22,6 +22,7 @@ import ( "github.com/google/syzkaller/pkg/email" "github.com/google/syzkaller/pkg/email/lore" "github.com/google/syzkaller/pkg/html" + "github.com/google/syzkaller/sys/targets" "golang.org/x/net/context" "google.golang.org/appengine/v2" db "google.golang.org/appengine/v2/datastore" @@ -331,6 +332,10 @@ func emailReport(c context.Context, rep *dashapi.BugReport) error { if err := json.Unmarshal(rep.Config, cfg); err != nil { return fmt.Errorf("failed to unmarshal email config: %v", err) } + if rep.UserSpaceArch == targets.AMD64 { + // This is default, so don't include the info. + rep.UserSpaceArch = "" + } templ := "" switch rep.Type { case dashapi.ReportNew, dashapi.ReportRepro: diff --git a/dashboard/app/reporting_test.go b/dashboard/app/reporting_test.go index 26ce564cd..166faf55c 100644 --- a/dashboard/app/reporting_test.go +++ b/dashboard/app/reporting_test.go @@ -55,6 +55,7 @@ func TestReportBug(t *testing.T) { OS: targets.Linux, Arch: targets.AMD64, VMArch: targets.AMD64, + UserSpaceArch: targets.AMD64, First: true, Moderation: true, Title: "title1", @@ -228,6 +229,7 @@ func TestInvalidBug(t *testing.T) { OS: targets.Linux, Arch: targets.AMD64, VMArch: targets.AMD64, + UserSpaceArch: targets.AMD64, First: true, Moderation: true, Title: "title1 (2)", -- cgit mrf-deployment