]> git.ipfire.org Git - thirdparty/libvirt.git/commit
tests: avoid test failure on rawhide gnutls
authorEric Blake <eblake@redhat.com>
Fri, 6 Jan 2012 21:07:23 +0000 (14:07 -0700)
committerEric Blake <eblake@redhat.com>
Thu, 17 May 2012 14:45:26 +0000 (08:45 -0600)
commit643ac7203a292e8162fcc3bb19623d239cb1e5d8
tree196b8d809f908fc06c529fbb4876997f164b5211
parente11aa0262b4142250880dd19d28a48c69199fec1
tests: avoid test failure on rawhide gnutls

I hit a VERY weird testsuite failure on rawhide, which included
_binary_ output to stderr, followed by a hang waiting for me
to type something! (Here, using ^@ for NUL):

$ ./commandtest
TEST: commandtest
      WARNING: gnome-keyring:: couldn't send data: Bad file descriptor
.WARNING: gnome-keyring:: couldn't send data: Bad file descriptor
.WARNING: gnome-keyring:: couldn't send data: Bad file descriptor
WARNING: gnome-keyring:: couldn't send data: Bad file descriptor
.8^@^@^@8^@^@^@^A^@^@^@^Bay^A^@^@^@)PRIVATE-GNOME-KEYRING-PKCS11-PROTOCOL-V-1

I finally traced it to the fact that gnome-keyring, called via
gnutls_global_init which is turn called by virNetTLSInit, opens
an internal fd that it expects to communicate to via a
pthread_atfork handler (never mind that it violates POSIX by
using non-async-signal-safe functions in that handler:
https://bugzilla.redhat.com/show_bug.cgi?id=772320).

Our problem stems from the fact that we pulled the rug out from
under the library's expectations by closing an fd that it had
just opened.  While we aren't responsible for fixing the bugs
in that pthread_atfork handler, we can at least avoid the bugs
by not closing the fd in the first place.

* tests/commandtest.c (mymain): Avoid closing fds that were opened
by virInitialize.
(cherry picked from commit 74ff57506c762f7c1f2bdbcce55f6d620687caab)
tests/commandtest.c