libgcrypt-1.6.0 breaks dirmngr-1.1.1:
Running dirmngr (without arguments) causes a segmentation fault while executing
the line
if (pth_current->data_value == NULL) {
in line 68 of pth-2.0.7/pth_data.c because pth_current is NULL. The above line
is part of the function pth_key_setdata() called in the function main() in line
723 of dirmngr-1.1.1/src/dirmngr.c
The reason of pth_current being NULL is that the function
gcry_control(GCRYCTL_SET_THREAD_CBS,...) of libgcrypt, called in main() in line
671 of dirmngr-1.1.1/src/dirmngr.c, does no longer cause it being initialized.
(I could not yet find out why.)
By adding the following line after line 671 of dirmngr.c, you can see the value
of pth_current after calling gcry_control(GCRYCTL_SET_THREAD_CBS,...) and before
the segmentation fault occurs:
{extern pth_t
pth_current;fprintf(stderr,"%08lx\n",(long)pth_current);fflush(stderr);}
My configure options (I use the latest versions of the sources), even if
probably irrelevant for the problem:
pth: --enable-static --disable-shared
libgpg-error: --enable-static --disable-shared
libassuan: --enable-static --disable-shared --with-gpg-error-prefix=$prefix
libgcrypt: --enable-static --disable-shared --with-gpg-error-prefix=$prefix
libksba: --enable-static --disable-shared --with-gpg-error-prefix=$prefix
dirmngr: --with-gpg-error-prefix=$prefix \
--with-pth-prefix=$prefix --with-libassuan-prefix=$prefix \ --with-libgcrypt-prefix=$prefix --with-ksba-prefix=$prefix
pinentry: --disable-pinentry-gtk2
gnupg-2: --with-gpg-error-prefix=$prefix \
--with-pth-prefix=$prefix --with-libassuan-prefix=$prefix \ --with-libgcrypt-prefix=$prefix --with-ksba-prefix=$prefix \ --with-dirmngr-pgm=$prefix/bin/dirmngr
--with-pinentry-pgm=$prefix/bin/pinentrywrapper
Switching back to libgcrypt-1.5.3 removed the problem for me.