mirror of
https://github.com/git/git.git
synced 2025-12-12 20:36:24 +01:00
ThreadSanitizer: add suppressions
Add a file .tsan-suppressions and list two functions in it: want_color() and transfer_debug(). Both of these use the pattern static int foo = -1; if (foo < 0) foo = bar(); where bar always returns the same non-negative value. This can cause ThreadSanitizer to diagnose a race when foo is written from two threads. That is indeed a race, although it arguably doesn't matter in practice since it's always the same value that is written. Add NEEDSWORK-comments to the functions so that this problem is not forever swept way under the carpet. The suppressions-file is used by setting the environment variable TSAN_OPTIONS to, e.g., "suppressions=$(pwd)/.tsan-suppressions". Observe that relative paths such as ".tsan-suppressions" might not work. Signed-off-by: Martin Ågren <martin.agren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
65961d5a75
commit
6cdf8a7929
7
color.c
7
color.c
@@ -338,6 +338,13 @@ static int check_auto_color(void)
|
||||
|
||||
int want_color(int var)
|
||||
{
|
||||
/*
|
||||
* NEEDSWORK: This function is sometimes used from multiple threads, and
|
||||
* we end up using want_auto racily. That "should not matter" since
|
||||
* we always write the same value, but it's still wrong. This function
|
||||
* is listed in .tsan-suppressions for the time being.
|
||||
*/
|
||||
|
||||
static int want_auto = -1;
|
||||
|
||||
if (var < 0)
|
||||
|
||||
Reference in New Issue
Block a user