Skip to content

Commit 7c10111

Browse files
yulongzhangdvyukov
authored andcommitted
tools/syz-aflow: enable downloading bugs by ID
Originally we only supported downloading by ExtID. This change enables downloading by ID as well. It tries to download with the "extid=" link, and if it hits an error, it retries to download with "id=".
1 parent efb3e89 commit 7c10111

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

tools/syz-aflow/aflow.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func main() {
3535
flagWorkdir = flag.String("workdir", "", "directory for kernel checkout, kernel builds, etc")
3636
flagModel = flag.String("model", "", "use this LLM model, if empty use default models")
3737
flagCacheSize = flag.String("cache-size", "10GB", "max cache size (e.g. 100MB, 5GB, 1TB)")
38-
flagDownloadBug = flag.String("download-bug", "", "extid of a bug to download from the dashboard"+
38+
flagDownloadBug = flag.String("download-bug", "", "extid or id of a bug to download from the dashboard"+
3939
" and save into -input file")
4040
flagAuth = flag.Bool("auth", false, "use gcloud auth token for downloading bugs (set it up with"+
4141
" gcloud auth application-default login)")
@@ -104,13 +104,17 @@ func onEvent(span *trajectory.Span) error {
104104
return nil
105105
}
106106

107-
func downloadBug(extID, inputFile, token string) error {
107+
func downloadBug(id, inputFile, token string) error {
108108
if inputFile == "" {
109109
return fmt.Errorf("-download-bug requires -input flag")
110110
}
111-
resp, err := get(fmt.Sprintf("/bug?extid=%v&json=1", extID), token)
111+
resp, err := get(fmt.Sprintf("/bug?extid=%v&json=1", id), token)
112112
if err != nil {
113-
return err
113+
// Retry with "id=" if we failed with "extid="
114+
resp, err = get(fmt.Sprintf("/bug?id=%v&json=1", id), token)
115+
if err != nil {
116+
return err
117+
}
114118
}
115119
var info map[string]any
116120
if err := json.Unmarshal([]byte(resp), &info); err != nil {

0 commit comments

Comments
 (0)