Hello community,

here is the log from the commit of package dbus-1 for openSUSE:Factory checked 
in at 2018-04-11 13:47:54
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/dbus-1 (Old)
 and      /work/SRC/openSUSE:Factory/.dbus-1.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "dbus-1"

Wed Apr 11 13:47:54 2018 rev:151 rq:594690 version:1.12.6

Changes:
--------
--- /work/SRC/openSUSE:Factory/dbus-1/dbus-1-x11.changes        2018-03-19 
23:32:40.125711259 +0100
+++ /work/SRC/openSUSE:Factory/.dbus-1.new/dbus-1-x11.changes   2018-04-11 
13:47:57.953237560 +0200
@@ -1,0 +2,29 @@
+Fri Mar 23 10:40:43 UTC 2018 - sfl...@suse.de
+
+- Update to 1.12.6
+  * Changelog for 1.12.6
+      • Increase system dbus-daemon's RLIMIT_NOFILE rlimit before it drops
+        privileges, because it won't have permission afterwards. This fixes a
+        regression in dbus 1.10.18 and 1.11.0 which made the standard system 
bus
+        more susceptible to deliberate or accidental denial of service.
+        (fdo#105165, David King)
+  * Changelog for 1.12.4
+      • When iterating the DBusConnection while blocking on a pending call,
+        don't wait for I/O if that pending call already has a result; and make
+        sure that whether it has a result is propagated in a thread-safe way.
+        This prevents certain multi-threaded calling patterns from blocking
+        until their timeout even when they should have succeeded sooner.
+        (fdo#102839; Manish Narang, Michael Searle)
+      • Report the correct error if OOM is reached while trying to listen
+        on a TCP socket (fdo#89104, Simon McVittie)
+      • Fix assertion failures in recovery from OOM while setting up a
+        DBusServer (fdo#89104, Simon McVittie)
+      • Add a missing space to a warning message (fdo#103729, Thomas Zajic)
+      • Expand ${bindir} correctly when pkg-config is asked for dbus_daemondir
+        (fdo#104265, Benedikt Heine)
+      • On Linux systems with systemd < 237, if ${localstatedir}/dbus doesn't
+        exist, create it before trying to create 
${localstatedir}/dbus/machine-id
+        (fdo#104577, Chris Lesiak)
+      • Fix escaping in dbus-api-design document (fdo#104925, Philip Withnall)
+
+-------------------------------------------------------------------
dbus-1.changes: same change

Old:
----
  dbus-1.12.2.tar.gz

New:
----
  dbus-1.12.6.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ dbus-1-x11.spec ++++++
--- /var/tmp/diff_new_pack.cwD3dP/_old  2018-04-11 13:47:59.897167214 +0200
+++ /var/tmp/diff_new_pack.cwD3dP/_new  2018-04-11 13:47:59.901167069 +0200
@@ -23,12 +23,12 @@
 %endif
 %bcond_without selinux
 Name:           dbus-1-x11
-Version:        1.12.2
+Version:        1.12.6
 Release:        0
 Summary:        D-Bus Message Bus System
 License:        GPL-2.0-or-later OR AFL-2.1
 Group:          System/Daemons
-URL:            http://dbus.freedesktop.org/
+Url:            http://dbus.freedesktop.org/
 Source0:        
http://dbus.freedesktop.org/releases/dbus/%{_name}-%{version}.tar.gz
 Source2:        dbus-1.desktop
 Source3:        dbus_at_console.ck

++++++ dbus-1.spec ++++++
--- /var/tmp/diff_new_pack.cwD3dP/_old  2018-04-11 13:47:59.925166201 +0200
+++ /var/tmp/diff_new_pack.cwD3dP/_new  2018-04-11 13:47:59.929166055 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package dbus-1
 #
-# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -26,10 +26,10 @@
 %endif
 %bcond_without selinux
 Name:           dbus-1
-Version:        1.12.2
+Version:        1.12.6
 Release:        0
 Summary:        D-Bus Message Bus System
-License:        GPL-2.0+ or AFL-2.1
+License:        GPL-2.0-or-later OR AFL-2.1
 Group:          System/Daemons
 Url:            http://dbus.freedesktop.org/
 Source0:        
http://dbus.freedesktop.org/releases/dbus/%{_name}-%{version}.tar.gz

++++++ dbus-1.12.2.tar.gz -> dbus-1.12.6.tar.gz ++++++
++++ 3966 lines of diff (skipped)
++++    retrying with extended exclude list
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/dbus-1.12.2/NEWS new/dbus-1.12.6/NEWS
--- old/dbus-1.12.2/NEWS        2017-11-13 14:35:40.000000000 +0100
+++ new/dbus-1.12.6/NEWS        2018-03-01 18:41:37.000000000 +0100
@@ -1,3 +1,47 @@
+dbus 1.12.6 (2018-03-01)
+========================
+
+The “just the one swan, actually” release.
+
+Fixes:
+
+• Increase system dbus-daemon's RLIMIT_NOFILE rlimit before it drops
+  privileges, because it won't have permission afterwards. This fixes a
+  regression in dbus 1.10.18 and 1.11.0 which made the standard system bus
+  more susceptible to deliberate or accidental denial of service.
+  (fd.o #105165, David King)
+
+dbus 1.12.4 (2018-02-08)
+========================
+
+The “Stria Campania 115” release.
+
+Fixes:
+
+• When iterating the DBusConnection while blocking on a pending call,
+  don't wait for I/O if that pending call already has a result; and make
+  sure that whether it has a result is propagated in a thread-safe way.
+  This prevents certain multi-threaded calling patterns from blocking
+  until their timeout even when they should have succeeded sooner.
+  (fd.o #102839; Manish Narang, Michael Searle)
+
+• Report the correct error if OOM is reached while trying to listen
+  on a TCP socket (fd.o #89104, Simon McVittie)
+
+• Fix assertion failures in recovery from OOM while setting up a
+  DBusServer (fd.o #89104, Simon McVittie)
+
+• Add a missing space to a warning message (fd.o #103729, Thomas Zajic)
+
+• Expand ${bindir} correctly when pkg-config is asked for dbus_daemondir
+  (fd.o #104265, Benedikt Heine)
+
+• On Linux systems with systemd < 237, if ${localstatedir}/dbus doesn't
+  exist, create it before trying to create ${localstatedir}/dbus/machine-id
+  (fd.o #104577, Chris Lesiak)
+
+• Fix escaping in dbus-api-design document (fd.o #104925, Philip Withnall)
+
 dbus 1.12.2 (2017-11-13)
 ========================
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/dbus-1.12.2/bus/activation.c new/dbus-1.12.6/bus/activation.c
--- old/dbus-1.12.2/bus/activation.c    2017-10-30 13:26:18.000000000 +0100
+++ new/dbus-1.12.6/bus/activation.c    2017-11-24 14:15:49.000000000 +0100
@@ -438,7 +438,7 @@
       else if (bus_context_get_servicehelper (activation->context) != NULL)
         {
           bus_context_log (activation->context, DBUS_SYSTEM_LOG_WARNING,
-                           "Service file \"%s\" should have been named \"%s\""
+                           "Service file \"%s\" should have been named \"%s\" "
                            "and will not work with system bus activation",
                            _dbus_string_get_const_data (&file_path),
                            _dbus_string_get_const_data (&expected_name));
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/dbus-1.12.2/bus/bus.c new/dbus-1.12.6/bus/bus.c
--- old/dbus-1.12.2/bus/bus.c   2017-11-10 17:22:20.000000000 +0100
+++ new/dbus-1.12.6/bus/bus.c   2018-02-23 11:25:17.000000000 +0100
@@ -715,8 +715,6 @@
   DBusHashTable *service_context_table;
   DBusList *watched_dirs = NULL;
 
-  raise_file_descriptor_limit (context);
-
   service_context_table = bus_config_parser_steal_service_context_table 
(parser);
   if (!bus_registry_set_service_context_table (context->registry,
                                               service_context_table))
@@ -940,6 +938,11 @@
       !_dbus_pipe_is_stdout_or_stderr (print_pid_pipe))
     _dbus_pipe_close (print_pid_pipe, NULL);
 
+  /* Raise the file descriptor limits before dropping the privileges
+   * required to do so.
+   */
+  raise_file_descriptor_limit (context);
+
   /* Here we change our credentials if required,
    * as soon as we've set up our sockets and pidfile.
    * This must be done before initializing LSMs, so that the netlink
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/dbus-1.12.2/bus/tmpfiles.d/dbus.conf.in 
new/dbus-1.12.6/bus/tmpfiles.d/dbus.conf.in
--- old/dbus-1.12.2/bus/tmpfiles.d/dbus.conf.in 2017-10-30 13:26:18.000000000 
+0100
+++ new/dbus-1.12.6/bus/tmpfiles.d/dbus.conf.in 2018-01-29 12:59:51.000000000 
+0100
@@ -1,5 +1,9 @@
 # Fields: type; path; mode; uid; gid; age; argument (symlink target)
 
+# Make ${localstatedir}/lib/dbus (required for systemd < 237)
+# Adjust mode and ownership if it already exists.
+d @EXPANDED_LOCALSTATEDIR@/lib/dbus 0755 - - -
+
 # Make ${localstatedir}/lib/dbus/machine-id a symlink to /etc/machine-id
 # if it does not already exist
 L @EXPANDED_LOCALSTATEDIR@/lib/dbus/machine-id - - - - /etc/machine-id
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/dbus-1.12.2/cmake/ConfigureChecks.cmake 
new/dbus-1.12.6/cmake/ConfigureChecks.cmake
--- old/dbus-1.12.2/cmake/ConfigureChecks.cmake 2017-10-30 13:26:18.000000000 
+0100
+++ new/dbus-1.12.6/cmake/ConfigureChecks.cmake 2018-02-23 11:25:17.000000000 
+0100
@@ -62,6 +62,9 @@
 check_symbol_exists(SCM_RIGHTS    "sys/types.h;sys/socket.h;sys/un.h" 
HAVE_UNIX_FD_PASSING)
 check_symbol_exists(prctl        "sys/prctl.h"              HAVE_PRCTL)
 check_symbol_exists(raise        "signal.h"                 HAVE_RAISE)
+check_symbol_exists(getrlimit    "sys/resource.h;sys/time.h" HAVE_GETRLIMIT)
+check_symbol_exists(prlimit      "sys/resource.h;sys/time.h" HAVE_PRLIMIT)
+check_symbol_exists(setrlimit    "sys/resource.h;sys/time.h" HAVE_SETRLIMIT)
 
 check_struct_member(cmsgcred cmcred_pid "sys/types.h sys/socket.h" 
HAVE_CMSGCRED)   #  dbus-sysdeps.c
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/dbus-1.12.2/cmake/config.h.cmake new/dbus-1.12.6/cmake/config.h.cmake
--- old/dbus-1.12.2/cmake/config.h.cmake        2017-10-30 13:26:18.000000000 
+0100
+++ new/dbus-1.12.6/cmake/config.h.cmake        2018-02-23 11:25:17.000000000 
+0100
@@ -205,6 +205,9 @@
 #cmakedefine HAVE_ACCEPT4 1
 #cmakedefine HAVE_DIRFD 1
 #cmakedefine HAVE_INOTIFY_INIT1 1
+#cmakedefine HAVE_GETRLIMIT 1
+#cmakedefine HAVE_PRLIMIT 1
+#cmakedefine HAVE_SETRLIMIT 1
 #cmakedefine HAVE_UNIX_FD_PASSING 1
 
 // structs
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/dbus-1.12.2/cmake/modules/MacrosAutotools.cmake 
new/dbus-1.12.6/cmake/modules/MacrosAutotools.cmake
--- old/dbus-1.12.2/cmake/modules/MacrosAutotools.cmake 2017-10-30 
13:26:18.000000000 +0100
+++ new/dbus-1.12.6/cmake/modules/MacrosAutotools.cmake 2018-02-08 
15:07:21.000000000 +0100
@@ -108,7 +108,7 @@
     foreach(line ${_configure_ac})
         if(line MATCHES ".*AC_DEFINE(.*${name}.*).*")
             string (REGEX REPLACE ".*AC_DEFINE(.*).*" "\\1" value ${line})
-            string (REGEX REPLACE ".*,(.*),.*" "\\1" value2 ${value})
+            string (REGEX REPLACE "[^[]*\\[[^]]*\\], *\\[([^]]*)\\],.*" "\\1" 
value2 ${value})
             string (REPLACE "[" "" value3 ${value2})
             string (REPLACE "]" "" value4 ${value3})
             set(${name} ${value4})
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/dbus-1.12.2/cmake/test/CMakeLists.txt 
new/dbus-1.12.6/cmake/test/CMakeLists.txt
--- old/dbus-1.12.2/cmake/test/CMakeLists.txt   2017-10-30 13:26:18.000000000 
+0100
+++ new/dbus-1.12.6/cmake/test/CMakeLists.txt   2018-02-08 15:07:21.000000000 
+0100
@@ -107,10 +107,12 @@
     add_test_executable(test-monitor ${CMAKE_SOURCE_DIR}/../test/monitor.c 
${TEST_LIBRARIES})
     add_test_executable(test-refs ${CMAKE_SOURCE_DIR}/../test/internals/refs.c 
${TEST_LIBRARIES})
     add_test_executable(test-relay ${CMAKE_SOURCE_DIR}/../test/relay.c 
${TEST_LIBRARIES})
+    add_test_executable(test-server-oom 
${CMAKE_SOURCE_DIR}/../test/internals/server-oom.c ${TEST_LIBRARIES})
     add_test_executable(test-syntax ${CMAKE_SOURCE_DIR}/../test/syntax.c 
${TEST_LIBRARIES})
     add_test_executable(test-syslog 
${CMAKE_SOURCE_DIR}/../test/internals/syslog.c ${TEST_LIBRARIES})
     add_test_executable(test-uid-permissions 
${CMAKE_SOURCE_DIR}/../test/uid-permissions.c ${TEST_LIBRARIES})
     add_helper_executable(manual-authz 
${CMAKE_SOURCE_DIR}/../test/manual-authz.c ${TEST_LIBRARIES})
+    add_helper_executable(manual-test-thread-blocking 
${CMAKE_SOURCE_DIR}/../test/thread-blocking.c ${TEST_LIBRARIES})
 endif()
 
 ### keep these in creation order, i.e. uppermost dirs first 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/dbus-1.12.2/config.h.in new/dbus-1.12.6/config.h.in
--- old/dbus-1.12.2/config.h.in 2017-11-13 15:07:39.000000000 +0100
+++ new/dbus-1.12.6/config.h.in 2018-03-01 19:06:08.000000000 +0100
@@ -130,7 +130,7 @@
 /* The name of the gettext domain */
 #undef GETTEXT_PACKAGE
 
-/* Prevent post-2.40 APIs */
+/* Prevent post-2.44 APIs */
 #undef GLIB_VERSION_MAX_ALLOWED
 
 /* Ignore post-2.40 deprecations */
@@ -277,6 +277,9 @@
 /* Define to 1 if you have the `prctl' function. */
 #undef HAVE_PRCTL
 
+/* Define to 1 if you have the `prlimit' function. */
+#undef HAVE_PRLIMIT
+
 /* Define to 1 if you have the `raise' function. */
 #undef HAVE_RAISE
 
@@ -343,6 +346,9 @@
 /* Define to 1 if you have the <sys/syslimits.h> header file. */
 #undef HAVE_SYS_SYSLIMITS_H
 
+/* Define to 1 if you have the <sys/time.h> header file. */
+#undef HAVE_SYS_TIME_H
+
 /* Define to 1 if you have the <sys/types.h> header file. */
 #undef HAVE_SYS_TYPES_H
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/dbus-1.12.2/configure.ac new/dbus-1.12.6/configure.ac
--- old/dbus-1.12.2/configure.ac        2017-11-13 14:35:48.000000000 +0100
+++ new/dbus-1.12.6/configure.ac        2018-02-23 11:42:06.000000000 +0100
@@ -3,7 +3,7 @@
 
 m4_define([dbus_major_version], [1])
 m4_define([dbus_minor_version], [12])
-m4_define([dbus_micro_version], [2])
+m4_define([dbus_micro_version], [6])
 m4_define([dbus_version],
           [dbus_major_version.dbus_minor_version.dbus_micro_version])
 
AC_INIT([dbus],[dbus_version],[https://bugs.freedesktop.org/enter_bug.cgi?product=dbus],[dbus])
@@ -42,7 +42,7 @@
 
 ## increment any time the source changes; set to
 ##  0 if you increment CURRENT
-LT_REVISION=4
+LT_REVISION=6
 
 ## increment if any interfaces have been added; set to 0
 ## if any interfaces have been changed or removed. removal has
@@ -258,8 +258,11 @@
 # default (unless you don't have GLib), because they don't bloat the library
 # or binaries.
 
+dnl Don't do anything too subtle here, because the CMake build system
+dnl parses these lines with regular expressions. If necessary, adjust
+dnl cmake/modules/MacrosAutotools.cmake to compensate.
 AC_DEFINE([GLIB_VERSION_MIN_REQUIRED], [GLIB_VERSION_2_40], [Ignore post-2.40 
deprecations])
-AC_DEFINE([GLIB_VERSION_MAX_ALLOWED], [GLIB_VERSION_2_40], [Prevent post-2.40 
APIs])
+AC_DEFINE([GLIB_VERSION_MAX_ALLOWED], [G_ENCODE_VERSION(2,44)], [Prevent 
post-2.44 APIs])
 
 with_glib=yes
 
@@ -612,7 +615,7 @@
 AC_SEARCH_LIBS(socket,[socket network])
 AC_CHECK_FUNC(gethostbyname,,[AC_CHECK_LIB(nsl,gethostbyname)])
 
-AC_CHECK_FUNCS([vsnprintf vasprintf nanosleep usleep setenv clearenv unsetenv 
socketpair getgrouplist fpathconf setrlimit poll setlocale localeconv strtoll 
strtoull issetugid getresuid setresuid getrlimit])
+AC_CHECK_FUNCS([vsnprintf vasprintf nanosleep usleep setenv clearenv unsetenv 
socketpair getgrouplist fpathconf setrlimit poll setlocale localeconv strtoll 
strtoull issetugid getresuid setresuid getrlimit prlimit])
 
 AC_CHECK_HEADERS([syslog.h])
 if test "x$ac_cv_header_syslog_h" = "xyes"; then
@@ -687,6 +690,7 @@
 fi
 
 AC_CHECK_HEADERS(sys/resource.h)
+AC_CHECK_HEADERS([sys/time.h])
 
 AC_CHECK_HEADERS(dirent.h)
 
@@ -1540,7 +1544,7 @@
 #### Directory to install dbus-daemon
 if test -z "$with_dbus_daemondir" ; then
     DBUS_DAEMONDIR=$EXPANDED_BINDIR
-    dbus_daemondir='$bindir'
+    dbus_daemondir='${bindir}'
 else
     DBUS_DAEMONDIR=$with_dbus_daemondir
     dbus_daemondir=$with_dbus_daemondir
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/dbus-1.12.2/dbus/dbus-connection.c new/dbus-1.12.6/dbus/dbus-connection.c
--- old/dbus-1.12.2/dbus/dbus-connection.c      2017-10-30 13:26:18.000000000 
+0100
+++ new/dbus-1.12.6/dbus/dbus-connection.c      2018-02-08 15:07:21.000000000 
+0100
@@ -2325,10 +2325,11 @@
 {
   _dbus_pending_call_set_reply_unlocked (pending, message);
   _dbus_pending_call_ref_unlocked (pending); /* in case there's no app with a 
ref held */
+  _dbus_pending_call_start_completion_unlocked(pending);
   _dbus_connection_detach_pending_call_and_unlock (connection, pending);
- 
+
   /* Must be called unlocked since it invokes app callback */
-  _dbus_pending_call_complete (pending);
+  _dbus_pending_call_finish_completion (pending);
   dbus_pending_call_unref (pending);
 }
 
@@ -2527,7 +2528,7 @@
         {          
           /* block again, we don't have the reply buffered yet. */
           _dbus_connection_do_iteration_unlocked (connection,
-                                                  NULL,
+                                                  pending,
                                                   DBUS_ITERATION_DO_READING |
                                                   DBUS_ITERATION_BLOCK,
                                                   timeout_milliseconds - 
elapsed_milliseconds);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/dbus-1.12.2/dbus/dbus-pending-call-internal.h 
new/dbus-1.12.6/dbus/dbus-pending-call-internal.h
--- old/dbus-1.12.2/dbus/dbus-pending-call-internal.h   2017-10-30 
13:26:18.000000000 +0100
+++ new/dbus-1.12.6/dbus/dbus-pending-call-internal.h   2018-02-08 
15:07:21.000000000 +0100
@@ -41,7 +41,10 @@
 DBusConnection * _dbus_pending_call_get_connection_and_lock      
(DBusPendingCall    *pending);
 DBusConnection * _dbus_pending_call_get_connection_unlocked      
(DBusPendingCall    *pending);
 dbus_bool_t      _dbus_pending_call_get_completed_unlocked       
(DBusPendingCall    *pending);
-void             _dbus_pending_call_complete                     
(DBusPendingCall    *pending);
+
+void             _dbus_pending_call_start_completion_unlocked    
(DBusPendingCall    *pending);
+void             _dbus_pending_call_finish_completion            
(DBusPendingCall    *pending);
+
 void             _dbus_pending_call_set_reply_unlocked           
(DBusPendingCall    *pending,
                                                                   DBusMessage  
      *message);
 void             _dbus_pending_call_queue_timeout_error_unlocked 
(DBusPendingCall    *pending,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/dbus-1.12.2/dbus/dbus-pending-call.c 
new/dbus-1.12.6/dbus/dbus-pending-call.c
--- old/dbus-1.12.2/dbus/dbus-pending-call.c    2017-10-30 13:26:18.000000000 
+0100
+++ new/dbus-1.12.6/dbus/dbus-pending-call.c    2018-02-08 15:07:21.000000000 
+0100
@@ -75,8 +75,16 @@
   
   dbus_uint32_t reply_serial;                     /**< Expected serial of 
reply */
 
-  unsigned int completed : 1;                     /**< TRUE if completed */
-  unsigned int timeout_added : 1;                 /**< Have added the timeout 
*/
+  /**
+   * TRUE if some thread has taken responsibility for completing this
+   * pending call: either the pending call has completed, or it is about
+   * to be completed. Protected by the connection lock.
+   */
+  unsigned int completed : 1;
+  /**
+   * TRUE if we have added the timeout. Protected by the connection lock.
+   */
+  unsigned int timeout_added : 1;
 };
 
 static void
@@ -194,18 +202,36 @@
 }
 
 /**
- * Calls notifier function for the pending call
- * and sets the call to completed.
+ * Sets the pending call to completed
+ *
+ * This method is called with the connection lock held, to protect
+ * pending->completed. It must be paired with a call to
+ * _dbus_pending_call_finish_completion() after the connection lock has
+ * been released.
  *
  * @param pending the pending call
- * 
  */
 void
-_dbus_pending_call_complete (DBusPendingCall *pending)
+_dbus_pending_call_start_completion_unlocked (DBusPendingCall *pending)
 {
   _dbus_assert (!pending->completed);
   
   pending->completed = TRUE;
+}
+
+/**
+ * Call the notifier function for the pending call.
+ *
+ * This method must be called after the connection lock has been
+ * released, and must be paired with a call to
+ * _dbus_pending_call_start_completion_unlocked().
+ *
+ * @param pending the pending call
+ */
+void
+_dbus_pending_call_finish_completion (DBusPendingCall *pending)
+{
+  _dbus_assert (pending->completed);
 
   if (pending->function)
     {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/dbus-1.12.2/dbus/dbus-server-protected.h 
new/dbus-1.12.6/dbus/dbus-server-protected.h
--- old/dbus-1.12.2/dbus/dbus-server-protected.h        2017-10-30 
13:26:18.000000000 +0100
+++ new/dbus-1.12.6/dbus/dbus-server-protected.h        2017-11-24 
14:16:30.000000000 +0100
@@ -96,6 +96,7 @@
                                          const DBusString       *address,
                                          DBusError              *error);
 void        _dbus_server_finalize_base  (DBusServer             *server);
+void        _dbus_server_disconnect_unlocked (DBusServer        *server);
 dbus_bool_t _dbus_server_add_watch      (DBusServer             *server,
                                          DBusWatch              *watch);
 void        _dbus_server_remove_watch   (DBusServer             *server,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/dbus-1.12.2/dbus/dbus-server-socket.c 
new/dbus-1.12.6/dbus/dbus-server-socket.c
--- old/dbus-1.12.2/dbus/dbus-server-socket.c   2017-10-30 13:26:18.000000000 
+0100
+++ new/dbus-1.12.6/dbus/dbus-server-socket.c   2018-01-29 12:54:13.000000000 
+0100
@@ -243,8 +243,11 @@
           socket_server->watch[i] = NULL;
         }
 
-      _dbus_close_socket (socket_server->fds[i], NULL);
-      _dbus_socket_invalidate (&socket_server->fds[i]);
+      if (_dbus_socket_is_valid (socket_server->fds[i]))
+        {
+          _dbus_close_socket (socket_server->fds[i], NULL);
+          _dbus_socket_invalidate (&socket_server->fds[i]);
+        }
     }
 
   if (socket_server->socket_name != NULL)
@@ -338,10 +341,24 @@
                                    socket_server->watch[i]))
         {
           int j;
-          for (j = 0 ; j < i ; j++)
-            _dbus_server_remove_watch (server,
-                                       socket_server->watch[j]);
 
+          /* The caller is still responsible for closing the fds until
+           * we return successfully, so don't let socket_disconnect()
+           * close them */
+          for (j = 0; j < n_fds; j++)
+            _dbus_socket_invalidate (&socket_server->fds[j]);
+
+          /* socket_disconnect() will try to remove all the watches;
+           * make sure it doesn't see the ones that weren't even added
+           * yet */
+          for (j = i; j < n_fds; j++)
+            {
+              _dbus_watch_invalidate (socket_server->watch[j]);
+              _dbus_watch_unref (socket_server->watch[j]);
+              socket_server->watch[j] = NULL;
+            }
+
+          _dbus_server_disconnect_unlocked (server);
           SERVER_UNLOCK (server);
           _dbus_server_finalize_base (&socket_server->base);
           goto failed_2;
@@ -358,6 +375,7 @@
     {
       if (socket_server->watch[i] != NULL)
         {
+          _dbus_watch_invalidate (socket_server->watch[i]);
           _dbus_watch_unref (socket_server->watch[i]);
           socket_server->watch[i] = NULL;
         }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/dbus-1.12.2/dbus/dbus-server.c new/dbus-1.12.6/dbus/dbus-server.c
--- old/dbus-1.12.2/dbus/dbus-server.c  2017-10-30 13:26:18.000000000 +0100
+++ new/dbus-1.12.6/dbus/dbus-server.c  2017-11-24 14:16:30.000000000 +0100
@@ -764,6 +764,20 @@
     }
 }
 
+void
+_dbus_server_disconnect_unlocked (DBusServer *server)
+{
+  _dbus_assert (server->vtable->disconnect != NULL);
+
+  if (!server->disconnected)
+    {
+      /* this has to be first so recursive calls to disconnect don't happen */
+      server->disconnected = TRUE;
+
+      (* server->vtable->disconnect) (server);
+    }
+}
+
 /**
  * Releases the server's address and stops listening for
  * new clients. If called more than once, only the first
@@ -780,15 +794,7 @@
   dbus_server_ref (server);
   SERVER_LOCK (server);
 
-  _dbus_assert (server->vtable->disconnect != NULL);
-
-  if (!server->disconnected)
-    {
-      /* this has to be first so recursive calls to disconnect don't happen */
-      server->disconnected = TRUE;
-      
-      (* server->vtable->disconnect) (server);
-    }
+  _dbus_server_disconnect_unlocked (server);
 
   SERVER_UNLOCK (server);
   dbus_server_unref (server);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/dbus-1.12.2/dbus/dbus-sysdeps-unix.c 
new/dbus-1.12.6/dbus/dbus-sysdeps-unix.c
--- old/dbus-1.12.2/dbus/dbus-sysdeps-unix.c    2017-10-30 13:26:18.000000000 
+0100
+++ new/dbus-1.12.6/dbus/dbus-sysdeps-unix.c    2017-11-24 14:42:27.000000000 
+0100
@@ -1576,11 +1576,9 @@
       newlisten_fd = dbus_realloc(listen_fd, 
sizeof(DBusSocket)*(nlisten_fd+1));
       if (!newlisten_fd)
         {
-          saved_errno = errno;
           _dbus_close (fd, NULL);
-          dbus_set_error (error, _dbus_error_from_errno (saved_errno),
-                          "Failed to allocate file handle array: %s",
-                          _dbus_strerror (saved_errno));
+          dbus_set_error (error, DBUS_ERROR_NO_MEMORY,
+                          "Failed to allocate file handle array");
           goto failed;
         }
       listen_fd = newlisten_fd;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/dbus-1.12.2/doc/dbus-api-design.duck 
new/dbus-1.12.6/doc/dbus-api-design.duck
--- old/dbus-1.12.2/doc/dbus-api-design.duck    2017-10-30 13:26:18.000000000 
+0100
+++ new/dbus-1.12.6/doc/dbus-api-design.duck    2018-02-08 15:13:45.000000000 
+0100
@@ -60,12 +60,12 @@
 specification), and is supported by tools such as $cmd(gdbus-codegen).
 
 Interface files for public API should be installed to
-$code($var($$(datadir$))/dbus-1/interfaces) so that other services can load
+$code($var($$(datadir))/dbus-1/interfaces) so that other services can load
 them. Private APIs should not be installed. There should be one file installed
 per D-Bus interface, named after the interface, containing a single top-level
 $code(<node>) element with a single $code(<interface>) beneath it. For example,
 interface $code(com.example.MyService1.Manager) would be described by file
-$file($var($$(datadir$))/dbus-1/interfaces/com.example.MyService1.Manager.xml):
+$file($var($$(datadir))/dbus-1/interfaces/com.example.MyService1.Manager.xml):
 
 [listing]
   [title]
@@ -189,16 +189,16 @@
 call, rather than requiring as many calls as elements in the data set.
 
 Consider an address book API, $code(com.example.MyService1.AddressBook). It
-might have an $code(AddContact(ss$) → (u$)) method to add a contact (taking 
name
+might have an $code(AddContact(ss) → (u)) method to add a contact (taking name
 and e-mail address parameters and returning a unique contact ID), and a
-$code(RemoveContact(u$)) method to remove one by ID. In the normal case of
+$code(RemoveContact(u)) method to remove one by ID. In the normal case of
 operating on single contacts in the address book, these calls are optimal.
 However, if the user wants to import a list of contacts, or delete multiple
 contacts simultaneously, one call has to be made per contact — this could take
 a long time for large contact lists.
 
 Instead of the $code(AddContact) and $code(RemoveContact) methods, the 
interface
-could have an $code(UpdateContacts(a(ss$)au$) → (au$)) method, which takes an 
array
+could have an $code(UpdateContacts(a(ss)au) → (au)) method, which takes an 
array
 of structs containing the new contacts’ details, and an array of IDs of the
 contacts to delete, and returns an array of IDs for the new contacts. This
 reduces the number of round trips needed to one.
@@ -479,18 +479,18 @@
   For example, consider an object implementing an interface
   $code(com.example.MyService1.SomeInterface) with methods:
   [list]
-  * $code(GetName($) → (s$))
-  * $code(SetName(s$) → ($))
-  * $code(GetStatus($) → (u$))
-  * $code(RunOperation(ss$) → (u$))
+  * $code(GetName() → (s))
+  * $code(SetName(s) → ())
+  * $code(GetStatus() → (u))
+  * $code(RunOperation(ss) → (u))
   and signals:
   [list]
-  * $code(NameChanged(u$))
-  * $code(StatusChanged(u$))
+  * $code(NameChanged(u))
+  * $code(StatusChanged(u))
 
   The interface could be cut down to a single method:
   [list]
-  * $code(RunOperation(ss$) → (u$))
+  * $code(RunOperation(ss) → (u))
   The object could then implement the $code(org.freedesktop.DBus.Properties)
   interface and define properties:
   [list]
@@ -522,11 +522,11 @@
   For example, consider an object implementing an interface
   $code(com.example.MyService1.AddressBookManager) with methods:
   [list]
-  * $code(GetAddressBooks($) → (ao$))
+  * $code(GetAddressBooks() → (ao))
   and signals:
   [list]
-  * $code(AddressBookAdded(o$))
-  * $code(AddressBookRemoved(o$))
+  * $code(AddressBookAdded(o))
+  * $code(AddressBookRemoved(o))
 
   If the manager object is at path
   $code(/com/example/MyService1/AddressBookManager), each address book is a
@@ -802,8 +802,8 @@
 Service files must be named after the service’s well-known name, for example
 file $file(com.example.MyService1.service) for well-known name
 $code(com.example.MyService1). Files must be installed in
-$file($var($$(datadir$))/dbus-1/services) for the session bus and
-$file($var($$(datadir$))/dbus-1/system-services) for the system bus. Note, 
however,
+$file($var($$(datadir))/dbus-1/services) for the session bus and
+$file($var($$(datadir))/dbus-1/system-services) for the system bus. Note, 
however,
 that services on the system bus almost always need a
 $link[>#security-policies](security policy) as well.
 
@@ -826,10 +826,10 @@
 security policy implementation.
 
 D-Bus security policies are written as XML files in
-$file($var($$(datadir$)/dbus-1/system.d)),
-$file($var($$(datadir$)/dbus-1/session.d)),
-$file($var($$(sysconfdir$)/dbus-1/system.d)) and
-$file($var($$(sysconfdir$)/dbus-1/session.d)) and use an allow/deny model, 
where
+$file($var($$(datadir)/dbus-1/system.d)),
+$file($var($$(datadir)/dbus-1/session.d)),
+$file($var($$(sysconfdir)/dbus-1/system.d)) and
+$file($var($$(sysconfdir)/dbus-1/session.d)) and use an allow/deny model, where
 each message (method call, signal emission, etc.) can be allowed or denied
 according to the sum of all policy rules which match it. Each $code(<allow>) or
 $code(<deny>) rule in the policy should have the $code(own),
@@ -840,7 +840,7 @@
 versions which accept constrained parameters, so that they can be exposed with
 less restrictive security policies if needed by less trusted clients. Since
 dbus-daemon 1.10, security policies should be installed to
-$file($var($$(datadir$))) rather than $(file($var($$(sysconfdir$))); the latter
+$file($var($$(datadir))) rather than $(file($var($$(sysconfdir))); the latter
 is intended for system administators.
 
 Secondly, the default D-Bus security policy for the system bus is restrictive
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/dbus-1.12.2/test/Makefile.am new/dbus-1.12.6/test/Makefile.am
--- old/dbus-1.12.2/test/Makefile.am    2017-11-10 17:09:59.000000000 +0100
+++ new/dbus-1.12.6/test/Makefile.am    2018-02-23 11:25:17.000000000 +0100
@@ -115,6 +115,9 @@
 test_refs_SOURCES = internals/refs.c
 test_refs_LDADD = libdbus-testutils.la $(GLIB_LIBS)
 
+test_server_oom_SOURCES = internals/server-oom.c
+test_server_oom_LDADD = libdbus-testutils.la $(GLIB_LIBS)
+
 test_syslog_SOURCES = internals/syslog.c
 test_syslog_LDADD = libdbus-testutils.la $(GLIB_LIBS)
 
@@ -174,6 +177,7 @@
        test-marshal \
        test-refs \
        test-relay \
+       test-server-oom \
        test-syntax \
        test-syslog \
        test-uid-permissions \
@@ -217,6 +221,7 @@
 
 installable_manual_tests += \
        manual-authz \
+       manual-test-thread-blocking \
        $(NULL)
 endif DBUS_WITH_GLIB
 
@@ -362,6 +367,12 @@
     $(GLIB_LIBS) \
     $(NULL)
 
+manual_test_thread_blocking_SOURCES = thread-blocking.c
+manual_test_thread_blocking_LDADD = \
+    libdbus-testutils.la \
+    $(GLIB_LIBS) \
+    $(NULL)
+
 test_uid_permissions_SOURCES = \
     uid-permissions.c \
     $(NULL)
@@ -422,6 +433,7 @@
        data/systemd-activation/com.example.SystemdActivatable3.service.in \
        data/valid-config-files-system/debug-allow-all-fail.conf.in \
        data/valid-config-files-system/debug-allow-all-pass.conf.in \
+       data/valid-config-files/as-another-user.conf.in \
        data/valid-config-files/count-fds.conf.in \
        data/valid-config-files/debug-allow-all-sha1.conf.in \
        data/valid-config-files/debug-allow-all.conf.in \
@@ -565,6 +577,7 @@
                sed \
                        -e 's,[@]DBUS_TEST_DATA[@],@abs_builddir@/data,' \
                        -e 's,[@]DBUS_TEST_EXEC[@],@abs_builddir@,' \
+                       -e 's,[@]DBUS_USER[@],$(DBUS_USER),' \
                        -e 's,[@]EXEEXT[@],$(EXEEXT),' \
                        -e 
's,[@]TEST_LAUNCH_HELPER_BINARY[@],@abs_top_builddir@/bus/dbus-daemon-launch-helper-test$(EXEEXT),'
 \
                        -e 's,[@]TEST_LISTEN[@],$(TEST_LISTEN),' \
@@ -579,6 +592,7 @@
                sed \
                        -e 's,[@]DBUS_TEST_DATA[@],$(testexecdir)/data,' \
                        -e 's,[@]DBUS_TEST_EXEC[@],$(testexecdir),' \
+                       -e 's,[@]DBUS_USER[@],$(DBUS_USER),' \
                        -e 's,[@]EXEEXT[@],$(EXEEXT),' \
                        -e 's,[@]TEST_LAUNCH_HELPER_BINARY[@],/bin/false,' \
                        -e 's,[@]TEST_LISTEN[@],$(TEST_LISTEN),' \
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/dbus-1.12.2/test/data/valid-config-files/as-another-user.conf.in 
new/dbus-1.12.6/test/data/valid-config-files/as-another-user.conf.in
--- old/dbus-1.12.2/test/data/valid-config-files/as-another-user.conf.in        
1970-01-01 01:00:00.000000000 +0100
+++ new/dbus-1.12.6/test/data/valid-config-files/as-another-user.conf.in        
2018-02-23 11:25:17.000000000 +0100
@@ -0,0 +1,28 @@
+<!--
+Configuration similar to the system bus, to be used when testing rlimit
+handling.
+-->
+
+<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-Bus Bus Configuration 
1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd";>
+<busconfig>
+  <type>system</type>
+  <user>@DBUS_USER@</user>
+  <auth>EXTERNAL</auth>
+
+  <!-- This is not the same as the real system bus: we don't want to collide 
-->
+  <listen>@TEST_LISTEN@</listen>
+
+  <policy context="default">
+    <allow user="*"/>
+    <deny own="*"/>
+    <deny send_type="method_call"/>
+    <allow send_type="signal"/>
+    <allow send_requested_reply="true" send_type="method_return"/>
+    <allow send_requested_reply="true" send_type="error"/>
+    <allow receive_type="method_call"/>
+    <allow receive_type="method_return"/>
+    <allow receive_type="error"/>
+    <allow receive_type="signal"/>
+  </policy>
+</busconfig>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/dbus-1.12.2/test/dbus-daemon.c new/dbus-1.12.6/test/dbus-daemon.c
--- old/dbus-1.12.2/test/dbus-daemon.c  2017-10-30 13:26:18.000000000 +0100
+++ new/dbus-1.12.6/test/dbus-daemon.c  2018-02-23 11:25:17.000000000 +0100
@@ -42,6 +42,7 @@
 #include <string.h>
 
 #ifdef DBUS_UNIX
+# include <pwd.h>
 # include <unistd.h>
 # include <sys/types.h>
 
@@ -49,6 +50,14 @@
     /* The CMake build system doesn't know how to check for this yet */
 #   include <gio/gunixfdmessage.h>
 # endif
+
+# ifdef HAVE_SYS_RESOURCE_H
+#   include <sys/resource.h>
+# endif
+
+# ifdef HAVE_SYS_TIME_H
+#   include <sys/time.h>
+# endif
 #endif
 
 /* Platforms where we know that credentials-passing passes both the
@@ -149,6 +158,7 @@
     const char *bug_ref;
     guint min_messages;
     const char *config_file;
+    TestUser user;
     enum { SPECIFY_ADDRESS = 0, RELY_ON_DEFAULT } connect_mode;
 } Config;
 
@@ -159,7 +169,7 @@
   const Config *config = context;
 
   /* Some tests are fairly slow, so make the test timeout per-test */
-  test_timeout_reset ();
+  test_timeout_reset (1);
 
   f->ctx = test_main_context_get ();
   f->ge = NULL;
@@ -178,8 +188,8 @@
     }
 
   f->address = test_get_dbus_daemon (config ? config->config_file : NULL,
-                                     TEST_USER_ME, NULL,
-                                     &f->daemon_pid);
+                                     config ? config->user : TEST_USER_ME,
+                                     NULL, &f->daemon_pid);
 
   if (f->address == NULL)
     {
@@ -2017,6 +2027,71 @@
   dbus_clear_pending_call (&pc);
 }
 
+#define DESIRED_RLIMIT 65536
+
+#ifdef DBUS_UNIX
+static void
+test_fd_limit (Fixture *f,
+               gconstpointer context)
+{
+#ifdef HAVE_PRLIMIT
+  struct rlimit lim;
+  const struct passwd *pwd = NULL;
+#endif
+
+  if (f->skip)
+    return;
+
+#ifdef HAVE_PRLIMIT
+
+  if (getuid () != 0)
+    {
+      g_test_skip ("Cannot test, only uid 0 is expected to raise fd limit");
+      return;
+    }
+
+  pwd = getpwnam (DBUS_USER);
+
+  if (pwd == NULL)
+    {
+      gchar *message = g_strdup_printf ("user '%s' does not exist",
+          DBUS_USER);
+
+      g_test_skip (message);
+      g_free (message);
+      return;
+    }
+
+  if (prlimit (getpid (), RLIMIT_NOFILE, NULL, &lim) < 0)
+    g_error ("prlimit(): %s", g_strerror (errno));
+
+  g_test_message ("our RLIMIT_NOFILE: rlim_cur: %ld, rlim_max: %ld",
+                  (long) lim.rlim_cur, (long) lim.rlim_max);
+
+  if (lim.rlim_cur == RLIM_INFINITY || lim.rlim_cur >= DESIRED_RLIMIT)
+    {
+      /* The dbus-daemon will have inherited our large rlimit */
+      g_test_skip ("Cannot test, our own fd limit was already large");
+      return;
+    }
+
+  if (prlimit (f->daemon_pid, RLIMIT_NOFILE, NULL, &lim) < 0)
+    g_error ("prlimit(): %s", g_strerror (errno));
+
+  g_test_message ("dbus-daemon's RLIMIT_NOFILE: rlim_cur: %ld, rlim_max: %ld",
+                  (long) lim.rlim_cur, (long) lim.rlim_max);
+
+  if (lim.rlim_cur != RLIM_INFINITY)
+    g_assert_cmpint (lim.rlim_cur, >=, DESIRED_RLIMIT);
+
+#else /* !HAVE_PRLIMIT */
+
+  g_test_skip ("prlimit() not supported on this platform");
+
+#endif /* !HAVE_PRLIMIT */
+}
+#endif
+
 static void
 teardown (Fixture *f,
     gconstpointer context G_GNUC_UNUSED)
@@ -2084,55 +2159,64 @@
 
 static Config limited_config = {
     "34393", 10000, "valid-config-files/incoming-limit.conf",
-    SPECIFY_ADDRESS
+    TEST_USER_ME, SPECIFY_ADDRESS
 };
 
 static Config finite_timeout_config = {
     NULL, 1, "valid-config-files/finite-timeout.conf",
-    SPECIFY_ADDRESS
+    TEST_USER_ME, SPECIFY_ADDRESS
 };
 
 #ifdef DBUS_UNIX
 static Config listen_unix_runtime_config = {
     "61303", 1, "valid-config-files/listen-unix-runtime.conf",
-    RELY_ON_DEFAULT
+    TEST_USER_ME, RELY_ON_DEFAULT
 };
 #endif
 
 static Config max_completed_connections_config = {
     NULL, 1, "valid-config-files/max-completed-connections.conf",
-    SPECIFY_ADDRESS
+    TEST_USER_ME, SPECIFY_ADDRESS
 };
 
 static Config max_connections_per_user_config = {
     NULL, 1, "valid-config-files/max-connections-per-user.conf",
-    SPECIFY_ADDRESS
+    TEST_USER_ME, SPECIFY_ADDRESS
 };
 
 static Config max_replies_per_connection_config = {
     NULL, 1, "valid-config-files/max-replies-per-connection.conf",
-    SPECIFY_ADDRESS
+    TEST_USER_ME, SPECIFY_ADDRESS
 };
 
 static Config max_match_rules_per_connection_config = {
     NULL, 1, "valid-config-files/max-match-rules-per-connection.conf",
-    SPECIFY_ADDRESS
+    TEST_USER_ME, SPECIFY_ADDRESS
 };
 
 static Config max_names_per_connection_config = {
     NULL, 1, "valid-config-files/max-names-per-connection.conf",
-    SPECIFY_ADDRESS
+    TEST_USER_ME, SPECIFY_ADDRESS
 };
 
 #if defined(DBUS_UNIX) && defined(HAVE_UNIX_FD_PASSING) && 
defined(HAVE_GIO_UNIX)
 static Config pending_fd_timeout_config = {
     NULL, 1, "valid-config-files/pending-fd-timeout.conf",
-    SPECIFY_ADDRESS
+    TEST_USER_ME, SPECIFY_ADDRESS
 };
 
 static Config count_fds_config = {
     NULL, 1, "valid-config-files/count-fds.conf",
-    SPECIFY_ADDRESS
+    TEST_USER_ME, SPECIFY_ADDRESS
+};
+#endif
+
+#if defined(DBUS_UNIX)
+static Config as_another_user_config = {
+    NULL, 1, "valid-config-files/as-another-user.conf",
+    /* We start the dbus-daemon as root and drop privileges, like the
+     * real system bus does */
+    TEST_USER_ROOT, SPECIFY_ADDRESS
 };
 #endif
 
@@ -2210,6 +2294,11 @@
    * and that blocks on a round-trip to the dbus-daemon */
   g_test_add ("/unix-runtime-is-default", Fixture, &listen_unix_runtime_config,
       setup, test_echo, teardown);
+
+  g_test_add ("/fd-limit/session", Fixture, NULL,
+              setup, test_fd_limit, teardown);
+  g_test_add ("/fd-limit/system", Fixture, &as_another_user_config,
+              setup, test_fd_limit, teardown);
 #endif
 
   return g_test_run ();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/dbus-1.12.2/test/internals/refs.c new/dbus-1.12.6/test/internals/refs.c
--- old/dbus-1.12.2/test/internals/refs.c       2017-10-30 13:26:18.000000000 
+0100
+++ new/dbus-1.12.6/test/internals/refs.c       2018-02-08 15:07:21.000000000 
+0100
@@ -202,7 +202,7 @@
     g_error ("OOM");
 
   /* This can be fairly slow, so make the test timeout per-test */
-  test_timeout_reset ();
+  test_timeout_reset (1);
 
   f->n_threads = N_THREADS;
   f->n_refs = N_REFS;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/dbus-1.12.2/test/internals/server-oom.c 
new/dbus-1.12.6/test/internals/server-oom.c
--- old/dbus-1.12.2/test/internals/server-oom.c 1970-01-01 01:00:00.000000000 
+0100
+++ new/dbus-1.12.6/test/internals/server-oom.c 2017-11-24 14:48:05.000000000 
+0100
@@ -0,0 +1,148 @@
+/* Targeted unit tests for OOM paths in DBusServer
+ *
+ * Copyright © 2017 Collabora Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include <config.h>
+
+#include <string.h>
+
+#include <glib.h>
+
+#include <dbus/dbus.h>
+#include "dbus/dbus-internals.h"
+#include "dbus/dbus-pipe.h"
+#include "dbus/dbus-server-socket.h"
+#include "test-utils-glib.h"
+
+/* Return TRUE if the right thing happens, but the right thing might include
+ * OOM. */
+static dbus_bool_t
+test_new_tcp (void *user_data)
+{
+  DBusError error = DBUS_ERROR_INIT;
+  DBusServer *server = NULL;
+  dbus_bool_t use_nonce = FALSE;
+  const char *bind = "localhost";
+  const char *family = NULL;
+  dbus_bool_t result = FALSE;
+
+  if (user_data != NULL)
+    {
+      if (strcmp (user_data, "nonce") == 0)
+        use_nonce = TRUE;
+
+      if (strcmp (user_data, "star") == 0)
+        bind = "*";
+
+      if (strcmp (user_data, "v4") == 0)
+        family = "ipv4";
+    }
+
+  server = _dbus_server_new_for_tcp_socket ("localhost", bind,
+                                            "0", family, &error,
+                                            use_nonce);
+
+  if (server == NULL)
+    goto out;
+
+  result = TRUE;
+
+out:
+  if (result)
+    {
+      test_assert_no_error (&error);
+    }
+  else
+    {
+      g_assert_cmpstr (error.name, ==, DBUS_ERROR_NO_MEMORY);
+      result = TRUE;
+    }
+
+  if (server != NULL)
+    dbus_server_disconnect (server);
+
+  dbus_clear_server (&server);
+  dbus_error_free (&error);
+
+  return result;
+}
+
+typedef struct
+{
+  const gchar *name;
+  DBusTestMemoryFunction function;
+  const void *data;
+} OOMTestCase;
+
+static void
+test_oom_wrapper (gconstpointer data)
+{
+  const OOMTestCase *test = data;
+
+  if (!_dbus_test_oom_handling (test->name, test->function,
+                                (void *) test->data))
+    {
+      g_test_message ("OOM test failed");
+      g_test_fail ();
+    }
+}
+
+static GQueue *test_cases_to_free = NULL;
+
+static void
+add_oom_test (const gchar *name,
+              DBusTestMemoryFunction function,
+              const void *data)
+{
+  /* By using GLib memory allocation here, we avoid being affected by
+   * dbus_shutdown() or contributing to
+   * _dbus_get_malloc_blocks_outstanding() */
+  OOMTestCase *test_case = g_new0 (OOMTestCase, 1);
+
+  test_case->name = name;
+  test_case->function = function;
+  test_case->data = data;
+  g_test_add_data_func (name, test_case, test_oom_wrapper);
+  g_queue_push_tail (test_cases_to_free, test_case);
+}
+
+int
+main (int argc,
+      char **argv)
+{
+  int ret;
+
+  test_init (&argc, &argv);
+
+  test_cases_to_free = g_queue_new ();
+  add_oom_test ("/server/new-tcp", test_new_tcp, NULL);
+  add_oom_test ("/server/new-nonce-tcp", test_new_tcp, "nonce");
+  add_oom_test ("/server/new-tcp-star", test_new_tcp, "star");
+  add_oom_test ("/server/new-tcp-v4", test_new_tcp, "v4");
+
+  ret = g_test_run ();
+
+  g_queue_free_full (test_cases_to_free, g_free);
+  return ret;
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/dbus-1.12.2/test/relay.c new/dbus-1.12.6/test/relay.c
--- old/dbus-1.12.2/test/relay.c        2017-10-30 13:26:18.000000000 +0100
+++ new/dbus-1.12.6/test/relay.c        2018-02-08 15:07:21.000000000 +0100
@@ -122,7 +122,7 @@
 setup (Fixture *f,
     gconstpointer data G_GNUC_UNUSED)
 {
-  test_timeout_reset ();
+  test_timeout_reset (1);
 
   f->ctx = test_main_context_get ();
   dbus_error_init (&f->e);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/dbus-1.12.2/test/test-utils-glib.c new/dbus-1.12.6/test/test-utils-glib.c
--- old/dbus-1.12.2/test/test-utils-glib.c      2017-10-30 13:26:18.000000000 
+0100
+++ new/dbus-1.12.6/test/test-utils-glib.c      2018-02-08 15:07:21.000000000 
+0100
@@ -332,7 +332,9 @@
   g_assert (ok);
   g_assert (dbus_bus_get_unique_name (conn) != NULL);
 
-  test_connection_setup (ctx, conn);
+  if (ctx != NULL)
+    test_connection_setup (ctx, conn);
+
   return conn;
 }
 
@@ -486,7 +488,7 @@
 #endif
 
 static void
-set_timeout (void)
+set_timeout (guint factor)
 {
   static guint timeout = 0;
 
@@ -498,11 +500,11 @@
   if (timeout != 0)
     g_source_remove (timeout);
 
-  timeout = g_timeout_add_seconds (TIMEOUT, time_out, NULL);
+  timeout = g_timeout_add_seconds (TIMEOUT * factor, time_out, NULL);
 #ifdef G_OS_UNIX
   /* The GLib main loop might not be running (we don't use it in every
    * test). Die with SIGALRM shortly after if necessary. */
-  alarm (TIMEOUT + 10);
+  alarm ((TIMEOUT * factor) + 10);
 
   /* Get a log message and a core dump from the SIGALRM. */
     {
@@ -520,7 +522,7 @@
 {
   g_test_init (argcp, argvp, NULL);
   g_test_bug_base ("https://bugs.freedesktop.org/show_bug.cgi?id=";);
-  set_timeout ();
+  set_timeout (1);
 }
 
 static void
@@ -534,12 +536,13 @@
 }
 
 void
-test_timeout_reset (void)
+test_timeout_reset (guint factor)
 {
   GTimer *timer = g_timer_new ();
 
-  g_test_message ("Resetting test timeout (reference: %p)", timer);
-  set_timeout ();
+  g_test_message ("Resetting test timeout (reference: %p; factor: %u)",
+      timer, factor);
+  set_timeout (factor);
 
   g_test_queue_destroy (report_and_destroy, timer);
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/dbus-1.12.2/test/test-utils-glib.h new/dbus-1.12.6/test/test-utils-glib.h
--- old/dbus-1.12.2/test/test-utils-glib.h      2017-10-30 13:26:18.000000000 
+0100
+++ new/dbus-1.12.6/test/test-utils-glib.h      2018-02-08 15:07:21.000000000 
+0100
@@ -89,6 +89,21 @@
 void test_rmdir_if_exists (const gchar *path);
 void test_mkdir (const gchar *path, gint mode);
 
-void test_timeout_reset (void);
+void test_timeout_reset (guint factor);
+
+#if !GLIB_CHECK_VERSION(2, 44, 0)
+#define g_steal_pointer(x) backported_g_steal_pointer (x)
+/* A simplified version of g_steal_pointer without type-safety. */
+static inline gpointer
+backported_g_steal_pointer (gpointer pointer_to_pointer)
+{
+  gpointer *pp = pointer_to_pointer;
+  gpointer ret;
+
+  ret = *pp;
+  *pp = NULL;
+  return ret;
+}
+#endif
 
 #endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/dbus-1.12.2/test/thread-blocking.c new/dbus-1.12.6/test/thread-blocking.c
--- old/dbus-1.12.2/test/thread-blocking.c      1970-01-01 01:00:00.000000000 
+0100
+++ new/dbus-1.12.6/test/thread-blocking.c      2018-02-08 15:07:21.000000000 
+0100
@@ -0,0 +1,299 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+/*
+ * Regression test for fd.o #102839: blocking on pending calls in threads
+ *
+ * Copyright © 2018 KPIT Technologies Ltd.
+ * Copyright © 2018 Manish Narang <manrock...@gmail.com>
+ * Copyright © 2018 Collabora Ltd.
+ *
+ * Licensed under the Academic Free License version 2.1
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <config.h>
+
+#include <dbus/dbus.h>
+
+#include <glib.h>
+#include <gio/gio.h>
+
+#include "test-utils-glib.h"
+
+typedef struct
+{
+  DBusError e;
+  GError *ge;
+  GPid daemon_pid;
+  gchar *address;
+
+  DBusConnection *service_conn;
+  GThread *service_thread;
+  const gchar *service_name;
+
+  GThread *client_dispatcher_thread;
+  GThread **client_caller_threads;
+  DBusConnection *client_conn;
+  GMutex callers_remaining_mutex;
+  GCond callers_remaining_cond;
+  gsize callers_remaining;
+
+  gsize n_caller_threads;
+  gsize calls_per_thread;
+} Fixture;
+
+static DBusHandlerResult
+echo_filter (DBusConnection *connection,
+             DBusMessage *message,
+             void *user_data)
+{
+  DBusMessage *reply;
+
+  if (dbus_message_get_type (message) != DBUS_MESSAGE_TYPE_METHOD_CALL)
+    return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+  reply = dbus_message_new_method_return (message);
+
+  if (reply == NULL ||
+      !dbus_connection_send (connection, reply, NULL))
+    g_error ("OOM");
+
+  dbus_clear_message (&reply);
+
+  return DBUS_HANDLER_RESULT_HANDLED;
+}
+
+/*
+ * Thread function to dispatch the service connection. This function runs
+ * in its own thread, dispatching the service connection and replying to
+ * method calls from the callers, until the service connection is
+ * disconnected by the main thread.
+ */
+static gpointer
+service_thread_cb (gpointer user_data)
+{
+  Fixture *f = user_data;
+
+  /* In principle we should be able to wait indefinitely (-1) but that
+   * seems to prevent closing the connection from the main thread from
+   * having its desired effect */
+  while (dbus_connection_read_write_dispatch (f->service_conn, 1000))
+    {
+      /* Disconnected message not received; keep processing */
+    }
+
+  return NULL;
+}
+
+/*
+ * Much like service_thread_cb, but for the client connection. In a real
+ * program this would often be the main thread, running an event loop
+ * like the one provided by GLib.
+ */
+static gpointer
+client_dispatcher_thread_cb (gpointer user_data)
+{
+  Fixture *f = user_data;
+
+  /* This thread needs to yield occasionally, otherwise the caller
+   * threads won't ever get a chance to send their messages.
+   * This is not a recommended I/O pattern, but in principle it was
+   * always meant to work... */
+  while (dbus_connection_read_write_dispatch (f->client_conn, 10))
+    {
+      /* Disconnected message not received; keep processing */
+    }
+
+  return NULL;
+}
+
+/*
+ * Worker thread representing some background task. Some programs
+ * dispatch a DBusConnection in one thread (in this test that's the
+ * "client dispatcher thread"), and expect to be able to block on
+ * pending calls in other threads. This represents one of those other
+ * threads.
+ */
+static gpointer
+client_caller_thread_cb (gpointer user_data)
+{
+  Fixture *f = user_data;
+  gsize i;
+
+  for (i = 0; i < f->calls_per_thread; i++)
+    {
+      DBusMessage *call, *reply;
+      DBusError error = DBUS_ERROR_INIT;
+      gint64 time_before, time_after;
+
+      /* This deliberately isn't g_test_message() to avoid buffering
+       * issues: stderr is line-buffered */
+      if (i % 100 == 0)
+        g_printerr ("# thread %p: %" G_GSIZE_FORMAT "/%" G_GSIZE_FORMAT "\n",
+                        g_thread_self (), i, f->calls_per_thread);
+
+      call = dbus_message_new_method_call (f->service_name, "/",
+                                           "com.example.Echo", "Echo");
+      g_assert_nonnull (call);
+
+      time_before = g_get_monotonic_time ();
+      reply = dbus_connection_send_with_reply_and_block (f->client_conn, call,
+                                                         30000, &error);
+      time_after = g_get_monotonic_time ();
+      test_assert_no_error (&error);
+      g_assert_nonnull (reply);
+      /* We don't expect it to have taken long - a few seconds max, even
+       * with all the other threads contending with us. If we were
+       * anywhere near the 30 second timeout then that's a failure. */
+      g_assert_cmpint (time_after - time_before, <=, 10 * G_USEC_PER_SEC);
+      dbus_clear_message (&reply);
+      dbus_clear_message (&call);
+    }
+
+  g_printerr ("# thread %p: finishing\n", g_thread_self ());
+  g_mutex_lock (&f->callers_remaining_mutex);
+  f->callers_remaining--;
+  g_cond_signal (&f->callers_remaining_cond);
+  g_mutex_unlock (&f->callers_remaining_mutex);
+
+  return NULL;
+}
+
+static void
+setup (Fixture *f,
+       gconstpointer context)
+{
+  f->ge = NULL;
+  dbus_error_init (&f->e);
+
+  f->address = test_get_dbus_daemon (NULL, TEST_USER_ME, NULL, &f->daemon_pid);
+  g_assert_nonnull (f->address);
+
+  f->service_conn = test_connect_to_bus (NULL, f->address);
+  f->service_name = dbus_bus_get_unique_name (f->service_conn);
+  f->client_conn = test_connect_to_bus (NULL, f->address);
+
+  if (!dbus_connection_add_filter (f->service_conn, echo_filter, f, NULL))
+    g_error ("OOM");
+
+  f->service_thread = g_thread_new ("service", service_thread_cb, f);
+  f->client_dispatcher_thread = g_thread_new ("client dispatcher",
+                                              client_dispatcher_thread_cb, f);
+}
+
+/*
+ * Assert that in the following situation:
+ *
+ * - one thread dispatches the server connection (in real life this would
+ *   normally be a separate process, of course)
+ * - one thread dispatches the client connection
+ * - many threads make blocking method calls on the same client connection
+ *
+ * the caller threads are regularly dispatched, and never get blocked
+ * until their method call timeout.
+ */
+static void
+test_threads (Fixture *f,
+              gconstpointer context)
+{
+  gsize i;
+
+  g_test_bug ("102839");
+
+  if (g_test_slow ())
+    {
+      test_timeout_reset (10);
+      f->n_caller_threads = 20;
+      f->calls_per_thread = 10000;
+    }
+  else
+    {
+      test_timeout_reset (1);
+      f->n_caller_threads = 4;
+      f->calls_per_thread = 1000;
+    }
+
+  f->client_caller_threads = g_new0 (GThread *, f->n_caller_threads);
+  f->callers_remaining = f->n_caller_threads;
+
+  /* Start the caller threads off */
+
+  for (i = 0; i < f->n_caller_threads; i++)
+    {
+      gchar *name = g_strdup_printf ("client %" G_GSIZE_FORMAT, i);
+
+      f->client_caller_threads[i] = g_thread_new (name,
+                                                  client_caller_thread_cb,
+                                                  f);
+    }
+
+  /* Wait for all caller threads to exit */
+
+  g_mutex_lock (&f->callers_remaining_mutex);
+
+  while (f->callers_remaining > 0)
+    g_cond_wait (&f->callers_remaining_cond, &f->callers_remaining_mutex);
+
+  g_mutex_unlock (&f->callers_remaining_mutex);
+
+  for (i = 0; i < f->n_caller_threads; i++)
+    g_thread_join (g_steal_pointer (&f->client_caller_threads[i]));
+
+  /* If we haven't crashed out yet, then we're good! */
+}
+
+static void
+teardown (Fixture *f,
+          gconstpointer context G_GNUC_UNUSED)
+{
+  dbus_error_free (&f->e);
+  g_clear_error (&f->ge);
+
+  if (f->client_conn != NULL)
+    dbus_connection_close (f->client_conn);
+
+  if (f->service_conn != NULL)
+    {
+      dbus_connection_remove_filter (f->service_conn, echo_filter, f);
+      dbus_connection_close (f->service_conn);
+    }
+
+  /* Now that the connections have been closed, the threads will exit */
+  if (f->service_thread != NULL)
+    g_thread_join (g_steal_pointer (&f->service_thread));
+
+  if (f->client_dispatcher_thread != NULL)
+    g_thread_join (g_steal_pointer (&f->client_dispatcher_thread));
+
+  dbus_clear_connection (&f->service_conn);
+  dbus_clear_connection (&f->client_conn);
+
+  if (f->daemon_pid != 0)
+    {
+      test_kill_pid (f->daemon_pid);
+      g_spawn_close_pid (f->daemon_pid);
+      f->daemon_pid = 0;
+    }
+
+  g_free (f->address);
+}
+
+int
+main (int argc,
+    char **argv)
+{
+  test_init (&argc, &argv);
+
+  g_test_add ("/thread-blocking", Fixture, NULL, setup, test_threads,
+              teardown);
+
+  return g_test_run ();
+}


Reply via email to