diff options
author | Martin Ågren <martin.agren@gmail.com> | 2017-08-21 19:43:48 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-08-23 10:38:56 -0700 |
commit | 6cdf8a7929688ea5702ab53f450d038e973e64e1 (patch) | |
tree | 6bc1c2972542be1c7ada97faefa345278b582c7e /transport-helper.c | |
parent | 65961d5a75e28aa04a90ee65106f71da177fd4b3 (diff) | |
download | git-6cdf8a7929688ea5702ab53f450d038e973e64e1.tar.gz |
ThreadSanitizer: add suppressionsma/ts-cleanups
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>
Diffstat (limited to 'transport-helper.c')
-rw-r--r-- | transport-helper.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/transport-helper.c b/transport-helper.c index 33cff38cc0..2b830b2290 100644 --- a/transport-helper.c +++ b/transport-helper.c @@ -1117,6 +1117,13 @@ int transport_helper_init(struct transport *transport, const char *name) __attribute__((format (printf, 1, 2))) static void transfer_debug(const char *fmt, ...) { + /* + * NEEDSWORK: This function is sometimes used from multiple threads, and + * we end up using debug_enabled 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. + */ + va_list args; char msgbuf[PBUFFERSIZE]; static int debug_enabled = -1; |