Skip to content

Commit

Permalink
bug-1926077: remove enclosing square bracket(s) from module name in s…
Browse files Browse the repository at this point in the history
…ignature generation (#6766)

* bug-1926077: remove enclosing square bracket(s) from module name in signature generation

Because:
* Some module names have extra square brackets, in particular one at the end (bug-1926561).
* This causes Crash Stats report Bugzilla tab not to list related bugs.

This commit:
* Removes enclosing square bracket(s) from module names in stack frames.

* bug-1926077: use str.strip to remove any leading or trailing square brackets
  • Loading branch information
biancadanforth authored Oct 25, 2024
1 parent 925b0e7 commit 6e00a36
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 3 additions & 2 deletions socorro/signature/rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,6 @@ def normalize_cpp_function(self, function, line):
if function.endswith(ref):
function = function[: -len(ref)].strip()

# Convert `anonymous namespace' to (anonymous namespace)

# Drop the prefix and return type if there is any if it's not operator
# overloading--operator overloading syntax doesn't have the things
# we're dropping here and can look curious, so don't try
Expand Down Expand Up @@ -247,6 +245,9 @@ def normalize_frame(

# If there's a module, use that
if module:
# Remove extra [ and/or ] at beginning or end if present; see Bug 1926077
module = module.strip("[]")

return module

# If there are unloaded modules, use the first one
Expand Down
5 changes: 5 additions & 0 deletions socorro/signature/tests/test_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,11 @@ def test_no_mutation(self):
),
"(unloaded unmod)",
),
# no function or line, so uses module; module name has extra bracket(s)
(("module]", "", "\\a\\b\\c\\source", "", "0xfff"), "module"),
(("[module]", "", "\\a\\b\\c\\source", "", "0xfff"), "module"),
(("[module", "", "\\a\\b\\c\\source", "", "0xfff"), "module"),
(("[[[module]]", "", "\\a\\b\\c\\source", "", "0xfff"), "module"),
],
)
def test_normalize_frame(self, args, expected):
Expand Down

0 comments on commit 6e00a36

Please sign in to comment.