File descriptor leaked in .dbus/dbus-message-util.c on running test-bus[-dispatch][-sha1] with installed sssd version 1.13.4
On an opensuse leap 42.3 installation test-bus, test-bus-dispatch and test-bus-dispatch-sha1 build from git master branch fails with a leaked file descriptor regardless from the used build system.
The following test runs shows the issue from a cmake build:
DBUS_TEST_DATA=/home/xxx/src/dbus-cmake-build/test/data bin/test-bus ... 8: ok 3 - config-parser 8: # config-parser test took 0 seconds 8: ok 4 - config-parser did not leak memory 8: Bail out! file descriptor 4 leaked in /home/xxx/src/dbus/dbus/dbus-message-util.c.
DBUS_TEST_DATA=/home/xxx/src/dbus-cmake-build/test/data bin/test-bus-dispatch ... 9: # dispatch test took 58 seconds 9: ok 26 - dispatch did not leak memory 9: Bail out! file descriptor 9 leaked in /home/xxx/src/dbus/dbus/dbus-message-util.c.
DBUS_TEST_DATA=/home/xxx/src/dbus-cmake-build/test/data bin/test-bus-dispatch-sha1 ... ok 1 - dispatch-sha1 # dispatch-sha1 test took 15 seconds ok 2 - dispatch-sha1 did not leak memory Bail out! file descriptor 9 leaked in /home/ralf/src/dbus/dbus/dbus-message-util.c.
In the test-bus case (and the two other) the leaked file descriptor is:
lr-x------ 1 xxx users 64 22. Jan 21:52 4 -> /var/lib/sss/mcpath/initgroups
As Simon mentioned in !84 (comment 106999) was this file opened
DBUS_TEST_DATA=/home/xxx/src/dbus-cmake-build/test/data strace bin/test-bus 2>&1 | grep /var/lib/sss open("/var/lib/sss/mcpath/initgroups", O_RDONLY|O_CLOEXEC) = 4
but not closed. Fortunally this file descriptor has already set 'close-on-exec', which would make it possible to follow Simons hint:
make sure the fd is marked close-on-exec, and make
_dbus_check_fdleaks_leave()ignore fds that are close-on-exec;
because all other open fd's does not have this flags set.