Last active
December 16, 2020 21:11
-
-
Save kerneltoast/36750eac8e9f3b830b5ee3a84d31c037 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 37d862efc2dd2ab160a7ef3831adc0170cc1a61e Mon Sep 17 00:00:00 2001 | |
From: Sultan Alsawaf <sultan@openresty.com> | |
Date: Wed, 16 Dec 2020 13:03:47 -0800 | |
Subject: [PATCH] session.cxx: fix print error dupe-elimination for chained | |
errors | |
Commit 0e1d5b7eb397 introduced an issue where error messages would be | |
duplicated, like so: | |
Before: | |
--------------------8<-------------------- | |
semantic error: type mismatch (long): identifier 'a' at test.stp:8:5 | |
source: a = 32; | |
^ | |
semantic error: type was first inferred here (string): identifier 'a' at :4:5 | |
source: a = "stringcheese"; | |
^ | |
Pass 2: analysis failed. [man error::pass2] | |
-------------------->8-------------------- | |
After: | |
--------------------8<-------------------- | |
semantic error: type mismatch (long): identifier 'a' at test.stp:8:5 | |
source: a = 32; | |
^ | |
semantic error: type mismatch (long): identifier 'a' at :8:5 | |
source: a = 32; | |
^ | |
semantic error: type was first inferred here (string): identifier 'a' at :4:5 | |
source: a = "stringcheese"; | |
^ | |
Pass 2: analysis failed. [man error::pass2] | |
-------------------->8-------------------- | |
The first message would be duplicated because the wrong seen_errors is | |
checked inside the loop, after that first message would be printed | |
outside the loop. This fixes the issue by using the same error counter | |
throughout. | |
--- | |
session.cxx | 4 ++-- | |
1 file changed, 2 insertions(+), 2 deletions(-) | |
diff --git a/session.cxx b/session.cxx | |
index 36a405373..96719e5db 100644 | |
--- a/session.cxx | |
+++ b/session.cxx | |
@@ -2391,9 +2391,9 @@ systemtap_session::print_error (const semantic_error& se) | |
seen_errors[se.errsrc_chain()]++; | |
cerr << build_error_msg(se); | |
for (const semantic_error *e = &se; e != NULL; e = e->get_chain()) | |
- if (verbose > 1 || seen_errors[e->errsrc] < 1) // dupe-eliminate chained errors too | |
+ if (verbose > 1 || seen_errors[e->errsrc_chain()] < 1) // dupe-eliminate chained errors too | |
{ | |
- seen_errors[e->errsrc]++; | |
+ seen_errors[e->errsrc_chain()]++; | |
cerr << build_error_msg(*e); | |
} | |
} | |
-- | |
2.29.2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment