mirror of
https://github.com/git/git.git
synced 2024-06-03 14:36:10 +02:00
Merge branch 'ma/ts-cleanups'
Assorted bugfixes and clean-ups. * ma/ts-cleanups: ThreadSanitizer: add suppressions strbuf_setlen: don't write to strbuf_slopbuf pack-objects: take lock before accessing `remaining` convert: always initialize attr_action in convert_attrs
This commit is contained in:
commit
a48ce37858
|
@ -0,0 +1,10 @@
|
||||||
|
# Suppressions for ThreadSanitizer (tsan).
|
||||||
|
#
|
||||||
|
# This 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.
|
||||||
|
|
||||||
|
# A static variable is written to racily, but we always write the same value, so
|
||||||
|
# in practice it (hopefully!) doesn't matter.
|
||||||
|
race:^want_color$
|
||||||
|
race:^transfer_debug$
|
|
@ -2171,7 +2171,10 @@ static void *threaded_find_deltas(void *arg)
|
||||||
{
|
{
|
||||||
struct thread_params *me = arg;
|
struct thread_params *me = arg;
|
||||||
|
|
||||||
|
progress_lock();
|
||||||
while (me->remaining) {
|
while (me->remaining) {
|
||||||
|
progress_unlock();
|
||||||
|
|
||||||
find_deltas(me->list, &me->remaining,
|
find_deltas(me->list, &me->remaining,
|
||||||
me->window, me->depth, me->processed);
|
me->window, me->depth, me->processed);
|
||||||
|
|
||||||
|
@ -2193,7 +2196,10 @@ static void *threaded_find_deltas(void *arg)
|
||||||
pthread_cond_wait(&me->cond, &me->mutex);
|
pthread_cond_wait(&me->cond, &me->mutex);
|
||||||
me->data_ready = 0;
|
me->data_ready = 0;
|
||||||
pthread_mutex_unlock(&me->mutex);
|
pthread_mutex_unlock(&me->mutex);
|
||||||
|
|
||||||
|
progress_lock();
|
||||||
}
|
}
|
||||||
|
progress_unlock();
|
||||||
/* leave ->working 1 so that this doesn't get more work assigned */
|
/* leave ->working 1 so that this doesn't get more work assigned */
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
7
color.c
7
color.c
|
@ -338,6 +338,13 @@ static int check_auto_color(void)
|
||||||
|
|
||||||
int want_color(int var)
|
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;
|
static int want_auto = -1;
|
||||||
|
|
||||||
if (var < 0)
|
if (var < 0)
|
||||||
|
|
|
@ -1040,7 +1040,6 @@ static void convert_attrs(struct conv_attrs *ca, const char *path)
|
||||||
ca->crlf_action = git_path_check_crlf(ccheck + 4);
|
ca->crlf_action = git_path_check_crlf(ccheck + 4);
|
||||||
if (ca->crlf_action == CRLF_UNDEFINED)
|
if (ca->crlf_action == CRLF_UNDEFINED)
|
||||||
ca->crlf_action = git_path_check_crlf(ccheck + 0);
|
ca->crlf_action = git_path_check_crlf(ccheck + 0);
|
||||||
ca->attr_action = ca->crlf_action;
|
|
||||||
ca->ident = git_path_check_ident(ccheck + 1);
|
ca->ident = git_path_check_ident(ccheck + 1);
|
||||||
ca->drv = git_path_check_convert(ccheck + 2);
|
ca->drv = git_path_check_convert(ccheck + 2);
|
||||||
if (ca->crlf_action != CRLF_BINARY) {
|
if (ca->crlf_action != CRLF_BINARY) {
|
||||||
|
@ -1054,12 +1053,14 @@ static void convert_attrs(struct conv_attrs *ca, const char *path)
|
||||||
else if (eol_attr == EOL_CRLF)
|
else if (eol_attr == EOL_CRLF)
|
||||||
ca->crlf_action = CRLF_TEXT_CRLF;
|
ca->crlf_action = CRLF_TEXT_CRLF;
|
||||||
}
|
}
|
||||||
ca->attr_action = ca->crlf_action;
|
|
||||||
} else {
|
} else {
|
||||||
ca->drv = NULL;
|
ca->drv = NULL;
|
||||||
ca->crlf_action = CRLF_UNDEFINED;
|
ca->crlf_action = CRLF_UNDEFINED;
|
||||||
ca->ident = 0;
|
ca->ident = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Save attr and make a decision for action */
|
||||||
|
ca->attr_action = ca->crlf_action;
|
||||||
if (ca->crlf_action == CRLF_TEXT)
|
if (ca->crlf_action == CRLF_TEXT)
|
||||||
ca->crlf_action = text_eol_is_crlf() ? CRLF_TEXT_CRLF : CRLF_TEXT_INPUT;
|
ca->crlf_action = text_eol_is_crlf() ? CRLF_TEXT_CRLF : CRLF_TEXT_INPUT;
|
||||||
if (ca->crlf_action == CRLF_UNDEFINED && auto_crlf == AUTO_CRLF_FALSE)
|
if (ca->crlf_action == CRLF_UNDEFINED && auto_crlf == AUTO_CRLF_FALSE)
|
||||||
|
|
5
strbuf.h
5
strbuf.h
|
@ -147,7 +147,10 @@ static inline void strbuf_setlen(struct strbuf *sb, size_t len)
|
||||||
if (len > (sb->alloc ? sb->alloc - 1 : 0))
|
if (len > (sb->alloc ? sb->alloc - 1 : 0))
|
||||||
die("BUG: strbuf_setlen() beyond buffer");
|
die("BUG: strbuf_setlen() beyond buffer");
|
||||||
sb->len = len;
|
sb->len = len;
|
||||||
sb->buf[len] = '\0';
|
if (sb->buf != strbuf_slopbuf)
|
||||||
|
sb->buf[len] = '\0';
|
||||||
|
else
|
||||||
|
assert(!strbuf_slopbuf[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1117,6 +1117,13 @@ int transport_helper_init(struct transport *transport, const char *name)
|
||||||
__attribute__((format (printf, 1, 2)))
|
__attribute__((format (printf, 1, 2)))
|
||||||
static void transfer_debug(const char *fmt, ...)
|
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;
|
va_list args;
|
||||||
char msgbuf[PBUFFERSIZE];
|
char msgbuf[PBUFFERSIZE];
|
||||||
static int debug_enabled = -1;
|
static int debug_enabled = -1;
|
||||||
|
|
Loading…
Reference in New Issue