Skip to content

Commit 4b540cf

Browse files
vdyedscho
authored andcommitted
async_die_is_recursing: work around GCC v11.x issue on Fedora
This fix corrects an issue found in the `dockerized(pedantic, fedora)` CI build, first appearing after the introduction of a new version of the Fedora docker image version. This image includes a version of `glibc` with the attribute `__attr_access_none` added to `pthread_setspecific` [1], the implementation of which only exists for GCC 11.X - the version included in the Fedora image. The attribute requires that the pointer provided in the second argument of `pthread_getspecific` must, if not NULL, be a pointer to a valid object. In the usage in `async_die_is_recursing`, `(void *)1` is not valid, causing the error. This fix imitates a workaround added in SELinux [2] by using the pointer to the static `async_die_counter` itself as the second argument to `pthread_setspecific`. This guaranteed non-NULL, valid pointer matches the intent of the current usage while not triggering the build error. [1] https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=a1561c3bbe8 [2] https://lore.kernel.org/all/[email protected]/ Co-authored-by: Johannes Schindelin <[email protected]> Signed-off-by: Victoria Dye <[email protected]> Acked-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 1ece66b commit 4b540cf

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

run-command.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ static NORETURN void die_async(const char *err, va_list params)
614614
static int async_die_is_recursing(void)
615615
{
616616
void *ret = pthread_getspecific(async_die_counter);
617-
pthread_setspecific(async_die_counter, (void *)1);
617+
pthread_setspecific(async_die_counter, &async_die_counter); /* set to any non-NULL valid pointer */
618618
return ret != NULL;
619619
}
620620

0 commit comments

Comments
 (0)