From f99f650b074d8520d16a51cc7e195da02089f9f4 Mon Sep 17 00:00:00 2001 From: Andrzej Kotulski Date: Fri, 26 Jun 2015 09:26:37 -0100 Subject: [PATCH] Don't add buckets to error message by default Summary: @public Currently InferAnalyze always adds bucket to the message. Later, python code strips it, but not everywhere. Changes: 1. Since it's easy to not write bucket in ocaml, stop writing them by default. 2. Add option to print them to InferAnalyze and pass it if infer is in debug mode. Test Plan: 1. Run on openssl, confirm that no bucket info is written to stdout and csv 2. Run on small example in debug mode and see buckets on stdout --- infer/bin/inferlib.py | 3 ++- infer/bin/utils.py | 6 ------ infer/src/backend/config.ml | 4 ++-- infer/src/backend/inferanalyze.ml | 4 +++- 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/infer/bin/inferlib.py b/infer/bin/inferlib.py index 9f9ecb9e5..434f83076 100644 --- a/infer/bin/inferlib.py +++ b/infer/bin/inferlib.py @@ -308,7 +308,7 @@ def print_errors(csv_report, bugs_out): kind = row[utils.CSV_INDEX_KIND] line = row[utils.CSV_INDEX_LINE] error_type = row[utils.CSV_INDEX_TYPE] - msg = utils.remove_bucket(row[utils.CSV_INDEX_QUALIFIER]) + msg = row[utils.CSV_INDEX_QUALIFIER] print_and_write( file_out, '{0}:{1}: {2}: {3}\n {4}\n'.format( @@ -459,6 +459,7 @@ class Infer: '-dotty', '-print_types', '-trace_error', + '-print_buckets', # '-notest', ] diff --git a/infer/bin/utils.py b/infer/bin/utils.py index 8753ec685..3ca92ee11 100644 --- a/infer/bin/utils.py +++ b/infer/bin/utils.py @@ -101,12 +101,6 @@ def error(msg): print(msg, file=sys.stderr) -def remove_bucket(bug_message): - """ Remove anything from the beginning if the message that - looks like a bucket """ - return re.sub(r'(^\[[a-zA-Z0-9]*\])', '', bug_message, 1) - - def get_cmd_in_bin_dir(binary_name): # this relies on the fact that utils.py is located in infer/bin return os.path.join( diff --git a/infer/src/backend/config.ml b/infer/src/backend/config.ml index e1f8292bb..910204c33 100644 --- a/infer/src/backend/config.ml +++ b/infer/src/backend/config.ml @@ -318,10 +318,10 @@ let optimistic_cast = ref false let filter_buckets = ref false (** if true, show buckets in textual description of errors *) -let show_buckets = ref true +let show_buckets = ref false (** if true, show memory leak buckets in textual description of errors *) -let show_ml_buckets = ref true +let show_ml_buckets = ref false (** if true, print cfg nodes in the dot file that are not defined in that file *) let dotty_cfg_libs = ref true diff --git a/infer/src/backend/inferanalyze.ml b/infer/src/backend/inferanalyze.ml index fd88c2e35..a6f07c94d 100644 --- a/infer/src/backend/inferanalyze.ml +++ b/infer/src/backend/inferanalyze.ml @@ -172,7 +172,9 @@ let arg_desc = "-tracing", Arg.Unit (fun () -> Config.report_runtime_exceptions := true), None, "Report error traces for runtime exceptions (Only for Java)"; "-allow_specs_cleanup", Arg.Unit (fun () -> allow_specs_cleanup := true), None, - "Allow to remove existing specs before running analysis when it's not incremental" + "Allow to remove existing specs before running analysis when it's not incremental"; + "-print_buckets", Arg.Unit (fun() -> Config.show_buckets := true; Config.show_ml_buckets := true), None, + "Add buckets to issue descriptions, useful when developing infer" ] in Arg2.create_options_desc false "Reserved Options: Experimental features, use with caution!" desc in base_arg @ reserved_arg