@@ -0,0 +1,2808 @@
+#!/usr/bin/env python%0A%0Aimport json%0Aimport os%0Aimport re%0A%0A%0Adef fuzzManagerKnownBugs():%0A    bugs = %5B%5D%0A    sk = os.path.expanduser(%22~/fuzzsigcache/%22)%0A    for fn in os.listdir(sk):%0A        if fn.endswith(%22.metadata%22):%0A            with open(os.path.join(sk, fn)) as f:%0A                metadata = json.load(f)%0A                bug = metadata.get(%22bug__id%22)%0A                if bug is not None:%0A                    bug = bug.strip()%0A                    if bug != %22%22:%0A                        bugs.append(bug)%0A    return bugs%0A%0A%0Adef bugNumbersIn(s):%0A    return %5Bmatch.group(1) for match in re.finditer(r%22%5BbB%5Dug (%5Cd+)%22, s)%5D%0A%0A%0Aassert bugNumbersIn(%22Bug 123, bug 456%22) == %5B%22123%22, %22456%22%5D%0Aassert bugNumbersIn(%22%22) == %5B%5D%0A%0A%0Adef exportSignatures(validSymptom, fmkb, files):%0A    exports = %5B%5D%0A    for fn in files:%0A        lastComment = %22%22%0A        knownToFuzzManager = False%0A        for line in open(fn):%0A            line = line.strip()%0A            if line == %22%22:%0A                pass%0A            elif line.startswith(%22#%22):%0A                lastComment = line%0A                knownToFuzzManager = False%0A                for bug in fmkb:%0A                    if bug in line:%0A                        knownToFuzzManager = True%0A                        print %22Skipping bug known to fuzzmanager: %22 + line%0A                        print%0A                        break%0A            elif validSymptom(line):%0A                if not knownToFuzzManager:%0A                    bugs = bugNumbersIn(lastComment)%0A                    for bug in bugs:%0A                        exports.append(%7B'symptom': line, 'bug': bug, 'note': lastComment%7D)%0A                    if len(bugs) == 0:%0A                        print %22No bug number: %22%0A                        print lastComment%0A                        print line%0A                        print%0A    return exports%0A%0A%0Adef validAssertion(line):%0A    # We only want fatal assertions%0A    return line.startswith(%22Assertion failure%22) or line.startswith(%22:%22)%0A%0A%0Adef validCrash(line):%0A    # Skip crashes with %5BTMR%5D, %5BEXPLOITABLE%5D, or stack indices%0A    return not line.startswith(%22%5B%22) and not line.strip()%5B0%5D.isdigit()%0A%0A%0Adef main():%0A    fmkb = fuzzManagerKnownBugs()%0A%0A    print%0A    print %22### FATAL ASSERTIONS ###%22%0A    print%0A    print json.dumps(exportSignatures(validAssertion, fmkb,%0A        %5B%0A            os.path.expanduser(%22~/funfuzz/known/mozilla-central/assertions.txt%22),%0A            os.path.expanduser(%22~/funfuzz-private/known/mozilla-central/assertions.txt%22)%0A        %5D), indent=4)%0A%0A    print%0A    print %22### CRASHES ###%22%0A    print%0A    print json.dumps(exportSignatures(validCrash, fmkb,%0A        %5B%0A            os.path.expanduser(%22~/funfuzz/known/mozilla-central/crashes.txt%22),%0A            os.path.expanduser(%22~/funfuzz-private/known/mozilla-central/crashes.txt%22)%0A        %5D), indent=4)%0A%0A%0Aif __name__ == %22__main__%22:%0A    main()%0A

Add exportForFuzzManager.py