Hi Stefan, On Sat, 22 Oct 2016, Stefan Beller wrote:
> @@ -46,6 +47,19 @@ struct git_attr { > static int attr_nr; > static struct git_attr *(git_attr_hash[HASHSIZE]); > > +#ifndef NO_PTHREADS > + > +static pthread_mutex_t attr_mutex; > +#define attr_lock() pthread_mutex_lock(&attr_mutex) > +#define attr_unlock() pthread_mutex_unlock(&attr_mutex) This mutex is never initialized. That may work on the system you tested, but it is incorrect, and it does segfault on Windows. A lot. I need *at least* something like this to make it stop crashing all over the test suite: -- snipsnap -- diff --git a/attr.c b/attr.c index d5a6aa9..6933504 100644 --- a/attr.c +++ b/attr.c @@ -50,7 +50,16 @@ static struct git_attr *(git_attr_hash[HASHSIZE]); #ifndef NO_PTHREADS static pthread_mutex_t attr_mutex; -#define attr_lock()pthread_mutex_lock(&attr_mutex) +static inline void attr_lock(void) +{ + static int initialized; + + if (!initialized) { + pthread_mutex_init(&attr_mutex, NULL); + initialized = 1; + } + pthread_mutex_lock(&attr_mutex); +} #define attr_unlock()pthread_mutex_unlock(&attr_mutex) #else