diff options
author | Simon McVittie <smcv@debian.org> | 2011-09-21 15:31:36 +0100 |
---|---|---|
committer | Simon McVittie <smcv@debian.org> | 2011-09-21 15:31:36 +0100 |
commit | 5c56c903340521d9ad6fec85786b3666b8e30b37 (patch) | |
tree | 3fd32e0cfa736c4e8ca1ef225b91235c02c24779 | |
parent | 201e26f277511adf0fbb67aa39d335f281c6085f (diff) | |
download | dbus-5c56c903340521d9ad6fec85786b3666b8e30b37.tar.gz |
Imported Upstream version 1.4.16upstream/1.4.16
45 files changed, 2130 insertions, 311 deletions
@@ -4,16 +4,13 @@ Anders Carlsson <andersca@codefactory.se> Andre Heinecke <aheinecke@intevation.de> Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Aurelien Jarno <aurel32@debian.org> -Benjamin Reed <ranger@befunk.com> Benjamin Reed <rangerrick@befunk.com> -Benjamin Reed <ranger@Sin.local> +Brian Cameron <brian.cameron@oracle.com> Brian Cameron <brian.cameron@sun.com> +Chris Mayo <aklhfex gmail com> Christian Dywan <christian.dywan@lanedo.com> -Christian Dywan <christian@lanedo.com> Christian Ehrlicher <Ch.Ehrlicher@gmx.de> Christian Persch (GNOME) <chpe@gnome.org> -Colin Walters <walters@lightbox.localdomain> -Colin Walters <walters@space-ghost.verbum.private> Colin Walters <walters@verbum.org> Colin Watson <cjwatson@ubuntu.com> Cristian RodrÃguez <cristian.rodriguez@opensuse.org> @@ -32,7 +29,6 @@ Grzegorz DÄ…browski <gdx@poczta.fm> Harald Fernengel <harry@kdevelop.org> Harri Porten <porten@kde.org> Hasso Tepper <hasso@estpak.ee> -Havoc Pennington <hp@localhost.localdomain> Havoc Pennington <hp@pobox.com> Havoc Pennington <hp@redhat.com> Hendrik Buschmeier <hbuschme@TechFak.Uni-Bielefeld.DE> @@ -41,6 +37,7 @@ James Westby <jw+debian@jameswestby.net> James Willcox <jwillcox@gnome.org> Jens Granseuer <jensgr@gmx.net> Jérémie Dimino <jeremie@dimino.org> +Jiřà KlimeÅ¡ <jklimes@redhat.com> Joe Marcus Clarke <marcus@freedesktop.org> Joe Shaw <joeshaw@novell.com> Johan Gyllenspetz <johangy@axis.com> @@ -87,8 +84,6 @@ Peter McCurdy <pmccurdy@skeptopotamus> Philip Blundell <philb@gnu.org> Plácido Revilla <unknown@unknown.domain> Ralf Habacker <ralf.habacker@freenet.de> -Ralf Habacker <Ralf.Habacker@freenet.de> -Ralf Habacker <ralf@s15291359.onlinehome-server.info> Ray Strode <rstrode@redhat.com> Richard A. Hankins <richard.a.hankins@gmail.com> Richard Hughes <richard@hughsie.com> @@ -99,6 +94,7 @@ Roberto Guido <bob4job@gmail.com> Romain Pokrzywka <romain@kdab.com> Ross Burton <ross@openedhand.com> Ryan Lortie <desrt@desrt.ca> +Sascha Silbe <sascha-pgp@silbe.org> Sascha Silbe <sascha-web-bugs.freedesktop.org@silbe.org> Scott James Remnant <scott@netsplit.com> Scott James Remnant <scott@ubuntu.com> @@ -107,6 +103,7 @@ Seth Nickell <seth@gnome.org> Simon McVittie <simon.mcvittie@collabora.co.uk> Sjoerd Simons <sjoerd@luon.net> Sledz <sledz@MOBIL-400-586.intern.dresearch.de> +Steve Grubb <sgrubb@redhat.com> Sven Herzberg <sven@imendio.com> Thiago Macieira <thiago@kde.org> Tim Dijkstra <tim@famdijkstra.org> @@ -115,8 +112,6 @@ Tomas Hoger <thoger@redhat.com> Tomas Pelka <tpelka@redhat.com> Tom Hughes <tom.hughes@palm.com> Tor Lillqvist <tml@iki.fi> -unknown <Administrator@.(none)> -unknown <Habacker@.(none)> Waldo Bastian <bastian@kde.org> William Lachance <wrlach@gmail.com> Will Thompson <will.thompson@collabora.co.uk> diff --git a/Makefile.in b/Makefile.in index f0b01671..ee8d1c6b 100644 --- a/Makefile.in +++ b/Makefile.in @@ -315,6 +315,11 @@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ +PYTHON = @PYTHON@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ RC = @RC@ R_DYNAMIC_LDFLAG = @R_DYNAMIC_LDFLAG@ @@ -386,9 +391,13 @@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -1,3 +1,52 @@ +D-Bus 1.4.16 (2011-09-21) +== + +The "this answerphone fails to answer the phone" release. + +• If full test coverage is requested via --enable-tests, strictly require + Python, pygobject and dbus-python, which are required by some tests; if not, + and Python is missing, skip those tests rather than failing + (fd.o #37847, Simon McVittie) + +• When using cmake, provide the same version-info API in the installed headers + as for autotools (DBUS_VERSION, etc.) (fd.o #40905, Ralf Habacker) + +• Add a regression test for fd.o #38005 (fd.o #39836, Simon McVittie) + +• Make "NOCONFIGURE=1 ./autogen.sh" not run configure (Colin Walters) + +• Add _DBUS_STATIC_ASSERT and use it to check invariants (fd.o #39636, + Simon McVittie) + +• Fix duplicates in authors list (Ralf Habacker) + +• Fix broken links from dbus-tutorial.html if $(htmldir) != $(docdir) + (fd.o #39879, Chris Mayo) + +• Fix a small memory leak, and a failure to report errors, when updating + a service file entry for activation (fd.o #39230, Simon McVittie) + +• Unix-specific: + · Clean up (non-abstract) Unix sockets on bus daemon exit (fd.o #38656; + Brian Cameron, Simon McVittie) + · On systems that use libcap-ng but not systemd, drop supplemental groups + when switching to the daemon user (Red Hat #726953, Steve Grubb) + · Make the cmake build work again on GNU platforms (fd.o #29228, + Simon McVittie) + · Fix compilation on non-C99 systems that have inttypes.h but not stdint.h, + like Solaris (fd.o #40313, Dagobert Michelsen) + · Define CMSG_ALIGN, CMSG_LEN, CMSG_SPACE on Solaris < 10 + (fd.o #40235, Simon McVittie) + · Cope with Unixes that don't have LOG_PERROR, like Solaris 10 + (fd.o #39987, Simon McVittie) + · Cope with platforms whose vsnprintf violates both POSIX and C99, like + Tru64, IRIX and HP-UX (fd.o #11668, Simon McVittie) + +• Windows-specific: + · Fix compilation on MSVC, which doesn't understand "inline" with its + C99 meaning (fd.o #40000; Ralf Habacker, Simon McVittie) + · Fix misuse of GPid in test/dbus-daemon.c (fd.o #40003, Simon McVittie) + D-Bus 1.4.14 (2011-07-29) == diff --git a/README.cygwin b/README.cygwin index 93e403ad..904cbb44 100755 --- a/README.cygwin +++ b/README.cygwin @@ -1,9 +1,6 @@ The cygwin dbus port is included in master branch of dbus git repository since 1.3.1. -See cygwin/README for more information about -the cygwin dbus port. - The cygwin port of dbus is maintained by: http://sourceware.org/cygwinports/ @@ -816,6 +816,211 @@ AC_DEFUN([_AM_SET_OPTIONS], AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PATH_PYTHON([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# --------------------------------------------------------------------------- +# Adds support for distributing Python modules and packages. To +# install modules, copy them to $(pythondir), using the python_PYTHON +# automake variable. To install a package with the same name as the +# automake package, install to $(pkgpythondir), or use the +# pkgpython_PYTHON automake variable. +# +# The variables $(pyexecdir) and $(pkgpyexecdir) are provided as +# locations to install python extension modules (shared libraries). +# Another macro is required to find the appropriate flags to compile +# extension modules. +# +# If your package is configured with a different prefix to python, +# users will have to add the install directory to the PYTHONPATH +# environment variable, or create a .pth file (see the python +# documentation for details). +# +# If the MINIMUM-VERSION argument is passed, AM_PATH_PYTHON will +# cause an error if the version of python installed on the system +# doesn't meet the requirement. MINIMUM-VERSION should consist of +# numbers and dots only. +AC_DEFUN([AM_PATH_PYTHON], + [ + dnl Find a Python interpreter. Python versions prior to 2.0 are not + dnl supported. (2.0 was released on October 16, 2000). + m4_define_default([_AM_PYTHON_INTERPRETER_LIST], + [python python2 python3 python3.0 python2.5 python2.4 python2.3 python2.2 dnl +python2.1 python2.0]) + + m4_if([$1],[],[ + dnl No version check is needed. + # Find any Python interpreter. + if test -z "$PYTHON"; then + AC_PATH_PROGS([PYTHON], _AM_PYTHON_INTERPRETER_LIST, :) + fi + am_display_PYTHON=python + ], [ + dnl A version check is needed. + if test -n "$PYTHON"; then + # If the user set $PYTHON, use it and don't search something else. + AC_MSG_CHECKING([whether $PYTHON version >= $1]) + AM_PYTHON_CHECK_VERSION([$PYTHON], [$1], + [AC_MSG_RESULT(yes)], + [AC_MSG_ERROR(too old)]) + am_display_PYTHON=$PYTHON + else + # Otherwise, try each interpreter until we find one that satisfies + # VERSION. + AC_CACHE_CHECK([for a Python interpreter with version >= $1], + [am_cv_pathless_PYTHON],[ + for am_cv_pathless_PYTHON in _AM_PYTHON_INTERPRETER_LIST none; do + test "$am_cv_pathless_PYTHON" = none && break + AM_PYTHON_CHECK_VERSION([$am_cv_pathless_PYTHON], [$1], [break]) + done]) + # Set $PYTHON to the absolute path of $am_cv_pathless_PYTHON. + if test "$am_cv_pathless_PYTHON" = none; then + PYTHON=: + else + AC_PATH_PROG([PYTHON], [$am_cv_pathless_PYTHON]) + fi + am_display_PYTHON=$am_cv_pathless_PYTHON + fi + ]) + + if test "$PYTHON" = :; then + dnl Run any user-specified action, or abort. + m4_default([$3], [AC_MSG_ERROR([no suitable Python interpreter found])]) + else + + dnl Query Python for its version number. Getting [:3] seems to be + dnl the best way to do this; it's what "site.py" does in the standard + dnl library. + + AC_CACHE_CHECK([for $am_display_PYTHON version], [am_cv_python_version], + [am_cv_python_version=`$PYTHON -c "import sys; sys.stdout.write(sys.version[[:3]])"`]) + AC_SUBST([PYTHON_VERSION], [$am_cv_python_version]) + + dnl Use the values of $prefix and $exec_prefix for the corresponding + dnl values of PYTHON_PREFIX and PYTHON_EXEC_PREFIX. These are made + dnl distinct variables so they can be overridden if need be. However, + dnl general consensus is that you shouldn't need this ability. + + AC_SUBST([PYTHON_PREFIX], ['${prefix}']) + AC_SUBST([PYTHON_EXEC_PREFIX], ['${exec_prefix}']) + + dnl At times (like when building shared libraries) you may want + dnl to know which OS platform Python thinks this is. + + AC_CACHE_CHECK([for $am_display_PYTHON platform], [am_cv_python_platform], + [am_cv_python_platform=`$PYTHON -c "import sys; sys.stdout.write(sys.platform)"`]) + AC_SUBST([PYTHON_PLATFORM], [$am_cv_python_platform]) + + + dnl Set up 4 directories: + + dnl pythondir -- where to install python scripts. This is the + dnl site-packages directory, not the python standard library + dnl directory like in previous automake betas. This behavior + dnl is more consistent with lispdir.m4 for example. + dnl Query distutils for this directory. distutils does not exist in + dnl Python 1.5, so we fall back to the hardcoded directory if it + dnl doesn't work. + AC_CACHE_CHECK([for $am_display_PYTHON script directory], + [am_cv_python_pythondir], + [if test "x$prefix" = xNONE + then + am_py_prefix=$ac_default_prefix + else + am_py_prefix=$prefix + fi + am_cv_python_pythondir=`$PYTHON -c "import sys; from distutils import sysconfig; sys.stdout.write(sysconfig.get_python_lib(0,0,prefix='$am_py_prefix'))" 2>/dev/null || + echo "$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages"` + case $am_cv_python_pythondir in + $am_py_prefix*) + am__strip_prefix=`echo "$am_py_prefix" | sed 's|.|.|g'` + am_cv_python_pythondir=`echo "$am_cv_python_pythondir" | sed "s,^$am__strip_prefix,$PYTHON_PREFIX,"` + ;; + *) + case $am_py_prefix in + /usr|/System*) ;; + *) + am_cv_python_pythondir=$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages + ;; + esac + ;; + esac + ]) + AC_SUBST([pythondir], [$am_cv_python_pythondir]) + + dnl pkgpythondir -- $PACKAGE directory under pythondir. Was + dnl PYTHON_SITE_PACKAGE in previous betas, but this naming is + dnl more consistent with the rest of automake. + + AC_SUBST([pkgpythondir], [\${pythondir}/$PACKAGE]) + + dnl pyexecdir -- directory for installing python extension modules + dnl (shared libraries) + dnl Query distutils for this directory. distutils does not exist in + dnl Python 1.5, so we fall back to the hardcoded directory if it + dnl doesn't work. + AC_CACHE_CHECK([for $am_display_PYTHON extension module directory], + [am_cv_python_pyexecdir], + [if test "x$exec_prefix" = xNONE + then + am_py_exec_prefix=$am_py_prefix + else + am_py_exec_prefix=$exec_prefix + fi + am_cv_python_pyexecdir=`$PYTHON -c "import sys; from distutils import sysconfig; sys.stdout.write(sysconfig.get_python_lib(1,0,prefix='$am_py_exec_prefix'))" 2>/dev/null || + echo "$PYTHON_EXEC_PREFIX/lib/python$PYTHON_VERSION/site-packages"` + case $am_cv_python_pyexecdir in + $am_py_exec_prefix*) + am__strip_prefix=`echo "$am_py_exec_prefix" | sed 's|.|.|g'` + am_cv_python_pyexecdir=`echo "$am_cv_python_pyexecdir" | sed "s,^$am__strip_prefix,$PYTHON_EXEC_PREFIX,"` + ;; + *) + case $am_py_exec_prefix in + /usr|/System*) ;; + *) + am_cv_python_pyexecdir=$PYTHON_EXEC_PREFIX/lib/python$PYTHON_VERSION/site-packages + ;; + esac + ;; + esac + ]) + AC_SUBST([pyexecdir], [$am_cv_python_pyexecdir]) + + dnl pkgpyexecdir -- $(pyexecdir)/$(PACKAGE) + + AC_SUBST([pkgpyexecdir], [\${pyexecdir}/$PACKAGE]) + + dnl Run any user-specified action. + $2 + fi + +]) + + +# AM_PYTHON_CHECK_VERSION(PROG, VERSION, [ACTION-IF-TRUE], [ACTION-IF-FALSE]) +# --------------------------------------------------------------------------- +# Run ACTION-IF-TRUE if the Python interpreter PROG has version >= VERSION. +# Run ACTION-IF-FALSE otherwise. +# This test uses sys.hexversion instead of the string equivalent (first +# word of sys.version), in order to cope with versions such as 2.2c1. +# This supports Python 2.0 or higher. (2.0 was released on October 16, 2000). +AC_DEFUN([AM_PYTHON_CHECK_VERSION], + [prog="import sys +# split strings by '.' and convert to numeric. Append some zeros +# because we need at least 4 digits for the hex conversion. +# map returns an iterator in Python 3.0 and a list in 2.x +minver = list(map(int, '$2'.split('.'))) + [[0, 0, 0]] +minverhex = 0 +# xrange is not present in Python 3.0 and range returns an iterator +for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[[i]] +sys.exit(sys.hexversion < minverhex)" + AS_IF([AM_RUN_LOG([$1 -c "$prog"])], [$3], [$4])]) + # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation diff --git a/bus/Makefile.in b/bus/Makefile.in index b334af5a..09bc9c15 100644 --- a/bus/Makefile.in +++ b/bus/Makefile.in @@ -429,6 +429,11 @@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ +PYTHON = @PYTHON@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ RC = @RC@ R_DYNAMIC_LDFLAG = @R_DYNAMIC_LDFLAG@ @@ -500,9 +505,13 @@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ diff --git a/bus/activation.c b/bus/activation.c index 3177d023..acb2aa89 100644 --- a/bus/activation.c +++ b/bus/activation.c @@ -268,6 +268,7 @@ update_desktop_file_entry (BusActivation *activation, _DBUS_ASSERT_ERROR_IS_CLEAR (error); + retval = FALSE; name = NULL; exec = NULL; user = NULL; @@ -427,8 +428,11 @@ update_desktop_file_entry (BusActivation *activation, if (_dbus_hash_table_lookup_string (activation->entries, name)) { - _dbus_verbose ("The new service name \"%s\" of service file \"%s\" already in cache, ignoring\n", + _dbus_verbose ("The new service name \"%s\" of service file \"%s\" is already in cache, ignoring\n", name, _dbus_string_get_const_data (&file_path)); + dbus_set_error (error, DBUS_ERROR_FAILED, + "The new service name \"%s\" of service file \"%s\" is already in cache, ignoring\n", + name, _dbus_string_get_const_data (&file_path)); goto out; } @@ -457,8 +461,7 @@ update_desktop_file_entry (BusActivation *activation, * the entries hash table */ _dbus_hash_table_remove_string (entry->s_dir->entries, entry->filename); - bus_activation_entry_unref (entry); - return FALSE; + goto out; } } @@ -476,7 +479,7 @@ out: if (entry) bus_activation_entry_unref (entry); - return FALSE; + return retval; } static dbus_bool_t @@ -32,6 +32,9 @@ #ifdef HAVE_SIGNAL_H #include <signal.h> #endif +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif #ifdef HAVE_ERRNO_H #include <errno.h> #endif @@ -39,16 +42,23 @@ static BusContext *context; +#ifdef DBUS_UNIX + static int reload_pipe[2]; #define RELOAD_READ_END 0 #define RELOAD_WRITE_END 1 static void close_reload_pipe (void); +typedef enum + { + ACTION_RELOAD = 'r', + ACTION_QUIT = 'q' + } SignalAction; + static void signal_handler (int sig) { - switch (sig) { #ifdef DBUS_BUS_ENABLE_DNOTIFY_ON_LINUX @@ -59,18 +69,58 @@ signal_handler (int sig) case SIGHUP: { DBusString str; - _dbus_string_init_const (&str, "foo"); + char action[2] = { ACTION_RELOAD, '\0' }; + + _dbus_string_init_const (&str, action); if ((reload_pipe[RELOAD_WRITE_END] > 0) && !_dbus_write_socket (reload_pipe[RELOAD_WRITE_END], &str, 0, 1)) { - _dbus_warn ("Unable to write to reload pipe.\n"); - close_reload_pipe (); + /* If we receive SIGHUP often enough to fill the pipe buffer (4096 + * times on old Linux, 65536 on modern Linux) before it can be + * drained, let's just warn and ignore. The configuration will be + * reloaded while draining the pipe buffer, which is what we + * wanted. It's harmless that it will be reloaded fewer times than + * we asked for, since the reload is delayed anyway, so new changes + * will be picked up. + * + * We use write() because _dbus_warn uses vfprintf, which isn't + * async-signal-safe. + * + * This is necessarily Unix-specific, but so are POSIX signals, + * so... */ + static const char message[] = + "Unable to write to reload pipe - buffer full?\n"; + + write (STDERR_FILENO, message, strlen (message)); } } break; #endif + + case SIGTERM: + { + DBusString str; + char action[2] = { ACTION_QUIT, '\0' }; + _dbus_string_init_const (&str, action); + if ((reload_pipe[RELOAD_WRITE_END] < 0) || + !_dbus_write_socket (reload_pipe[RELOAD_WRITE_END], &str, 0, 1)) + { + /* If we can't write to the socket, dying seems a more + * important response to SIGTERM than cleaning up sockets, + * so we exit. We'd use exit(), but that's not async-signal-safe, + * so we'll have to resort to _exit(). */ + static const char message[] = + "Unable to write termination signal to pipe - buffer full?\n" + "Will exit instead.\n"; + + write (STDERR_FILENO, message, strlen (message)); + _exit (1); + } + } + break; } } +#endif /* DBUS_UNIX */ static void usage (void) @@ -163,6 +213,7 @@ check_two_pid_descriptors (const DBusString *pid_fd, } } +#ifdef DBUS_UNIX static dbus_bool_t handle_reload_watch (DBusWatch *watch, unsigned int flags, @@ -170,6 +221,8 @@ handle_reload_watch (DBusWatch *watch, { DBusError error; DBusString str; + char *action_str; + char action = '\0'; while (!_dbus_string_init (&str)) _dbus_wait_for_memory (); @@ -181,6 +234,12 @@ handle_reload_watch (DBusWatch *watch, close_reload_pipe (); return TRUE; } + + action_str = _dbus_string_get_data (&str); + if (action_str != NULL) + { + action = action_str[0]; + } _dbus_string_free (&str); /* this can only fail if we don't understand the config file @@ -188,15 +247,42 @@ handle_reload_watch (DBusWatch *watch, * loaded config. */ dbus_error_init (&error); - if (! bus_context_reload_config (context, &error)) + + switch (action) { - _DBUS_ASSERT_ERROR_IS_SET (&error); - _dbus_assert (dbus_error_has_name (&error, DBUS_ERROR_FAILED) || - dbus_error_has_name (&error, DBUS_ERROR_NO_MEMORY)); - _dbus_warn ("Unable to reload configuration: %s\n", - error.message); - dbus_error_free (&error); + case ACTION_RELOAD: + if (! bus_context_reload_config (context, &error)) + { + _DBUS_ASSERT_ERROR_IS_SET (&error); + _dbus_assert (dbus_error_has_name (&error, DBUS_ERROR_FAILED) || + dbus_error_has_name (&error, DBUS_ERROR_NO_MEMORY)); + _dbus_warn ("Unable to reload configuration: %s\n", + error.message); + dbus_error_free (&error); + } + break; + + case ACTION_QUIT: + { + DBusLoop *loop; + /* + * On OSs without abstract sockets, we want to quit + * gracefully rather than being killed by SIGTERM, + * so that DBusServer gets a chance to clean up the + * sockets from the filesystem. fd.o #38656 + */ + loop = bus_context_get_loop (context); + if (loop != NULL) + { + _dbus_loop_quit (loop); + } + } + break; + + default: + break; } + return TRUE; } @@ -257,6 +343,7 @@ close_reload_pipe (void) _dbus_close_socket (reload_pipe[RELOAD_WRITE_END], NULL); reload_pipe[RELOAD_WRITE_END] = -1; } +#endif /* DBUS_UNIX */ int main (int argc, char **argv) @@ -507,14 +594,21 @@ main (int argc, char **argv) * print_pid_pipe */ +#ifdef DBUS_UNIX setup_reload_pipe (bus_context_get_loop (context)); + /* POSIX signals are Unix-specific, and _dbus_set_signal_handler is + * unimplemented (and probably unimplementable) on Windows, so there's + * no point in trying to make the handler portable to non-Unix. */ + + _dbus_set_signal_handler (SIGTERM, signal_handler); #ifdef SIGHUP _dbus_set_signal_handler (SIGHUP, signal_handler); #endif #ifdef DBUS_BUS_ENABLE_DNOTIFY_ON_LINUX _dbus_set_signal_handler (SIGIO, signal_handler); #endif /* DBUS_BUS_ENABLE_DNOTIFY_ON_LINUX */ +#endif /* DBUS_UNIX */ _dbus_verbose ("We are on D-Bus...\n"); _dbus_loop_run (bus_context_get_loop (context)); diff --git a/bus/selinux.c b/bus/selinux.c index e94d8a8e..36287e9f 100644 --- a/bus/selinux.c +++ b/bus/selinux.c @@ -1055,7 +1055,7 @@ _dbus_change_to_daemon_user (const char *user, capng_clear (CAPNG_SELECT_BOTH); capng_update (CAPNG_ADD, CAPNG_EFFECTIVE | CAPNG_PERMITTED, CAP_AUDIT_WRITE); - rc = capng_change_id (uid, gid, 0); + rc = capng_change_id (uid, gid, CAPNG_DROP_SUPP_GRP); if (rc) { switch (rc) { diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 04f318a3..750e3f1a 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -100,6 +100,9 @@ OPTION(DBUS_DISABLE_ASSERTS "Disable assertion checking" OFF) option (DBUS_ENABLE_STATS "enable bus daemon usage statistics" OFF) +# analogous to AC_USE_SYSTEM_EXTENSIONS in configure.ac +add_definitions(-D_POSIX_C_SOURCE=199309L -D_GNU_SOURCE) + # do config checks INCLUDE(ConfigureChecks.cmake) diff --git a/cmake/config.h.cmake b/cmake/config.h.cmake index 6bc6aa56..b4bfc802 100644 --- a/cmake/config.h.cmake +++ b/cmake/config.h.cmake @@ -253,4 +253,8 @@ #define _dbus_verbose_C_S _dbus_verbose #endif +# if defined(_MSC_VER) && !defined(inline) +#define inline __inline +#endif + #endif // _DBUS_CONFIG_H diff --git a/cmake/dbus/dbus-arch-deps.h.cmake b/cmake/dbus/dbus-arch-deps.h.cmake index 7d566e9f..dddbeb4c 100644 --- a/cmake/dbus/dbus-arch-deps.h.cmake +++ b/cmake/dbus/dbus-arch-deps.h.cmake @@ -51,6 +51,17 @@ typedef unsigned @DBUS_INT32_TYPE@ dbus_uint32_t; typedef @DBUS_INT16_TYPE@ dbus_int16_t; typedef unsigned @DBUS_INT16_TYPE@ dbus_uint16_t; +/* This is not really arch-dependent, but it's not worth + * creating an additional generated header just for this + */ +#define DBUS_MAJOR_VERSION @DBUS_MAJOR_VERSION@ +#define DBUS_MINOR_VERSION @DBUS_MINOR_VERSION@ +#define DBUS_MICRO_VERSION @DBUS_MICRO_VERSION@ + +#define DBUS_VERSION_STRING "@DBUS_VERSION@" + +#define DBUS_VERSION ((@DBUS_MAJOR_VERSION@ << 16) | (@DBUS_MINOR_VERSION@ << 8) | (@DBUS_MICRO_VERSION@)) + DBUS_END_DECLS; #endif /* DBUS_ARCH_DEPS_H */ diff --git a/config.h.in b/config.h.in index 1101227a..c5ff7c82 100644 --- a/config.h.in +++ b/config.h.in @@ -153,6 +153,10 @@ /* Have the ddfd member of DIR */ #undef HAVE_DDFD +/* Define to 1 if you have the declaration of `LOG_PERROR', and to 0 if you + don't. */ +#undef HAVE_DECL_LOG_PERROR + /* Define to 1 if you have the declaration of `MSG_NOSIGNAL', and to 0 if you don't. */ #undef HAVE_DECL_MSG_NOSIGNAL @@ -274,6 +278,9 @@ /* Define to 1 if you have the `strtoull' function. */ #undef HAVE_STRTOULL +/* Define to 1 if you have the <syslog.h> header file. */ +#undef HAVE_SYSLOG_H + /* Define to 1 if you have the <sys/inotify.h> header file. */ #undef HAVE_SYS_INOTIFY_H @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for dbus 1.4.14. +# Generated by GNU Autoconf 2.68 for dbus 1.4.16. # # Report bugs to <https://bugs.freedesktop.org/enter_bug.cgi?product=dbus>. # @@ -571,8 +571,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='dbus' PACKAGE_TARNAME='dbus' -PACKAGE_VERSION='1.4.14' -PACKAGE_STRING='dbus 1.4.14' +PACKAGE_VERSION='1.4.16' +PACKAGE_STRING='dbus 1.4.16' PACKAGE_BUGREPORT='https://bugs.freedesktop.org/enter_bug.cgi?product=dbus' PACKAGE_URL='' @@ -717,6 +717,15 @@ DBUS_UINT64_CONSTANT DBUS_INT64_CONSTANT DBUS_INT64_TYPE R_DYNAMIC_LDFLAG +pkgpyexecdir +pyexecdir +pkgpythondir +pythondir +PYTHON_PLATFORM +PYTHON_EXEC_PREFIX +PYTHON_PREFIX +PYTHON_VERSION +PYTHON DBUS_ENABLE_INSTALLED_TESTS_FALSE DBUS_ENABLE_INSTALLED_TESTS_TRUE DBUS_ENABLE_MODULAR_TESTS_FALSE @@ -1484,7 +1493,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures dbus 1.4.14 to adapt to many kinds of systems. +\`configure' configures dbus 1.4.16 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1558,7 +1567,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of dbus 1.4.14:";; + short | recursive ) echo "Configuration of dbus 1.4.16:";; esac cat <<\_ACEOF @@ -1736,7 +1745,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -dbus configure 1.4.14 +dbus configure 1.4.16 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -2450,7 +2459,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by dbus $as_me 1.4.14, which was +It was created by dbus $as_me 1.4.16, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -3342,7 +3351,7 @@ fi # Define the identity of the package. PACKAGE='dbus' - VERSION='1.4.14' + VERSION='1.4.16' cat >>confdefs.h <<_ACEOF @@ -3526,7 +3535,7 @@ LT_CURRENT=8 ## increment any time the source changes; set to ## 0 if you increment CURRENT -LT_REVISION=7 +LT_REVISION=8 ## increment if any interfaces have been added; set to 0 ## if any interfaces have been changed or removed. removal has @@ -3539,8 +3548,8 @@ LT_AGE=5 DBUS_MAJOR_VERSION=1 DBUS_MINOR_VERSION=4 -DBUS_MICRO_VERSION=14 -DBUS_VERSION=1.4.14 +DBUS_MICRO_VERSION=16 +DBUS_VERSION=1.4.16 @@ -16565,7 +16574,16 @@ fi # --enable-modular-tests # Check whether --enable-tests was given. if test "${enable_tests+set}" = set; then : - enableval=$enable_tests; enable_embedded_tests=$enableval; enable_modular_tests=$enableval + enableval=$enable_tests; + if test "x$enableval" = xyes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: Full test coverage was requested with --enable-tests=yes" >&5 +$as_echo "$as_me: Full test coverage was requested with --enable-tests=yes" >&6;} + { $as_echo "$as_me:${as_lineno-$LINENO}: This has many dependencies (GLib, dbus-glib, Python)" >&5 +$as_echo "$as_me: This has many dependencies (GLib, dbus-glib, Python)" >&6;} + fi + enable_embedded_tests=$enableval + enable_modular_tests=$enableval + fi @@ -16776,13 +16794,17 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if test "x$enable_modular_tests" = xyes; then - as_fn_error $? "GLib is required by the modular tests" "$LINENO" 5 + { $as_echo "$as_me:${as_lineno-$LINENO}: Full test coverage (--enable-modular-tests=yes or --enable-tests=yes) requires GLib" >&5 +$as_echo "$as_me: Full test coverage (--enable-modular-tests=yes or --enable-tests=yes) requires GLib" >&6;} + as_fn_error $? "$GLIB_ERRORS" "$LINENO" 5 else # assumed to be "auto" enable_modular_tests=no fi elif test $pkg_failed = untried; then if test "x$enable_modular_tests" = xyes; then - as_fn_error $? "GLib is required by the modular tests" "$LINENO" 5 + { $as_echo "$as_me:${as_lineno-$LINENO}: Full test coverage (--enable-modular-tests=yes or --enable-tests=yes) requires GLib" >&5 +$as_echo "$as_me: Full test coverage (--enable-modular-tests=yes or --enable-tests=yes) requires GLib" >&6;} + as_fn_error $? "$GLIB_ERRORS" "$LINENO" 5 else # assumed to be "auto" enable_modular_tests=no fi @@ -16852,13 +16874,17 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if test "x$enable_modular_tests" = xyes; then - as_fn_error $? "dbus-glib is required by the modular tests (for now)" "$LINENO" 5 + { $as_echo "$as_me:${as_lineno-$LINENO}: Full test coverage (--enable-modular-tests=yes or --enable-tests=yes) requires dbus-glib" >&5 +$as_echo "$as_me: Full test coverage (--enable-modular-tests=yes or --enable-tests=yes) requires dbus-glib" >&6;} + as_fn_error $? "$DBUS_GLIB_ERRORS" "$LINENO" 5 else # assumed to be "auto" enable_modular_tests=no fi elif test $pkg_failed = untried; then if test "x$enable_modular_tests" = xyes; then - as_fn_error $? "dbus-glib is required by the modular tests (for now)" "$LINENO" 5 + { $as_echo "$as_me:${as_lineno-$LINENO}: Full test coverage (--enable-modular-tests=yes or --enable-tests=yes) requires dbus-glib" >&5 +$as_echo "$as_me: Full test coverage (--enable-modular-tests=yes or --enable-tests=yes) requires dbus-glib" >&6;} + as_fn_error $? "$DBUS_GLIB_ERRORS" "$LINENO" 5 else # assumed to be "auto" enable_modular_tests=no fi @@ -16904,6 +16930,476 @@ else fi +if test "x$enable_tests" = xyes; then + # full test coverage is required, Python is a hard dependency + { $as_echo "$as_me:${as_lineno-$LINENO}: Full test coverage (--enable-tests=yes) requires Python, dbus-python, pygobject" >&5 +$as_echo "$as_me: Full test coverage (--enable-tests=yes) requires Python, dbus-python, pygobject" >&6;} + + + + + if test -n "$PYTHON"; then + # If the user set $PYTHON, use it and don't search something else. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $PYTHON version >= 2.6" >&5 +$as_echo_n "checking whether $PYTHON version >= 2.6... " >&6; } + prog="import sys +# split strings by '.' and convert to numeric. Append some zeros +# because we need at least 4 digits for the hex conversion. +# map returns an iterator in Python 3.0 and a list in 2.x +minver = list(map(int, '2.6'.split('.'))) + [0, 0, 0] +minverhex = 0 +# xrange is not present in Python 3.0 and range returns an iterator +for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[i] +sys.exit(sys.hexversion < minverhex)" + if { echo "$as_me:$LINENO: $PYTHON -c "$prog"" >&5 + ($PYTHON -c "$prog") >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + as_fn_error $? "too old" "$LINENO" 5 +fi + am_display_PYTHON=$PYTHON + else + # Otherwise, try each interpreter until we find one that satisfies + # VERSION. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a Python interpreter with version >= 2.6" >&5 +$as_echo_n "checking for a Python interpreter with version >= 2.6... " >&6; } +if ${am_cv_pathless_PYTHON+:} false; then : + $as_echo_n "(cached) " >&6 +else + + for am_cv_pathless_PYTHON in python python2 python3 python3.0 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 none; do + test "$am_cv_pathless_PYTHON" = none && break + prog="import sys +# split strings by '.' and convert to numeric. Append some zeros +# because we need at least 4 digits for the hex conversion. +# map returns an iterator in Python 3.0 and a list in 2.x +minver = list(map(int, '2.6'.split('.'))) + [0, 0, 0] +minverhex = 0 +# xrange is not present in Python 3.0 and range returns an iterator +for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[i] +sys.exit(sys.hexversion < minverhex)" + if { echo "$as_me:$LINENO: $am_cv_pathless_PYTHON -c "$prog"" >&5 + ($am_cv_pathless_PYTHON -c "$prog") >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then : + break +fi + done +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_pathless_PYTHON" >&5 +$as_echo "$am_cv_pathless_PYTHON" >&6; } + # Set $PYTHON to the absolute path of $am_cv_pathless_PYTHON. + if test "$am_cv_pathless_PYTHON" = none; then + PYTHON=: + else + # Extract the first word of "$am_cv_pathless_PYTHON", so it can be a program name with args. +set dummy $am_cv_pathless_PYTHON; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_PYTHON+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $PYTHON in + [\\/]* | ?:[\\/]*) + ac_cv_path_PYTHON="$PYTHON" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_PYTHON="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +PYTHON=$ac_cv_path_PYTHON +if test -n "$PYTHON"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON" >&5 +$as_echo "$PYTHON" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi + am_display_PYTHON=$am_cv_pathless_PYTHON + fi + + + if test "$PYTHON" = :; then + as_fn_error $? "no suitable Python interpreter found" "$LINENO" 5 + else + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON version" >&5 +$as_echo_n "checking for $am_display_PYTHON version... " >&6; } +if ${am_cv_python_version+:} false; then : + $as_echo_n "(cached) " >&6 +else + am_cv_python_version=`$PYTHON -c "import sys; sys.stdout.write(sys.version[:3])"` +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_version" >&5 +$as_echo "$am_cv_python_version" >&6; } + PYTHON_VERSION=$am_cv_python_version + + + + PYTHON_PREFIX='${prefix}' + + PYTHON_EXEC_PREFIX='${exec_prefix}' + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON platform" >&5 +$as_echo_n "checking for $am_display_PYTHON platform... " >&6; } +if ${am_cv_python_platform+:} false; then : + $as_echo_n "(cached) " >&6 +else + am_cv_python_platform=`$PYTHON -c "import sys; sys.stdout.write(sys.platform)"` +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_platform" >&5 +$as_echo "$am_cv_python_platform" >&6; } + PYTHON_PLATFORM=$am_cv_python_platform + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON script directory" >&5 +$as_echo_n "checking for $am_display_PYTHON script directory... " >&6; } +if ${am_cv_python_pythondir+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "x$prefix" = xNONE + then + am_py_prefix=$ac_default_prefix + else + am_py_prefix=$prefix + fi + am_cv_python_pythondir=`$PYTHON -c "import sys; from distutils import sysconfig; sys.stdout.write(sysconfig.get_python_lib(0,0,prefix='$am_py_prefix'))" 2>/dev/null || + echo "$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages"` + case $am_cv_python_pythondir in + $am_py_prefix*) + am__strip_prefix=`echo "$am_py_prefix" | sed 's|.|.|g'` + am_cv_python_pythondir=`echo "$am_cv_python_pythondir" | sed "s,^$am__strip_prefix,$PYTHON_PREFIX,"` + ;; + *) + case $am_py_prefix in + /usr|/System*) ;; + *) + am_cv_python_pythondir=$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages + ;; + esac + ;; + esac + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_pythondir" >&5 +$as_echo "$am_cv_python_pythondir" >&6; } + pythondir=$am_cv_python_pythondir + + + + pkgpythondir=\${pythondir}/$PACKAGE + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON extension module directory" >&5 +$as_echo_n "checking for $am_display_PYTHON extension module directory... " >&6; } +if ${am_cv_python_pyexecdir+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "x$exec_prefix" = xNONE + then + am_py_exec_prefix=$am_py_prefix + else + am_py_exec_prefix=$exec_prefix + fi + am_cv_python_pyexecdir=`$PYTHON -c "import sys; from distutils import sysconfig; sys.stdout.write(sysconfig.get_python_lib(1,0,prefix='$am_py_exec_prefix'))" 2>/dev/null || + echo "$PYTHON_EXEC_PREFIX/lib/python$PYTHON_VERSION/site-packages"` + case $am_cv_python_pyexecdir in + $am_py_exec_prefix*) + am__strip_prefix=`echo "$am_py_exec_prefix" | sed 's|.|.|g'` + am_cv_python_pyexecdir=`echo "$am_cv_python_pyexecdir" | sed "s,^$am__strip_prefix,$PYTHON_EXEC_PREFIX,"` + ;; + *) + case $am_py_exec_prefix in + /usr|/System*) ;; + *) + am_cv_python_pyexecdir=$PYTHON_EXEC_PREFIX/lib/python$PYTHON_VERSION/site-packages + ;; + esac + ;; + esac + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_pyexecdir" >&5 +$as_echo "$am_cv_python_pyexecdir" >&6; } + pyexecdir=$am_cv_python_pyexecdir + + + + pkgpyexecdir=\${pyexecdir}/$PACKAGE + + + + fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python modules for full test coverage" >&5 +$as_echo_n "checking for Python modules for full test coverage... " >&6; } + if "$PYTHON" -c "import dbus, gobject, dbus.mainloop.glib"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + as_fn_error $? "cannot import dbus, gobject, dbus.mainloop.glib Python modules" "$LINENO" 5 + fi +else + # --enable-tests not given: do not abort if Python is missing + + + + + if test -n "$PYTHON"; then + # If the user set $PYTHON, use it and don't search something else. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $PYTHON version >= 2.6" >&5 +$as_echo_n "checking whether $PYTHON version >= 2.6... " >&6; } + prog="import sys +# split strings by '.' and convert to numeric. Append some zeros +# because we need at least 4 digits for the hex conversion. +# map returns an iterator in Python 3.0 and a list in 2.x +minver = list(map(int, '2.6'.split('.'))) + [0, 0, 0] +minverhex = 0 +# xrange is not present in Python 3.0 and range returns an iterator +for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[i] +sys.exit(sys.hexversion < minverhex)" + if { echo "$as_me:$LINENO: $PYTHON -c "$prog"" >&5 + ($PYTHON -c "$prog") >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + as_fn_error $? "too old" "$LINENO" 5 +fi + am_display_PYTHON=$PYTHON + else + # Otherwise, try each interpreter until we find one that satisfies + # VERSION. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a Python interpreter with version >= 2.6" >&5 +$as_echo_n "checking for a Python interpreter with version >= 2.6... " >&6; } +if ${am_cv_pathless_PYTHON+:} false; then : + $as_echo_n "(cached) " >&6 +else + + for am_cv_pathless_PYTHON in python python2 python3 python3.0 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 none; do + test "$am_cv_pathless_PYTHON" = none && break + prog="import sys +# split strings by '.' and convert to numeric. Append some zeros +# because we need at least 4 digits for the hex conversion. +# map returns an iterator in Python 3.0 and a list in 2.x +minver = list(map(int, '2.6'.split('.'))) + [0, 0, 0] +minverhex = 0 +# xrange is not present in Python 3.0 and range returns an iterator +for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[i] +sys.exit(sys.hexversion < minverhex)" + if { echo "$as_me:$LINENO: $am_cv_pathless_PYTHON -c "$prog"" >&5 + ($am_cv_pathless_PYTHON -c "$prog") >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then : + break +fi + done +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_pathless_PYTHON" >&5 +$as_echo "$am_cv_pathless_PYTHON" >&6; } + # Set $PYTHON to the absolute path of $am_cv_pathless_PYTHON. + if test "$am_cv_pathless_PYTHON" = none; then + PYTHON=: + else + # Extract the first word of "$am_cv_pathless_PYTHON", so it can be a program name with args. +set dummy $am_cv_pathless_PYTHON; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_PYTHON+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $PYTHON in + [\\/]* | ?:[\\/]*) + ac_cv_path_PYTHON="$PYTHON" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_PYTHON="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +PYTHON=$ac_cv_path_PYTHON +if test -n "$PYTHON"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON" >&5 +$as_echo "$PYTHON" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi + am_display_PYTHON=$am_cv_pathless_PYTHON + fi + + + if test "$PYTHON" = :; then + : + else + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON version" >&5 +$as_echo_n "checking for $am_display_PYTHON version... " >&6; } +if ${am_cv_python_version+:} false; then : + $as_echo_n "(cached) " >&6 +else + am_cv_python_version=`$PYTHON -c "import sys; sys.stdout.write(sys.version[:3])"` +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_version" >&5 +$as_echo "$am_cv_python_version" >&6; } + PYTHON_VERSION=$am_cv_python_version + + + + PYTHON_PREFIX='${prefix}' + + PYTHON_EXEC_PREFIX='${exec_prefix}' + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON platform" >&5 +$as_echo_n "checking for $am_display_PYTHON platform... " >&6; } +if ${am_cv_python_platform+:} false; then : + $as_echo_n "(cached) " >&6 +else + am_cv_python_platform=`$PYTHON -c "import sys; sys.stdout.write(sys.platform)"` +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_platform" >&5 +$as_echo "$am_cv_python_platform" >&6; } + PYTHON_PLATFORM=$am_cv_python_platform + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON script directory" >&5 +$as_echo_n "checking for $am_display_PYTHON script directory... " >&6; } +if ${am_cv_python_pythondir+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "x$prefix" = xNONE + then + am_py_prefix=$ac_default_prefix + else + am_py_prefix=$prefix + fi + am_cv_python_pythondir=`$PYTHON -c "import sys; from distutils import sysconfig; sys.stdout.write(sysconfig.get_python_lib(0,0,prefix='$am_py_prefix'))" 2>/dev/null || + echo "$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages"` + case $am_cv_python_pythondir in + $am_py_prefix*) + am__strip_prefix=`echo "$am_py_prefix" | sed 's|.|.|g'` + am_cv_python_pythondir=`echo "$am_cv_python_pythondir" | sed "s,^$am__strip_prefix,$PYTHON_PREFIX,"` + ;; + *) + case $am_py_prefix in + /usr|/System*) ;; + *) + am_cv_python_pythondir=$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages + ;; + esac + ;; + esac + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_pythondir" >&5 +$as_echo "$am_cv_python_pythondir" >&6; } + pythondir=$am_cv_python_pythondir + + + + pkgpythondir=\${pythondir}/$PACKAGE + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON extension module directory" >&5 +$as_echo_n "checking for $am_display_PYTHON extension module directory... " >&6; } +if ${am_cv_python_pyexecdir+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "x$exec_prefix" = xNONE + then + am_py_exec_prefix=$am_py_prefix + else + am_py_exec_prefix=$exec_prefix + fi + am_cv_python_pyexecdir=`$PYTHON -c "import sys; from distutils import sysconfig; sys.stdout.write(sysconfig.get_python_lib(1,0,prefix='$am_py_exec_prefix'))" 2>/dev/null || + echo "$PYTHON_EXEC_PREFIX/lib/python$PYTHON_VERSION/site-packages"` + case $am_cv_python_pyexecdir in + $am_py_exec_prefix*) + am__strip_prefix=`echo "$am_py_exec_prefix" | sed 's|.|.|g'` + am_cv_python_pyexecdir=`echo "$am_cv_python_pyexecdir" | sed "s,^$am__strip_prefix,$PYTHON_EXEC_PREFIX,"` + ;; + *) + case $am_py_exec_prefix in + /usr|/System*) ;; + *) + am_cv_python_pyexecdir=$PYTHON_EXEC_PREFIX/lib/python$PYTHON_VERSION/site-packages + ;; + esac + ;; + esac + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_pyexecdir" >&5 +$as_echo "$am_cv_python_pyexecdir" >&6; } + pyexecdir=$am_cv_python_pyexecdir + + + + pkgpyexecdir=\${pyexecdir}/$PACKAGE + + + + fi + + +fi + if test x$enable_verbose_mode = xyes; then $as_echo "#define DBUS_ENABLE_VERBOSE_MODE 1" >>confdefs.h @@ -17892,6 +18388,33 @@ fi done +for ac_header in syslog.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "syslog.h" "ac_cv_header_syslog_h" "$ac_includes_default" +if test "x$ac_cv_header_syslog_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_SYSLOG_H 1 +_ACEOF + +fi + +done + +if test "x$ac_cv_header_syslog_h" = "xyes"; then + ac_fn_c_check_decl "$LINENO" "LOG_PERROR" "ac_cv_have_decl_LOG_PERROR" "#include <syslog.h> +" +if test "x$ac_cv_have_decl_LOG_PERROR" = xyes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_LOG_PERROR $ac_have_decl +_ACEOF + +fi + #### Check for broken poll; taken from Glib's configure { $as_echo "$as_me:${as_lineno-$LINENO}: checking for broken poll" >&5 @@ -21288,7 +21811,18 @@ fi if test "${with_systemdsystemunitdir+set}" = set; then : withval=$with_systemdsystemunitdir; else + + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"systemd\""; } >&5 + ($PKG_CONFIG --exists --print-errors "systemd") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd) +else + with_systemdsystemunitdir=no +fi + fi if test "x$with_systemdsystemunitdir" != xno; then @@ -22270,7 +22804,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by dbus $as_me 1.4.14, which was +This file was extended by dbus $as_me 1.4.16, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -22336,7 +22870,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -dbus config.status 1.4.14 +dbus config.status 1.4.16 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index 539213f3..5bf4f556 100644 --- a/configure.ac +++ b/configure.ac @@ -3,7 +3,7 @@ AC_PREREQ([2.63]) m4_define([dbus_major_version], [1]) m4_define([dbus_minor_version], [4]) -m4_define([dbus_micro_version], [14]) +m4_define([dbus_micro_version], [16]) 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]) @@ -36,7 +36,7 @@ LT_CURRENT=8 ## increment any time the source changes; set to ## 0 if you increment CURRENT -LT_REVISION=7 +LT_REVISION=8 ## increment if any interfaces have been added; set to 0 ## if any interfaces have been changed or removed. removal has @@ -163,7 +163,14 @@ AC_ARG_ENABLE([modular-tests], AC_ARG_ENABLE([tests], AS_HELP_STRING([--enable-tests], [enable/disable all tests, overriding embedded-tests/modular-tests]), - [enable_embedded_tests=$enableval; enable_modular_tests=$enableval], + [ + if test "x$enableval" = xyes; then + AC_MSG_NOTICE([Full test coverage was requested with --enable-tests=yes]) + AC_MSG_NOTICE([This has many dependencies (GLib, dbus-glib, Python)]) + fi + enable_embedded_tests=$enableval + enable_modular_tests=$enableval + ], []) # DBUS_ENABLE_EMBEDDED_TESTS controls unit tests built in to .c files @@ -187,7 +194,8 @@ if test "x$enable_modular_tests" != xno; then PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.22, gio-2.0 >= 2.22], [], [if test "x$enable_modular_tests" = xyes; then - AC_MSG_ERROR([GLib is required by the modular tests]) + AC_MSG_NOTICE([Full test coverage (--enable-modular-tests=yes or --enable-tests=yes) requires GLib]) + AC_MSG_ERROR([$GLIB_ERRORS]) else # assumed to be "auto" enable_modular_tests=no fi]) @@ -195,7 +203,8 @@ if test "x$enable_modular_tests" != xno; then PKG_CHECK_MODULES([DBUS_GLIB], [dbus-glib-1], [], [if test "x$enable_modular_tests" = xyes; then - AC_MSG_ERROR([dbus-glib is required by the modular tests (for now)]) + AC_MSG_NOTICE([Full test coverage (--enable-modular-tests=yes or --enable-tests=yes) requires dbus-glib]) + AC_MSG_ERROR([$DBUS_GLIB_ERRORS]) else # assumed to be "auto" enable_modular_tests=no fi]) @@ -218,6 +227,22 @@ AC_ARG_ENABLE([installed-tests], AM_CONDITIONAL([DBUS_ENABLE_INSTALLED_TESTS], [test "x$enable_installed_tests" = xyes]) +if test "x$enable_tests" = xyes; then + # full test coverage is required, Python is a hard dependency + AC_MSG_NOTICE([Full test coverage (--enable-tests=yes) requires Python, dbus-python, pygobject]) + AM_PATH_PYTHON([2.6]) + AC_MSG_CHECKING([for Python modules for full test coverage]) + if "$PYTHON" -c "import dbus, gobject, dbus.mainloop.glib"; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + AC_MSG_ERROR([cannot import dbus, gobject, dbus.mainloop.glib Python modules]) + fi +else + # --enable-tests not given: do not abort if Python is missing + AM_PATH_PYTHON([2.6], [], [:]) +fi + if test x$enable_verbose_mode = xyes; then AC_DEFINE(DBUS_ENABLE_VERBOSE_MODE,1,[Support a verbose mode]) fi @@ -520,6 +545,11 @@ 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) +AC_CHECK_HEADERS([syslog.h]) +if test "x$ac_cv_header_syslog_h" = "xyes"; then + AC_CHECK_DECLS([LOG_PERROR], [], [], [[#include <syslog.h>]]) +fi + #### Check for broken poll; taken from Glib's configure AC_MSG_CHECKING([for broken poll]) @@ -1350,7 +1380,12 @@ AM_CONDITIONAL(DBUS_INIT_SCRIPTS_CYGWIN, test x$with_init_scripts = xcygwin) ##### systemd unit files AC_ARG_WITH([systemdsystemunitdir], AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]), - [], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)]) + [], + [ + PKG_CHECK_EXISTS([systemd], + [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)], + [with_systemdsystemunitdir=no]) + ]) if test "x$with_systemdsystemunitdir" != xno; then AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir]) fi diff --git a/dbus/Makefile.in b/dbus/Makefile.in index bdc83e73..6c849cf0 100644 --- a/dbus/Makefile.in +++ b/dbus/Makefile.in @@ -464,6 +464,11 @@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ +PYTHON = @PYTHON@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ RC = @RC@ R_DYNAMIC_LDFLAG = @R_DYNAMIC_LDFLAG@ @@ -535,9 +540,13 @@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ diff --git a/dbus/dbus-errors.c b/dbus/dbus-errors.c index 5f27501c..db3305b9 100644 --- a/dbus/dbus-errors.c +++ b/dbus/dbus-errors.c @@ -78,6 +78,8 @@ typedef struct } DBusRealError; +_DBUS_STATIC_ASSERT (sizeof (DBusRealError) == sizeof (DBusError)); + /** * Returns a longer message describing an error name. * If the error name is unknown, returns the name diff --git a/dbus/dbus-hash.c b/dbus/dbus-hash.c index 67ef4ced..b104f32f 100644 --- a/dbus/dbus-hash.c +++ b/dbus/dbus-hash.c @@ -222,6 +222,8 @@ typedef struct int n_entries_on_init; /**< used to detect table resize since initialization */ } DBusRealHashIter; +_DBUS_STATIC_ASSERT (sizeof (DBusRealHashIter) == sizeof (DBusHashIter)); + static DBusHashEntry* find_direct_function (DBusHashTable *table, void *key, dbus_bool_t create_if_not_found, diff --git a/dbus/dbus-internals.c b/dbus/dbus-internals.c index 5e864ce3..95a491f9 100644 --- a/dbus/dbus-internals.c +++ b/dbus/dbus-internals.c @@ -301,9 +301,6 @@ static dbus_bool_t verbose = TRUE; #include <pthread.h> #endif -#ifdef _MSC_VER -#define inline -#endif #ifdef DBUS_USE_OUTPUT_DEBUG_STRING static char module_name[1024]; #endif diff --git a/dbus/dbus-internals.h b/dbus/dbus-internals.h index dcef7d7f..06e6c16b 100644 --- a/dbus/dbus-internals.h +++ b/dbus/dbus-internals.h @@ -362,6 +362,12 @@ dbus_bool_t _dbus_read_uuid_file (const DBusString *filename, dbus_bool_t _dbus_get_local_machine_uuid_encoded (DBusString *uuid_str); +#define _DBUS_PASTE2(a, b) a ## b +#define _DBUS_PASTE(a, b) _DBUS_PASTE2 (a, b) +#define _DBUS_STATIC_ASSERT(expr) \ + typedef struct { char _assertion[(expr) ? 1 : -1]; } \ + _DBUS_PASTE (_DBUS_STATIC_ASSERT_, __LINE__) + DBUS_END_DECLS #endif /* DBUS_INTERNALS_H */ diff --git a/dbus/dbus-marshal-basic.c b/dbus/dbus-marshal-basic.c index 3cbc7216..b1398539 100644 --- a/dbus/dbus-marshal-basic.c +++ b/dbus/dbus-marshal-basic.c @@ -29,6 +29,42 @@ #include <string.h> +#if defined(__GNUC__) && (__GNUC__ >= 4) +# define _DBUS_ASSERT_ALIGNMENT(type, op, val) \ + _DBUS_STATIC_ASSERT (__extension__ __alignof__ (type) op val) +#else + /* not gcc, so probably no alignof operator: just use a no-op statement + * that's valid in the same contexts */ +# define _DBUS_ASSERT_ALIGNMENT(type, op, val) \ + _DBUS_STATIC_ASSERT (TRUE) +#endif + +/* True by definition, but just for completeness... */ +_DBUS_STATIC_ASSERT (sizeof (char) == 1); +_DBUS_ASSERT_ALIGNMENT (char, ==, 1); + +_DBUS_STATIC_ASSERT (sizeof (dbus_int16_t) == 2); +_DBUS_ASSERT_ALIGNMENT (dbus_int16_t, <=, 2); +_DBUS_STATIC_ASSERT (sizeof (dbus_uint16_t) == 2); +_DBUS_ASSERT_ALIGNMENT (dbus_uint16_t, <=, 2); + +_DBUS_STATIC_ASSERT (sizeof (dbus_int32_t) == 4); +_DBUS_ASSERT_ALIGNMENT (dbus_int32_t, <=, 4); +_DBUS_STATIC_ASSERT (sizeof (dbus_uint32_t) == 4); +_DBUS_ASSERT_ALIGNMENT (dbus_uint32_t, <=, 4); +_DBUS_STATIC_ASSERT (sizeof (dbus_bool_t) == 4); +_DBUS_ASSERT_ALIGNMENT (dbus_bool_t, <=, 4); + +_DBUS_STATIC_ASSERT (sizeof (double) == 8); +_DBUS_ASSERT_ALIGNMENT (double, <=, 8); + +#ifdef DBUS_HAVE_INT64 +_DBUS_STATIC_ASSERT (sizeof (dbus_int64_t) == 8); +_DBUS_ASSERT_ALIGNMENT (dbus_int64_t, <=, 8); +_DBUS_STATIC_ASSERT (sizeof (dbus_uint64_t) == 8); +_DBUS_ASSERT_ALIGNMENT (dbus_uint64_t, <=, 8); +#endif + /** * @defgroup DBusMarshal marshaling and unmarshaling * @ingroup DBusInternals diff --git a/dbus/dbus-server-unix.c b/dbus/dbus-server-unix.c index 70ad9654..130f66ec 100644 --- a/dbus/dbus-server-unix.c +++ b/dbus/dbus-server-unix.c @@ -251,11 +251,18 @@ _dbus_server_new_for_domain_socket (const char *path, goto failed_0; } - path_copy = _dbus_strdup (path); - if (path_copy == NULL) + if (abstract) { - dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL); - goto failed_0; + path_copy = NULL; + } + else + { + path_copy = _dbus_strdup (path); + if (path_copy == NULL) + { + dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL); + goto failed_0; + } } listen_fd = _dbus_listen_unix_socket (path, abstract, error); @@ -273,7 +280,8 @@ _dbus_server_new_for_domain_socket (const char *path, goto failed_2; } - _dbus_server_socket_own_filename(server, path_copy); + if (path_copy != NULL) + _dbus_server_socket_own_filename(server, path_copy); _dbus_string_free (&address); diff --git a/dbus/dbus-string-private.h b/dbus/dbus-string-private.h index 365d89a3..b17c2b9f 100644 --- a/dbus/dbus-string-private.h +++ b/dbus/dbus-string-private.h @@ -24,6 +24,7 @@ #ifndef DBUS_STRING_PRIVATE_H #define DBUS_STRING_PRIVATE_H +#include <dbus/dbus-internals.h> #include <dbus/dbus-memory.h> #include <dbus/dbus-types.h> @@ -51,6 +52,7 @@ typedef struct unsigned int align_offset : 3; /**< str - align_offset is the actual malloc block */ } DBusRealString; +_DBUS_STATIC_ASSERT (sizeof (DBusRealString) == sizeof (DBusString)); /** * @defgroup DBusStringInternals DBusString implementation details diff --git a/dbus/dbus-sysdeps-unix.c b/dbus/dbus-sysdeps-unix.c index e69f3b59..f51f6fcb 100644 --- a/dbus/dbus-sysdeps-unix.c +++ b/dbus/dbus-sysdeps-unix.c @@ -90,6 +90,38 @@ #define socklen_t int #endif +#if defined (__sun) || defined (__sun__) +/* + * CMS_SPACE etc. definitions for Solaris < 10, based on + * http://mailman.videolan.org/pipermail/vlc-devel/2006-May/024402.html + * via + * http://wiki.opencsw.org/porting-faq#toc10 + * + * These are only redefined for Solaris, for now: if your OS needs these too, + * please file a bug. (Or preferably, improve your OS so they're not needed.) + */ + +# ifndef CMSG_ALIGN +# ifdef __sun__ +# define CMSG_ALIGN(len) _CMSG_DATA_ALIGN (len) +# else + /* aligning to sizeof (long) is assumed to be portable (fd.o#40235) */ +# define CMSG_ALIGN(len) (((len) + sizeof (long) - 1) & \ + ~(sizeof (long) - 1)) +# endif +# endif + +# ifndef CMSG_SPACE +# define CMSG_SPACE(len) (CMSG_ALIGN (sizeof (struct cmsghdr)) + \ + CMSG_ALIGN (len)) +# endif + +# ifndef CMSG_LEN +# define CMSG_LEN(len) (CMSG_ALIGN (sizeof (struct cmsghdr)) + (len)) +# endif + +#endif /* Solaris */ + static dbus_bool_t _dbus_open_socket (int *fd_p, int domain, @@ -2989,14 +3021,60 @@ _dbus_full_duplex_pipe (int *fd1, * * @param format a printf-style format string * @param args arguments for the format string - * @returns length of the given format string and args + * @returns length of the given format string and args, or -1 if no memory */ int _dbus_printf_string_upper_bound (const char *format, va_list args) { - char c; - return vsnprintf (&c, 1, format, args); + char static_buf[1024]; + int bufsize = sizeof (static_buf); + int len; + + len = vsnprintf (static_buf, bufsize, format, args); + + /* If vsnprintf() returned non-negative, then either the string fits in + * static_buf, or this OS has the POSIX and C99 behaviour where vsnprintf + * returns the number of characters that were needed, or this OS returns the + * truncated length. + * + * We ignore the possibility that snprintf might just ignore the length and + * overrun the buffer (64-bit Solaris 7), because that's pathological. + * If your libc is really that bad, come back when you have a better one. */ + if (len == bufsize) + { + /* This could be the truncated length (Tru64 and IRIX have this bug), + * or the real length could be coincidentally the same. Which is it? + * If vsnprintf returns the truncated length, we'll go to the slow + * path. */ + if (vsnprintf (static_buf, 1, format, args) == 1) + len = -1; + } + + /* If vsnprintf() returned negative, we have to do more work. + * HP-UX returns negative. */ + while (len < 0) + { + char *buf; + + bufsize *= 2; + + buf = dbus_malloc (bufsize); + + if (buf == NULL) + return -1; + + len = vsnprintf (buf, bufsize, format, args); + dbus_free (buf); + + /* If the reported length is exactly the buffer size, round up to the + * next size, in case vsnprintf has been returning the truncated + * length */ + if (len == bufsize) + len = -1; + } + + return len; } /** diff --git a/dbus/dbus-sysdeps-util-unix.c b/dbus/dbus-sysdeps-util-unix.c index a80f6430..d57e6aad 100644 --- a/dbus/dbus-sysdeps-util-unix.c +++ b/dbus/dbus-sysdeps-util-unix.c @@ -422,11 +422,16 @@ _dbus_request_file_descriptor_limit (unsigned int limit) #endif } -void +void _dbus_init_system_log (void) { +#ifdef HAVE_DECL_LOG_PERROR openlog ("dbus", LOG_PID | LOG_PERROR, LOG_DAEMON); +#else + openlog ("dbus", LOG_PID, LOG_DAEMON); +#endif } + /** * Log a message to the system log file (e.g. syslog on Unix). * @@ -476,6 +481,19 @@ _dbus_system_logv (DBusSystemLogSeverity severity, const char *msg, va_list args return; } +#ifndef HAVE_DECL_LOG_PERROR + { + /* vsyslog() won't write to stderr, so we'd better do it */ + va_list tmp; + + DBUS_VA_COPY (tmp, args); + fprintf (stderr, "dbus[" DBUS_PID_FORMAT "]: ", _dbus_getpid ()); + vfprintf (stderr, msg, tmp); + fputc ('\n', stderr); + va_end (tmp); + } +#endif + vsyslog (flags, msg, args); if (severity == DBUS_SYSTEM_LOG_FATAL) diff --git a/dbus/dbus-sysdeps.h b/dbus/dbus-sysdeps.h index 54a4cd7e..d4883c1b 100644 --- a/dbus/dbus-sysdeps.h +++ b/dbus/dbus-sysdeps.h @@ -31,6 +31,10 @@ #include <stdint.h> #endif +#ifdef HAVE_INTTYPES_H +#include <inttypes.h> +#endif + #include <dbus/dbus-errors.h> #include <dbus/dbus-file.h> #include <dbus/dbus-string.h> diff --git a/doc/Makefile.am b/doc/Makefile.am index e4ab5fb8..3fdb7803 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -28,11 +28,9 @@ DTDS = \ busconfig.dtd \ introspect.dtd -dist_doc_DATA = \ - diagram.png \ - diagram.svg \ - system-activation.txt +dist_doc_DATA = system-activation.txt +# uploaded and distributed, but not installed STATIC_DOCS = \ dbus-faq.xml \ dbus-specification.xml \ @@ -50,8 +48,19 @@ EXTRA_DIST = \ html_DATA = +dist_html_DATA = + +# diagram.png/diagram.svg aren't really HTML, but must go in the same +# directory as the HTML to avoid broken links +STATIC_HTML = \ + diagram.png \ + diagram.svg \ + $(NULL) + +dist_html_DATA += $(STATIC_HTML) + # we distribute these in the tarball so users don't necessarily need xmlto -dist_html_DATA = $(XMLTO_OUTPUT) +dist_html_DATA += $(XMLTO_OUTPUT) XMLTO_OUTPUT= \ dbus-faq.html \ @@ -99,8 +108,8 @@ uninstall-local:: rm -f $(DESTDIR)$(apidir)/*.css rm -f $(DESTDIR)$(htmldir)/*.html rm -f $(DESTDIR)$(docdir)/*.txt - rm -f $(DESTDIR)$(docdir)/*.png - rm -f $(DESTDIR)$(docdir)/*.svg + rm -f $(DESTDIR)$(htmldir)/*.png + rm -f $(DESTDIR)$(htmldir)/*.svg rmdir --ignore-fail-on-non-empty $(DESTDIR)$(apidir) || \ rmdir $(DESTDIR)$(apidir) endif @@ -122,14 +131,16 @@ BONUS_FILES = \ $(top_srcdir)/ChangeLog dbus-docs: $(STATIC_DOCS) $(dist_doc_DATA) $(dist_html_DATA) $(MAN_HTML_FILES) $(BONUS_FILES) doxygen.stamp - $(AM_V_at)rm -rf $@ - $(AM_V_GEN)$(MKDIR_P) $@/api - $(AM_V_at)cp $(STATIC_DOCS) $@ - $(AM_V_at)cp $(dist_doc_DATA) $@ - $(AM_V_at)cp $(dist_html_DATA) $@ - $(AM_V_at)cp $(MAN_HTML_FILES) $@ - $(AM_V_at)cp $(BONUS_FILES) $@ - $(AM_V_at)cp -r api/html $@/api + $(AM_V_at)rm -rf $@ $@.tmp + $(AM_V_GEN)$(MKDIR_P) $@.tmp/api + $(AM_V_at)cd $(srcdir) && cp $(STATIC_DOCS) @abs_builddir@/$@.tmp + $(AM_V_at)cd $(srcdir) && cp $(dist_doc_DATA) @abs_builddir@/$@.tmp + $(AM_V_at)cd $(srcdir) && cp $(STATIC_HTML) @abs_builddir@/$@.tmp + $(AM_V_at)cp $(XMLTO_OUTPUT) @abs_builddir@/$@.tmp + $(AM_V_at)cp $(MAN_HTML_FILES) @abs_builddir@/$@.tmp + $(AM_V_at)cp $(BONUS_FILES) @abs_builddir@/$@.tmp + $(AM_V_at)cp -r api/html @abs_builddir@/$@.tmp/api + $(AM_V_at)mv $@.tmp $@ dbus-docs.tar.gz: dbus-docs $(AM_V_GEN)tar czf $@ $< @@ -141,10 +152,10 @@ SPECIFICATION_SERVER = specifications.freedesktop.org SPECIFICATION_PATH = /srv/specifications.freedesktop.org/www/dbus/1.0 maintainer-upload-docs: dbus-docs.tar.gz dbus-docs - scp dbus-docs.tar.gz $(DOC_SERVER):$(DOC_WWW_DIR) + scp dbus-docs.tar.gz $(DOC_SERVER):$(DOC_WWW_DIR)/ rsync -rpvzP --chmod=Dg+s,ug+rwX,o=rX \ dbus-docs/ $(DOC_SERVER):$(DOC_WWW_DIR)/doc/ - scp -p $(DTDS) $(SPECIFICATION_SERVER):$(SPECIFICATION_PATH) + cd $(srcdir) && scp -p $(DTDS) $(SPECIFICATION_SERVER):$(SPECIFICATION_PATH)/ else maintainer-upload-docs: @echo "Can't upload documentation! Re-run configure with" @@ -156,7 +167,7 @@ endif clean-local: rm -f $(html_DATA) rm -rf api - rm -rf dbus-docs + rm -rf dbus-docs dbus-docs.tmp rm -f *.1.html rm -f doxygen.stamp diff --git a/doc/Makefile.in b/doc/Makefile.in index 79676766..45e10625 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -209,6 +209,11 @@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ +PYTHON = @PYTHON@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ RC = @RC@ R_DYNAMIC_LDFLAG = @R_DYNAMIC_LDFLAG@ @@ -280,9 +285,13 @@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -322,11 +331,9 @@ DTDS = \ busconfig.dtd \ introspect.dtd -dist_doc_DATA = \ - diagram.png \ - diagram.svg \ - system-activation.txt +dist_doc_DATA = system-activation.txt +# uploaded and distributed, but not installed STATIC_DOCS = \ dbus-faq.xml \ dbus-specification.xml \ @@ -345,7 +352,15 @@ EXTRA_DIST = \ html_DATA = $(am__append_1) $(am__append_2) # we distribute these in the tarball so users don't necessarily need xmlto -dist_html_DATA = $(XMLTO_OUTPUT) +dist_html_DATA = $(STATIC_HTML) $(XMLTO_OUTPUT) + +# diagram.png/diagram.svg aren't really HTML, but must go in the same +# directory as the HTML to avoid broken links +STATIC_HTML = \ + diagram.png \ + diagram.svg \ + $(NULL) + XMLTO_OUTPUT = \ dbus-faq.html \ dbus-specification.html \ @@ -707,8 +722,8 @@ uninstall-man: uninstall-man1 @DBUS_DOXYGEN_DOCS_ENABLED_TRUE@ rm -f $(DESTDIR)$(apidir)/*.css @DBUS_DOXYGEN_DOCS_ENABLED_TRUE@ rm -f $(DESTDIR)$(htmldir)/*.html @DBUS_DOXYGEN_DOCS_ENABLED_TRUE@ rm -f $(DESTDIR)$(docdir)/*.txt -@DBUS_DOXYGEN_DOCS_ENABLED_TRUE@ rm -f $(DESTDIR)$(docdir)/*.png -@DBUS_DOXYGEN_DOCS_ENABLED_TRUE@ rm -f $(DESTDIR)$(docdir)/*.svg +@DBUS_DOXYGEN_DOCS_ENABLED_TRUE@ rm -f $(DESTDIR)$(htmldir)/*.png +@DBUS_DOXYGEN_DOCS_ENABLED_TRUE@ rm -f $(DESTDIR)$(htmldir)/*.svg @DBUS_DOXYGEN_DOCS_ENABLED_TRUE@ rmdir --ignore-fail-on-non-empty $(DESTDIR)$(apidir) || \ @DBUS_DOXYGEN_DOCS_ENABLED_TRUE@ rmdir $(DESTDIR)$(apidir) @@ -716,23 +731,25 @@ uninstall-man: uninstall-man1 @DBUS_HAVE_MAN2HTML_TRUE@ $(AM_V_GEN)( $(MAN2HTML) $< > $@.tmp && mv $@.tmp $@ ) @DBUS_CAN_UPLOAD_DOCS_TRUE@dbus-docs: $(STATIC_DOCS) $(dist_doc_DATA) $(dist_html_DATA) $(MAN_HTML_FILES) $(BONUS_FILES) doxygen.stamp -@DBUS_CAN_UPLOAD_DOCS_TRUE@ $(AM_V_at)rm -rf $@ -@DBUS_CAN_UPLOAD_DOCS_TRUE@ $(AM_V_GEN)$(MKDIR_P) $@/api -@DBUS_CAN_UPLOAD_DOCS_TRUE@ $(AM_V_at)cp $(STATIC_DOCS) $@ -@DBUS_CAN_UPLOAD_DOCS_TRUE@ $(AM_V_at)cp $(dist_doc_DATA) $@ -@DBUS_CAN_UPLOAD_DOCS_TRUE@ $(AM_V_at)cp $(dist_html_DATA) $@ -@DBUS_CAN_UPLOAD_DOCS_TRUE@ $(AM_V_at)cp $(MAN_HTML_FILES) $@ -@DBUS_CAN_UPLOAD_DOCS_TRUE@ $(AM_V_at)cp $(BONUS_FILES) $@ -@DBUS_CAN_UPLOAD_DOCS_TRUE@ $(AM_V_at)cp -r api/html $@/api +@DBUS_CAN_UPLOAD_DOCS_TRUE@ $(AM_V_at)rm -rf $@ $@.tmp +@DBUS_CAN_UPLOAD_DOCS_TRUE@ $(AM_V_GEN)$(MKDIR_P) $@.tmp/api +@DBUS_CAN_UPLOAD_DOCS_TRUE@ $(AM_V_at)cd $(srcdir) && cp $(STATIC_DOCS) @abs_builddir@/$@.tmp +@DBUS_CAN_UPLOAD_DOCS_TRUE@ $(AM_V_at)cd $(srcdir) && cp $(dist_doc_DATA) @abs_builddir@/$@.tmp +@DBUS_CAN_UPLOAD_DOCS_TRUE@ $(AM_V_at)cd $(srcdir) && cp $(STATIC_HTML) @abs_builddir@/$@.tmp +@DBUS_CAN_UPLOAD_DOCS_TRUE@ $(AM_V_at)cp $(XMLTO_OUTPUT) @abs_builddir@/$@.tmp +@DBUS_CAN_UPLOAD_DOCS_TRUE@ $(AM_V_at)cp $(MAN_HTML_FILES) @abs_builddir@/$@.tmp +@DBUS_CAN_UPLOAD_DOCS_TRUE@ $(AM_V_at)cp $(BONUS_FILES) @abs_builddir@/$@.tmp +@DBUS_CAN_UPLOAD_DOCS_TRUE@ $(AM_V_at)cp -r api/html @abs_builddir@/$@.tmp/api +@DBUS_CAN_UPLOAD_DOCS_TRUE@ $(AM_V_at)mv $@.tmp $@ @DBUS_CAN_UPLOAD_DOCS_TRUE@dbus-docs.tar.gz: dbus-docs @DBUS_CAN_UPLOAD_DOCS_TRUE@ $(AM_V_GEN)tar czf $@ $< @DBUS_CAN_UPLOAD_DOCS_TRUE@maintainer-upload-docs: dbus-docs.tar.gz dbus-docs -@DBUS_CAN_UPLOAD_DOCS_TRUE@ scp dbus-docs.tar.gz $(DOC_SERVER):$(DOC_WWW_DIR) +@DBUS_CAN_UPLOAD_DOCS_TRUE@ scp dbus-docs.tar.gz $(DOC_SERVER):$(DOC_WWW_DIR)/ @DBUS_CAN_UPLOAD_DOCS_TRUE@ rsync -rpvzP --chmod=Dg+s,ug+rwX,o=rX \ @DBUS_CAN_UPLOAD_DOCS_TRUE@ dbus-docs/ $(DOC_SERVER):$(DOC_WWW_DIR)/doc/ -@DBUS_CAN_UPLOAD_DOCS_TRUE@ scp -p $(DTDS) $(SPECIFICATION_SERVER):$(SPECIFICATION_PATH) +@DBUS_CAN_UPLOAD_DOCS_TRUE@ cd $(srcdir) && scp -p $(DTDS) $(SPECIFICATION_SERVER):$(SPECIFICATION_PATH)/ @DBUS_CAN_UPLOAD_DOCS_FALSE@maintainer-upload-docs: @DBUS_CAN_UPLOAD_DOCS_FALSE@ @echo "Can't upload documentation! Re-run configure with" @DBUS_CAN_UPLOAD_DOCS_FALSE@ @echo " --enable-doxygen-docs --enable-xml-docs" @@ -742,7 +759,7 @@ uninstall-man: uninstall-man1 clean-local: rm -f $(html_DATA) rm -rf api - rm -rf dbus-docs + rm -rf dbus-docs dbus-docs.tmp rm -f *.1.html rm -f doxygen.stamp diff --git a/doc/dbus-faq.html b/doc/dbus-faq.html index 10d48443..d2145667 100644 --- a/doc/dbus-faq.html +++ b/doc/dbus-faq.html @@ -1,13 +1,13 @@ <html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>D-Bus FAQ</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.2"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="article" title="D-Bus FAQ"><div class="titlepage"><div><div><h2 class="title"><a name="index"></a>D-Bus FAQ</h2></div><div><div class="authorgroup"><div class="author"><h3 class="author"><span class="firstname">Havoc</span> <span class="surname">Pennington</span></h3><div class="affiliation"><span class="orgname">Red Hat, Inc.<br></span><div class="address"><p><br> <code class="email"><<a class="email" href="mailto:hp@pobox.com">hp@pobox.com</a>></code><br> - </p></div></div></div><div class="author"><h3 class="author"><span class="firstname">David</span> <span class="othername">A</span> <span class="surname">Wheeler</span></h3></div></div></div><div><p class="releaseinfo">Version 0.3</p></div></div><hr></div><div class="qandaset" title="Frequently Asked Questions"><a name="faq"></a><dl><dt>1. <a href="#idp480240"> + </p></div></div></div><div class="author"><h3 class="author"><span class="firstname">David</span> <span class="othername">A</span> <span class="surname">Wheeler</span></h3></div></div></div><div><p class="releaseinfo">Version 0.3</p></div></div><hr></div><div class="qandaset" title="Frequently Asked Questions"><a name="faq"></a><dl><dt>1. <a href="#idp24880336"> What is D-Bus? - </a></dt><dt>2. <a href="#idp3774672"> + </a></dt><dt>2. <a href="#idp28174624"> Is D-Bus stable/finished? - </a></dt><dt>3. <a href="#idp3777840"> + </a></dt><dt>3. <a href="#idp28177792"> How is the reference implementation licensed? Can I use it in proprietary applications? - </a></dt><dt>4. <a href="#idp80544"> + </a></dt><dt>4. <a href="#idp24480816"> What is the difference between a bus name, and object path, and an interface? </a></dt><dt>5. <a href="#service"> @@ -39,9 +39,9 @@ How does D-Bus differ from [yet more IPC mechanisms]? </a></dt><dt>18. <a href="#which-ipc"> Which IPC mechanism should I use? - </a></dt><dt>19. <a href="#idp4882048"> + </a></dt><dt>19. <a href="#idp29282208"> How can I submit a bug or patch? - </a></dt></dl><table border="0" width="100%" summary="Q and A Set"><col align="left" width="1%"><col><tbody><tr class="question" title="1."><td align="left" valign="top"><a name="idp480240"></a><a name="idp480496"></a><p><b>1.</b></p></td><td align="left" valign="top"><p> + </a></dt></dl><table border="0" width="100%" summary="Q and A Set"><col align="left" width="1%"><col><tbody><tr class="question" title="1."><td align="left" valign="top"><a name="idp24880336"></a><a name="idp24880592"></a><p><b>1.</b></p></td><td align="left" valign="top"><p> What is D-Bus? </p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p> This is probably best answered by reading the D-Bus <a class="ulink" href="dbus-tutorial.html" target="_top">tutorial</a> or @@ -52,7 +52,7 @@ Phrased differently, D-Bus is 1) an interprocess communication (IPC) system and 2) some higher-level structure (lifecycle tracking, service activation, security policy) provided by two bus daemons, one systemwide and one per-user-session. - </p></td></tr><tr class="question" title="2."><td align="left" valign="top"><a name="idp3774672"></a><a name="idp3774928"></a><p><b>2.</b></p></td><td align="left" valign="top"><p> + </p></td></tr><tr class="question" title="2."><td align="left" valign="top"><a name="idp28174624"></a><a name="idp28174880"></a><p><b>2.</b></p></td><td align="left" valign="top"><p> Is D-Bus stable/finished? </p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p> The low-level library "libdbus" and the protocol specification are considered @@ -62,7 +62,7 @@ have their own release schedules and degree of maturity, not linked to the low-level library and bus daemon release. Check the project page for the binding you're considering to understand that project's policies. - </p></td></tr><tr class="question" title="3."><td align="left" valign="top"><a name="idp3777840"></a><a name="idp3778096"></a><p><b>3.</b></p></td><td align="left" valign="top"><p> + </p></td></tr><tr class="question" title="3."><td align="left" valign="top"><a name="idp28177792"></a><a name="idp28178048"></a><p><b>3.</b></p></td><td align="left" valign="top"><p> How is the reference implementation licensed? Can I use it in proprietary applications? </p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p> @@ -77,7 +77,7 @@ use D-Bus</em></span>. If you're going to sue, you have to stop using the software. Read the licenses to determine their meaning, this FAQ entry is not intended to change the meaning or terms of the licenses. - </p></td></tr><tr class="question" title="4."><td align="left" valign="top"><a name="idp80544"></a><a name="idp80800"></a><p><b>4.</b></p></td><td align="left" valign="top"><p> + </p></td></tr><tr class="question" title="4."><td align="left" valign="top"><a name="idp24480816"></a><a name="idp24481072"></a><p><b>4.</b></p></td><td align="left" valign="top"><p> What is the difference between a bus name, and object path, and an interface? </p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p> @@ -107,7 +107,7 @@ interfaces, such as <code class="literal">org.freedesktop.DBus.Introspectable</code>, <code class="literal">org.freedesktop.BasicTextField</code>, <code class="literal">org.kde.RichTextDocument</code>. - </p></td></tr><tr class="question" title="5."><td align="left" valign="top"><a name="service"></a><a name="idp97424"></a><p><b>5.</b></p></td><td align="left" valign="top"><p> + </p></td></tr><tr class="question" title="5."><td align="left" valign="top"><a name="service"></a><a name="idp24497680"></a><p><b>5.</b></p></td><td align="left" valign="top"><p> What is a "service"? </p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p> A service is a program that can be launched by the bus daemon @@ -120,7 +120,7 @@ In the D-Bus docs we try to use "service" only when talking about programs the bus knows how to launch, i.e. a service always has a .service file. - </p></td></tr><tr class="question" title="6."><td align="left" valign="top"><a name="components"></a><a name="idp100640"></a><p><b>6.</b></p></td><td align="left" valign="top"><p> + </p></td></tr><tr class="question" title="6."><td align="left" valign="top"><a name="components"></a><a name="idp24500896"></a><p><b>6.</b></p></td><td align="left" valign="top"><p> Is D-Bus a "component system"? </p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p> It helps to keep these concepts separate in your mind: @@ -170,7 +170,7 @@ from component/object systems, though perhaps a "plugin" tends to be a bundle of objects with a user-visible name and can be downloaded/packaged as a unit. - </p></td></tr><tr class="question" title="7."><td align="left" valign="top"><a name="speed"></a><a name="idp113280"></a><p><b>7.</b></p></td><td align="left" valign="top"><p> + </p></td></tr><tr class="question" title="7."><td align="left" valign="top"><a name="speed"></a><a name="idp24513440"></a><p><b>7.</b></p></td><td align="left" valign="top"><p> How fast is the D-Bus reference implementation? </p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p> Of course it depends a bit on what you're doing. @@ -198,7 +198,7 @@ enable asynchronous communication and avoid round trips. This is frequently a more important performance issue than throughput. - </p></td></tr><tr class="question" title="8."><td align="left" valign="top"><a name="size"></a><a name="idp4796832"></a><p><b>8.</b></p></td><td align="left" valign="top"><p> + </p></td></tr><tr class="question" title="8."><td align="left" valign="top"><a name="size"></a><a name="idp29196912"></a><p><b>8.</b></p></td><td align="left" valign="top"><p> How large is the D-Bus reference implementation? </p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p> A production build (with assertions, unit tests, and verbose logging @@ -207,7 +207,7 @@ A much, much smaller implementation would be possible by omitting out of memory handling, hardcoding a main loop (or always using blocking I/O), skipping validation, and otherwise simplifying things. - </p></td></tr><tr class="question" title="9."><td align="left" valign="top"><a name="other-ipc"></a><a name="idp4799792"></a><p><b>9.</b></p></td><td align="left" valign="top"><p> + </p></td></tr><tr class="question" title="9."><td align="left" valign="top"><a name="other-ipc"></a><a name="idp29199872"></a><p><b>9.</b></p></td><td align="left" valign="top"><p> How does D-Bus differ from other interprocess communication or networking protocols? </p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p> @@ -240,7 +240,7 @@ Note: the D-Bus mailing list subscribers are <span class="emphasis"><em>very much not interested</em></span> in debating which IPC system is the One True System. So if you want to discuss that, please use another forum. - </p></td></tr><tr class="question" title="10."><td align="left" valign="top"><a name="corba"></a><a name="idp4808320"></a><p><b>10.</b></p></td><td align="left" valign="top"><p> + </p></td></tr><tr class="question" title="10."><td align="left" valign="top"><a name="corba"></a><a name="idp29208480"></a><p><b>10.</b></p></td><td align="left" valign="top"><p> How does D-Bus differ from CORBA? </p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p> Start by reading <a class="xref" href="#other-ipc" title="9.">Q: 9</a>. @@ -292,7 +292,7 @@ </p><p> On a more trivial note, D-Bus involves substantially fewer acronyms than CORBA. - </p></td></tr><tr class="question" title="11."><td align="left" valign="top"><a name="xmlrpcsoap"></a><a name="idp49472"></a><p><b>11.</b></p></td><td align="left" valign="top"><p> + </p></td></tr><tr class="question" title="11."><td align="left" valign="top"><a name="xmlrpcsoap"></a><a name="idp24449232"></a><p><b>11.</b></p></td><td align="left" valign="top"><p> How does D-Bus differ from XML-RPC and SOAP? </p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p> Start by reading <a class="xref" href="#other-ipc" title="9.">Q: 9</a>. @@ -311,7 +311,7 @@ supports lifecycle tracking of other applications connected to the bus. With XML-RPC and SOAP, typically each method call exists in isolation and has its own HTTP connection. - </p></td></tr><tr class="question" title="12."><td align="left" valign="top"><a name="dce"></a><a name="idp4847408"></a><p><b>12.</b></p></td><td align="left" valign="top"><p> + </p></td></tr><tr class="question" title="12."><td align="left" valign="top"><a name="dce"></a><a name="idp29247568"></a><p><b>12.</b></p></td><td align="left" valign="top"><p> How does D-Bus differ from DCE? </p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p> Start by reading <a class="xref" href="#other-ipc" title="9.">Q: 9</a>. @@ -324,7 +324,7 @@ a distributed time service. As the name implies, DCE is intended for use in a large, multi-computer distributed application. D-Bus would not be well-suited for this. - </p></td></tr><tr class="question" title="13."><td align="left" valign="top"><a name="dcom"></a><a name="idp4852208"></a><p><b>13.</b></p></td><td align="left" valign="top"><p> + </p></td></tr><tr class="question" title="13."><td align="left" valign="top"><a name="dcom"></a><a name="idp29252368"></a><p><b>13.</b></p></td><td align="left" valign="top"><p> How does D-Bus differ from DCOM and COM? </p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p> Start by reading <a class="xref" href="#other-ipc" title="9.">Q: 9</a>. @@ -334,7 +334,7 @@ </p><p> DCOM (distributed COM) is a Windows IPC system designed for use with the COM object system. It's similar in some ways to DCE and CORBA. - </p></td></tr><tr class="question" title="14."><td align="left" valign="top"><a name="internet-communications-engine"></a><a name="idp4856480"></a><p><b>14.</b></p></td><td align="left" valign="top"><p> + </p></td></tr><tr class="question" title="14."><td align="left" valign="top"><a name="internet-communications-engine"></a><a name="idp29256640"></a><p><b>14.</b></p></td><td align="left" valign="top"><p> How does D-Bus differ from ZeroC's Internet Communications Engine (Ice) </p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p> Start by reading <a class="xref" href="#other-ipc" title="9.">Q: 9</a>. @@ -344,7 +344,7 @@ on the level of SOAP or CORBA than D-Bus. Ice has a "dual-license" business around it; i.e. you can use it under the GPL, or pay for a proprietary license. - </p></td></tr><tr class="question" title="15."><td align="left" valign="top"><a name="inter-client-exchange"></a><a name="idp4860496"></a><p><b>15.</b></p></td><td align="left" valign="top"><p> + </p></td></tr><tr class="question" title="15."><td align="left" valign="top"><a name="inter-client-exchange"></a><a name="idp29260656"></a><p><b>15.</b></p></td><td align="left" valign="top"><p> How does D-Bus differ from Inter-Client Exchange (ICE)? </p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p> <a class="ulink" href="http://www.x.org/X11R6.8.1/docs/ICE/ice.pdf" target="_top">ICE</a> @@ -362,7 +362,7 @@ DCOP and XSMP are the only two widely-used applications of ICE, and both could in principle be replaced by D-Bus. (Though whether GNOME and KDE will bother is an open question.) - </p></td></tr><tr class="question" title="16."><td align="left" valign="top"><a name="dcop"></a><a name="idp4865120"></a><p><b>16.</b></p></td><td align="left" valign="top"><p> + </p></td></tr><tr class="question" title="16."><td align="left" valign="top"><a name="dcop"></a><a name="idp29265280"></a><p><b>16.</b></p></td><td align="left" valign="top"><p> How does D-Bus differ from DCOP? </p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p> Start by reading <a class="xref" href="#other-ipc" title="9.">Q: 9</a>. @@ -389,14 +389,14 @@ DCOP's implementation to use D-Bus internally (so that GNOME and KDE would end up using exactly the same bus). See the KDE mailing list archives for some of these discussions. - </p></td></tr><tr class="question" title="17."><td align="left" valign="top"><a name="yet-more-ipc"></a><a name="idp4872112"></a><p><b>17.</b></p></td><td align="left" valign="top"><p> + </p></td></tr><tr class="question" title="17."><td align="left" valign="top"><a name="yet-more-ipc"></a><a name="idp29272272"></a><p><b>17.</b></p></td><td align="left" valign="top"><p> How does D-Bus differ from [yet more IPC mechanisms]? </p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p> Start by reading <a class="xref" href="#other-ipc" title="9.">Q: 9</a>. </p><p> There are countless uses of network sockets in the world. <a class="ulink" href="http://www.mbus.org/" target="_top">MBUS</a>, Sun ONC/RPC, Jabber/XMPP, SIP, are some we can think of quickly. - </p></td></tr><tr class="question" title="18."><td align="left" valign="top"><a name="which-ipc"></a><a name="idp4876048"></a><p><b>18.</b></p></td><td align="left" valign="top"><p> + </p></td></tr><tr class="question" title="18."><td align="left" valign="top"><a name="which-ipc"></a><a name="idp29276208"></a><p><b>18.</b></p></td><td align="left" valign="top"><p> Which IPC mechanism should I use? </p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p> Start by reading <a class="xref" href="#other-ipc" title="9.">Q: 9</a>. @@ -427,7 +427,7 @@ to search the list archives is probably to use an Internet engine such as Google. On Google, include "site:freedesktop.org" in your search. - </p></td></tr><tr class="question" title="19."><td align="left" valign="top"><a name="idp4882048"></a><a name="idp4882304"></a><p><b>19.</b></p></td><td align="left" valign="top"><p> + </p></td></tr><tr class="question" title="19."><td align="left" valign="top"><a name="idp29282208"></a><a name="idp29282464"></a><p><b>19.</b></p></td><td align="left" valign="top"><p> How can I submit a bug or patch? </p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p> The D-Bus <a class="ulink" href="http://dbus.freedesktop.org" target="_top">web site</a> diff --git a/doc/dbus-specification.html b/doc/dbus-specification.html index fd2166e3..79b954dd 100644 --- a/doc/dbus-specification.html +++ b/doc/dbus-specification.html @@ -6,7 +6,7 @@ <code class="email"><<a class="email" href="mailto:alexl@redhat.com">alexl@redhat.com</a>></code><br> </p></div></div></div><div class="author"><h3 class="author"><span class="firstname">Sven</span> <span class="surname">Herzberg</span></h3><div class="affiliation"><span class="orgname">Imendio AB<br></span><div class="address"><p><br> <code class="email"><<a class="email" href="mailto:sven@imendio.com">sven@imendio.com</a>></code><br> - </p></div></div></div></div></div><div><p class="releaseinfo">Version 0.15</p></div><div><div class="revhistory"><table border="1" width="100%" summary="Revision history"><tr><th align="left" valign="top" colspan="3"><b>Revision History</b></th></tr><tr><td align="left">Revision current</td><td align="left"><a class="ulink" href="http://cgit.freedesktop.org/dbus/dbus/log/doc/dbus-specification.xml" target="_top">commit log</a></td><td align="left"></td></tr><tr><td align="left" colspan="3"></td></tr><tr><td align="left">Revision 0.15</td><td align="left">3 November 2010</td><td align="left"></td></tr><tr><td align="left" colspan="3"></td></tr><tr><td align="left">Revision 0.14</td><td align="left">12 May 2010</td><td align="left"></td></tr><tr><td align="left" colspan="3"></td></tr><tr><td align="left">Revision 0.13</td><td align="left">23 Dezember 2009</td><td align="left"></td></tr><tr><td align="left" colspan="3"></td></tr><tr><td align="left">Revision 0.12</td><td align="left">7 November, 2006</td><td align="left"></td></tr><tr><td align="left" colspan="3"></td></tr><tr><td align="left">Revision 0.11</td><td align="left">6 February 2005</td><td align="left"></td></tr><tr><td align="left" colspan="3"></td></tr><tr><td align="left">Revision 0.10</td><td align="left">28 January 2005</td><td align="left"></td></tr><tr><td align="left" colspan="3"></td></tr><tr><td align="left">Revision 0.9</td><td align="left">7 Januar 2005</td><td align="left"></td></tr><tr><td align="left" colspan="3"></td></tr><tr><td align="left">Revision 0.8</td><td align="left">06 September 2003</td><td align="left"></td></tr><tr><td align="left" colspan="3">First released document.</td></tr></table></div></div></div><hr></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="#introduction">Introduction</a></span></dt><dd><dl><dt><span class="sect2"><a href="#stability">Protocol and Specification Stability</a></span></dt></dl></dd><dt><span class="sect1"><a href="#message-protocol">Message Protocol</a></span></dt><dd><dl><dt><span class="sect2"><a href="#message-protocol-signatures">Type Signatures</a></span></dt><dt><span class="sect2"><a href="#message-protocol-marshaling">Marshaling (Wire Format)</a></span></dt><dt><span class="sect2"><a href="#message-protocol-messages">Message Format</a></span></dt><dt><span class="sect2"><a href="#message-protocol-names">Valid Names</a></span></dt><dt><span class="sect2"><a href="#message-protocol-types">Message Types</a></span></dt><dt><span class="sect2"><a href="#message-protocol-handling-invalid">Invalid Protocol and Spec Extensions</a></span></dt></dl></dd><dt><span class="sect1"><a href="#auth-protocol">Authentication Protocol</a></span></dt><dd><dl><dt><span class="sect2"><a href="#auth-protocol-overview">Protocol Overview</a></span></dt><dt><span class="sect2"><a href="#auth-nul-byte">Special credentials-passing nul byte</a></span></dt><dt><span class="sect2"><a href="#auth-command-auth">AUTH command</a></span></dt><dt><span class="sect2"><a href="#auth-command-cancel">CANCEL Command</a></span></dt><dt><span class="sect2"><a href="#auth-command-data">DATA Command</a></span></dt><dt><span class="sect2"><a href="#auth-command-begin">BEGIN Command</a></span></dt><dt><span class="sect2"><a href="#auth-command-rejected">REJECTED Command</a></span></dt><dt><span class="sect2"><a href="#auth-command-ok">OK Command</a></span></dt><dt><span class="sect2"><a href="#auth-command-error">ERROR Command</a></span></dt><dt><span class="sect2"><a href="#auth-command-negotiate-unix-fd">NEGOTIATE_UNIX_FD Command</a></span></dt><dt><span class="sect2"><a href="#auth-command-agree-unix-fd">AGREE_UNIX_FD Command</a></span></dt><dt><span class="sect2"><a href="#auth-command-future">Future Extensions</a></span></dt><dt><span class="sect2"><a href="#auth-examples">Authentication examples</a></span></dt><dt><span class="sect2"><a href="#auth-states">Authentication state diagrams</a></span></dt><dt><span class="sect2"><a href="#auth-mechanisms">Authentication mechanisms</a></span></dt></dl></dd><dt><span class="sect1"><a href="#addresses">Server Addresses</a></span></dt><dt><span class="sect1"><a href="#transports">Transports</a></span></dt><dd><dl><dt><span class="sect2"><a href="#transports-unix-domain-sockets">Unix Domain Sockets</a></span></dt><dt><span class="sect2"><a href="#transports-launchd">launchd</a></span></dt><dt><span class="sect2"><a href="#transports-tcp-sockets">TCP Sockets</a></span></dt><dt><span class="sect2"><a href="#transports-nonce-tcp-sockets">Nonce-secured TCP Sockets</a></span></dt></dl></dd><dt><span class="sect1"><a href="#meta-transports">Meta Transports</a></span></dt><dd><dl><dt><span class="sect2"><a href="#meta-transports-autolaunch">Autolaunch</a></span></dt></dl></dd><dt><span class="sect1"><a href="#naming-conventions">Naming Conventions</a></span></dt><dt><span class="sect1"><a href="#uuids">UUIDs</a></span></dt><dt><span class="sect1"><a href="#standard-interfaces">Standard Interfaces</a></span></dt><dd><dl><dt><span class="sect2"><a href="#standard-interfaces-peer"><code class="literal">org.freedesktop.DBus.Peer</code></a></span></dt><dt><span class="sect2"><a href="#standard-interfaces-introspectable"><code class="literal">org.freedesktop.DBus.Introspectable</code></a></span></dt><dt><span class="sect2"><a href="#standard-interfaces-properties"><code class="literal">org.freedesktop.DBus.Properties</code></a></span></dt></dl></dd><dt><span class="sect1"><a href="#introspection-format">Introspection Data Format</a></span></dt><dt><span class="sect1"><a href="#message-bus">Message Bus Specification</a></span></dt><dd><dl><dt><span class="sect2"><a href="#message-bus-overview">Message Bus Overview</a></span></dt><dt><span class="sect2"><a href="#message-bus-names">Message Bus Names</a></span></dt><dt><span class="sect2"><a href="#message-bus-routing">Message Bus Message Routing</a></span></dt><dt><span class="sect2"><a href="#message-bus-starting-services">Message Bus Starting Services</a></span></dt><dt><span class="sect2"><a href="#message-bus-types">Well-known Message Bus Instances</a></span></dt><dt><span class="sect2"><a href="#message-bus-messages">Message Bus Messages</a></span></dt></dl></dd><dt><span class="glossary"><a href="#idp30208384">Glossary</a></span></dt></dl></div><div class="sect1" title="Introduction"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="introduction"></a>Introduction</h2></div></div></div><p> + </p></div></div></div></div></div><div><p class="releaseinfo">Version 0.15</p></div><div><div class="revhistory"><table border="1" width="100%" summary="Revision history"><tr><th align="left" valign="top" colspan="3"><b>Revision History</b></th></tr><tr><td align="left">Revision current</td><td align="left"><a class="ulink" href="http://cgit.freedesktop.org/dbus/dbus/log/doc/dbus-specification.xml" target="_top">commit log</a></td><td align="left"></td></tr><tr><td align="left" colspan="3"></td></tr><tr><td align="left">Revision 0.15</td><td align="left">3 November 2010</td><td align="left"></td></tr><tr><td align="left" colspan="3"></td></tr><tr><td align="left">Revision 0.14</td><td align="left">12 May 2010</td><td align="left"></td></tr><tr><td align="left" colspan="3"></td></tr><tr><td align="left">Revision 0.13</td><td align="left">23 Dezember 2009</td><td align="left"></td></tr><tr><td align="left" colspan="3"></td></tr><tr><td align="left">Revision 0.12</td><td align="left">7 November, 2006</td><td align="left"></td></tr><tr><td align="left" colspan="3"></td></tr><tr><td align="left">Revision 0.11</td><td align="left">6 February 2005</td><td align="left"></td></tr><tr><td align="left" colspan="3"></td></tr><tr><td align="left">Revision 0.10</td><td align="left">28 January 2005</td><td align="left"></td></tr><tr><td align="left" colspan="3"></td></tr><tr><td align="left">Revision 0.9</td><td align="left">7 Januar 2005</td><td align="left"></td></tr><tr><td align="left" colspan="3"></td></tr><tr><td align="left">Revision 0.8</td><td align="left">06 September 2003</td><td align="left"></td></tr><tr><td align="left" colspan="3">First released document.</td></tr></table></div></div></div><hr></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="#introduction">Introduction</a></span></dt><dd><dl><dt><span class="sect2"><a href="#stability">Protocol and Specification Stability</a></span></dt></dl></dd><dt><span class="sect1"><a href="#message-protocol">Message Protocol</a></span></dt><dd><dl><dt><span class="sect2"><a href="#message-protocol-signatures">Type Signatures</a></span></dt><dt><span class="sect2"><a href="#message-protocol-marshaling">Marshaling (Wire Format)</a></span></dt><dt><span class="sect2"><a href="#message-protocol-messages">Message Format</a></span></dt><dt><span class="sect2"><a href="#message-protocol-names">Valid Names</a></span></dt><dt><span class="sect2"><a href="#message-protocol-types">Message Types</a></span></dt><dt><span class="sect2"><a href="#message-protocol-handling-invalid">Invalid Protocol and Spec Extensions</a></span></dt></dl></dd><dt><span class="sect1"><a href="#auth-protocol">Authentication Protocol</a></span></dt><dd><dl><dt><span class="sect2"><a href="#auth-protocol-overview">Protocol Overview</a></span></dt><dt><span class="sect2"><a href="#auth-nul-byte">Special credentials-passing nul byte</a></span></dt><dt><span class="sect2"><a href="#auth-command-auth">AUTH command</a></span></dt><dt><span class="sect2"><a href="#auth-command-cancel">CANCEL Command</a></span></dt><dt><span class="sect2"><a href="#auth-command-data">DATA Command</a></span></dt><dt><span class="sect2"><a href="#auth-command-begin">BEGIN Command</a></span></dt><dt><span class="sect2"><a href="#auth-command-rejected">REJECTED Command</a></span></dt><dt><span class="sect2"><a href="#auth-command-ok">OK Command</a></span></dt><dt><span class="sect2"><a href="#auth-command-error">ERROR Command</a></span></dt><dt><span class="sect2"><a href="#auth-command-negotiate-unix-fd">NEGOTIATE_UNIX_FD Command</a></span></dt><dt><span class="sect2"><a href="#auth-command-agree-unix-fd">AGREE_UNIX_FD Command</a></span></dt><dt><span class="sect2"><a href="#auth-command-future">Future Extensions</a></span></dt><dt><span class="sect2"><a href="#auth-examples">Authentication examples</a></span></dt><dt><span class="sect2"><a href="#auth-states">Authentication state diagrams</a></span></dt><dt><span class="sect2"><a href="#auth-mechanisms">Authentication mechanisms</a></span></dt></dl></dd><dt><span class="sect1"><a href="#addresses">Server Addresses</a></span></dt><dt><span class="sect1"><a href="#transports">Transports</a></span></dt><dd><dl><dt><span class="sect2"><a href="#transports-unix-domain-sockets">Unix Domain Sockets</a></span></dt><dt><span class="sect2"><a href="#transports-launchd">launchd</a></span></dt><dt><span class="sect2"><a href="#transports-tcp-sockets">TCP Sockets</a></span></dt><dt><span class="sect2"><a href="#transports-nonce-tcp-sockets">Nonce-secured TCP Sockets</a></span></dt></dl></dd><dt><span class="sect1"><a href="#meta-transports">Meta Transports</a></span></dt><dd><dl><dt><span class="sect2"><a href="#meta-transports-autolaunch">Autolaunch</a></span></dt></dl></dd><dt><span class="sect1"><a href="#naming-conventions">Naming Conventions</a></span></dt><dt><span class="sect1"><a href="#uuids">UUIDs</a></span></dt><dt><span class="sect1"><a href="#standard-interfaces">Standard Interfaces</a></span></dt><dd><dl><dt><span class="sect2"><a href="#standard-interfaces-peer"><code class="literal">org.freedesktop.DBus.Peer</code></a></span></dt><dt><span class="sect2"><a href="#standard-interfaces-introspectable"><code class="literal">org.freedesktop.DBus.Introspectable</code></a></span></dt><dt><span class="sect2"><a href="#standard-interfaces-properties"><code class="literal">org.freedesktop.DBus.Properties</code></a></span></dt></dl></dd><dt><span class="sect1"><a href="#introspection-format">Introspection Data Format</a></span></dt><dt><span class="sect1"><a href="#message-bus">Message Bus Specification</a></span></dt><dd><dl><dt><span class="sect2"><a href="#message-bus-overview">Message Bus Overview</a></span></dt><dt><span class="sect2"><a href="#message-bus-names">Message Bus Names</a></span></dt><dt><span class="sect2"><a href="#message-bus-routing">Message Bus Message Routing</a></span></dt><dt><span class="sect2"><a href="#message-bus-starting-services">Message Bus Starting Services</a></span></dt><dt><span class="sect2"><a href="#message-bus-types">Well-known Message Bus Instances</a></span></dt><dt><span class="sect2"><a href="#message-bus-messages">Message Bus Messages</a></span></dt></dl></dd><dt><span class="glossary"><a href="#idp30208256">Glossary</a></span></dt></dl></div><div class="sect1" title="Introduction"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="introduction"></a>Introduction</h2></div></div></div><p> D-Bus is a system for low-latency, low-overhead, easy to use interprocess communication (IPC). In more detail: </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p> @@ -899,14 +899,14 @@ commands may be introduced both before, and after authentication, i.e. both before and after the OK command. </p></div><div class="sect2" title="Authentication examples"><div class="titlepage"><div><div><h3 class="title"><a name="auth-examples"></a>Authentication examples</h3></div></div></div><p> - </p><div class="figure"><a name="idp29580736"></a><p class="title"><b>Figure 1. Example of successful magic cookie authentication</b></p><div class="figure-contents"><pre class="programlisting"> + </p><div class="figure"><a name="idp29580608"></a><p class="title"><b>Figure 1. Example of successful magic cookie authentication</b></p><div class="figure-contents"><pre class="programlisting"> (MAGIC_COOKIE is a made up mechanism) C: AUTH MAGIC_COOKIE 3138363935333137393635383634 S: OK 1234deadbeef C: BEGIN </pre></div></div><p><br class="figure-break"> - </p><div class="figure"><a name="idp29582560"></a><p class="title"><b>Figure 2. Example of finding out mechanisms then picking one</b></p><div class="figure-contents"><pre class="programlisting"> + </p><div class="figure"><a name="idp29582432"></a><p class="title"><b>Figure 2. Example of finding out mechanisms then picking one</b></p><div class="figure-contents"><pre class="programlisting"> C: AUTH S: REJECTED KERBEROS_V4 SKEY C: AUTH SKEY 7ab83f32ee @@ -915,14 +915,14 @@ S: OK 1234deadbeef C: BEGIN </pre></div></div><p><br class="figure-break"> - </p><div class="figure"><a name="idp29584464"></a><p class="title"><b>Figure 3. Example of client sends unknown command then falls back to regular auth</b></p><div class="figure-contents"><pre class="programlisting"> + </p><div class="figure"><a name="idp29584336"></a><p class="title"><b>Figure 3. Example of client sends unknown command then falls back to regular auth</b></p><div class="figure-contents"><pre class="programlisting"> C: FOOBAR S: ERROR C: AUTH MAGIC_COOKIE 3736343435313230333039 S: OK 1234deadbeef C: BEGIN </pre></div></div><p><br class="figure-break"> - </p><div class="figure"><a name="idp29586352"></a><p class="title"><b>Figure 4. Example of server doesn't support initial auth mechanism</b></p><div class="figure-contents"><pre class="programlisting"> + </p><div class="figure"><a name="idp29586224"></a><p class="title"><b>Figure 4. Example of server doesn't support initial auth mechanism</b></p><div class="figure-contents"><pre class="programlisting"> C: AUTH MAGIC_COOKIE 3736343435313230333039 S: REJECTED KERBEROS_V4 SKEY C: AUTH SKEY 7ab83f32ee @@ -931,7 +931,7 @@ S: OK 1234deadbeef C: BEGIN </pre></div></div><p><br class="figure-break"> - </p><div class="figure"><a name="idp29588368"></a><p class="title"><b>Figure 5. Example of wrong password or the like followed by successful retry</b></p><div class="figure-contents"><pre class="programlisting"> + </p><div class="figure"><a name="idp29588240"></a><p class="title"><b>Figure 5. Example of wrong password or the like followed by successful retry</b></p><div class="figure-contents"><pre class="programlisting"> C: AUTH MAGIC_COOKIE 3736343435313230333039 S: REJECTED KERBEROS_V4 SKEY C: AUTH SKEY 7ab83f32ee @@ -944,7 +944,7 @@ S: OK 1234deadbeef C: BEGIN </pre></div></div><p><br class="figure-break"> - </p><div class="figure"><a name="idp29590544"></a><p class="title"><b>Figure 6. Example of skey cancelled and restarted</b></p><div class="figure-contents"><pre class="programlisting"> + </p><div class="figure"><a name="idp29590416"></a><p class="title"><b>Figure 6. Example of skey cancelled and restarted</b></p><div class="figure-contents"><pre class="programlisting"> C: AUTH MAGIC_COOKIE 3736343435313230333039 S: REJECTED KERBEROS_V4 SKEY C: AUTH SKEY 7ab83f32ee @@ -957,7 +957,7 @@ S: OK 1234deadbeef C: BEGIN </pre></div></div><p><br class="figure-break"> - </p><div class="figure"><a name="idp29592608"></a><p class="title"><b>Figure 7. Example of successful magic cookie authentication with successful negotiation of Unix FD passing</b></p><div class="figure-contents"><pre class="programlisting"> + </p><div class="figure"><a name="idp29592480"></a><p class="title"><b>Figure 7. Example of successful magic cookie authentication with successful negotiation of Unix FD passing</b></p><div class="figure-contents"><pre class="programlisting"> (MAGIC_COOKIE is a made up mechanism) C: AUTH MAGIC_COOKIE 3138363935333137393635383634 @@ -966,7 +966,7 @@ S: AGREE_UNIX_FD C: BEGIN </pre></div></div><p><br class="figure-break"> - </p><div class="figure"><a name="idp29594608"></a><p class="title"><b>Figure 8. Example of successful magic cookie authentication with unsuccessful negotiation of Unix FD passing</b></p><div class="figure-contents"><pre class="programlisting"> + </p><div class="figure"><a name="idp29594480"></a><p class="title"><b>Figure 8. Example of successful magic cookie authentication with unsuccessful negotiation of Unix FD passing</b></p><div class="figure-contents"><pre class="programlisting"> (MAGIC_COOKIE is a made up mechanism) C: AUTH MAGIC_COOKIE 3138363935333137393635383634 @@ -1244,7 +1244,7 @@ fails, the lock fails. Servers should retry for a reasonable period of time, then they may choose to delete an existing lock to keep users from having to manually delete a stale - lock. <sup>[<a name="idp29679968" href="#ftn.idp29679968" class="footnote">1</a>]</sup> + lock. <sup>[<a name="idp29679840" href="#ftn.idp29679840" class="footnote">1</a>]</sup> </p></li><li class="listitem"><p> Once the lockfile has been created, the server loads the cookie file. It should then delete any cookies that are old (the @@ -2010,7 +2010,7 @@ </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>General syntax</p></li><li class="listitem"><p>Comment format</p></li></ul></div><p> - </p><div class="figure"><a name="idp29984992"></a><p class="title"><b>Figure 9. Example service description file</b></p><div class="figure-contents"><pre class="programlisting"> + </p><div class="figure"><a name="idp29984864"></a><p class="title"><b>Figure 9. Example service description file</b></p><div class="figure-contents"><pre class="programlisting"> # Sample service description file [D-BUS Service] Names=org.freedesktop.ConfigurationDatabase;org.gnome.GConf; @@ -2180,7 +2180,7 @@ allowing another process to set the selection between the verification and the setting (e.g., by using XGrabServer / XungrabServer). - </p></div><div class="sect4"><div class="titlepage"><div><div><h5 class="title"><a name="idp30037760"></a></h5></div></div></div><p> + </p></div><div class="sect4"><div class="titlepage"><div><div><h5 class="title"><a name="idp30037632"></a></h5></div></div></div><p> [FIXME specify location of .service files, probably using DESKTOP_DIRS etc. from basedir specification, though login session bus is not really desktop-specific] @@ -2195,7 +2195,7 @@ variable. If that variable is not set, applications should try to connect to the well-known address <code class="literal">unix:path=/var/run/dbus/system_bus_socket</code>. - <sup>[<a name="idp30042784" href="#ftn.idp30042784" class="footnote">2</a>]</sup> + <sup>[<a name="idp30042656" href="#ftn.idp30042656" class="footnote">2</a>]</sup> </p><p> [FIXME specify location of system bus .service files] </p></div></div><div class="sect2" title="Message Bus Messages"><div class="titlepage"><div><div><h3 class="title"><a name="message-bus-messages"></a>Message Bus Messages</h3></div></div></div><p> @@ -2380,7 +2380,7 @@ There is also a per-machine ID, described in <a class="xref" href="#standard-interfaces-peer" title="org.freedesktop.DBus.Peer">the section called “<code class="literal">org.freedesktop.DBus.Peer</code>”</a> and returned by org.freedesktop.DBus.Peer.GetMachineId(). For a desktop session bus, the bus ID can be used as a way to uniquely identify a user's session. - </p></div></div></div><div class="glossary" title="Glossary"><div class="titlepage"><div><div><h2 class="title"><a name="idp30208384"></a>Glossary</h2></div></div></div><p> + </p></div></div></div><div class="glossary" title="Glossary"><div class="titlepage"><div><div><h2 class="title"><a name="idp30208256"></a>Glossary</h2></div></div></div><p> This glossary defines some of the terms used in this specification. </p><dl><dt><a name="term-bus-name"></a>Bus Name</dt><dd><p> The message bus maintains an association between names and @@ -2454,10 +2454,10 @@ message bus. This name will never change owner, and will be unique (never reused during the lifetime of the message bus). It will begin with a ':' character. - </p></dd></dl></div><div class="footnotes"><br><hr width="100" align="left"><div class="footnote"><p><sup>[<a name="ftn.idp29679968" href="#idp29679968" class="para">1</a>] </sup>Lockfiles are used instead of real file + </p></dd></dl></div><div class="footnotes"><br><hr width="100" align="left"><div class="footnote"><p><sup>[<a name="ftn.idp29679840" href="#idp29679840" class="para">1</a>] </sup>Lockfiles are used instead of real file locking <code class="literal">fcntl()</code> because real locking implementations are still flaky on network - filesystems.</p></div><div class="footnote"><p><sup>[<a name="ftn.idp30042784" href="#idp30042784" class="para">2</a>] </sup> + filesystems.</p></div><div class="footnote"><p><sup>[<a name="ftn.idp30042656" href="#idp30042656" class="para">2</a>] </sup> The D-Bus reference implementation actually honors the <code class="literal">$(localstatedir)</code> configure option for this address, on both client and server side. diff --git a/doc/dbus-test-plan.html b/doc/dbus-test-plan.html index 44991af2..9e9a3e13 100644 --- a/doc/dbus-test-plan.html +++ b/doc/dbus-test-plan.html @@ -38,7 +38,7 @@ Message Builder. The message builder can take a serialized message in string-form and convert it into a raw character string which can then be loaded by the message loader. - </p><div class="figure"><a name="idp24477888"></a><p class="title"><b>Figure 1. Example of a message in string form</b></p><div class="figure-contents"><pre class="programlisting"> + </p><div class="figure"><a name="idp28171248"></a><p class="title"><b>Figure 1. Example of a message in string form</b></p><div class="figure-contents"><pre class="programlisting"> # Standard org.freedesktop.DBus.Hello message VALID_HEADER @@ -75,7 +75,7 @@ can read authentication sequences from a file and play them back to a dummy server and client to make sure that authentication is working according to the specification. - </p><div class="figure"><a name="idp24484576"></a><p class="title"><b>Figure 2. Example of an authentication script</b></p><div class="figure-contents"><pre class="programlisting"> + </p><div class="figure"><a name="idp24519840"></a><p class="title"><b>Figure 2. Example of an authentication script</b></p><div class="figure-contents"><pre class="programlisting"> ## this tests a successful auth of type EXTERNAL SERVER @@ -69,7 +69,7 @@ # compiler: $LTCC # compiler flags: $LTCFLAGS # linker: $LD (gnu? $with_gnu_ld) -# $progname: (GNU libtool) 2.4 Debian-2.4-2 +# $progname: (GNU libtool) 2.4 Debian-2.4-4 # automake: $automake_version # autoconf: $autoconf_version # @@ -79,7 +79,7 @@ PROGRAM=libtool PACKAGE=libtool -VERSION="2.4 Debian-2.4-2" +VERSION="2.4 Debian-2.4-4" TIMESTAMP="" package_revision=1.3293 diff --git a/test/Makefile.am b/test/Makefile.am index c308c4bc..0981d1f0 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -97,6 +97,14 @@ shell_test_LDFLAGS=@R_DYNAMIC_LDFLAG@ spawn_test_LDADD=$(TEST_LIBS) spawn_test_LDFLAGS=@R_DYNAMIC_LDFLAG@ +test_refs_SOURCES = internals/refs.c +test_refs_CPPFLAGS = -DDBUS_STATIC_BUILD $(GLIB_CFLAGS) +test_refs_LDADD = libdbus-testutils.la $(GLIB_LIBS) $(TEST_LIBS) + +test_syslog_SOURCES = internals/syslog.c +test_syslog_CPPFLAGS = -DDBUS_STATIC_BUILD $(GLIB_CFLAGS) +test_syslog_LDADD = libdbus-testutils.la $(GLIB_LIBS) $(TEST_LIBS) + EXTRA_DIST = dbus-test-runner testexecdir = $(libdir)/dbus-1.0/test @@ -108,7 +116,9 @@ installable_tests = \ test-dbus-daemon \ test-loopback \ test-marshal \ + test-refs \ test-relay \ + test-syslog \ $(NULL) installcheck_tests = @@ -267,6 +277,8 @@ clean-local: REVERSEDIRS="$$D $$REVERSEDIRS" ; \ done ; \ for D in $$REVERSEDIRS; do \ - rmdir $(top_builddir)/test/$$D || exit 1 ; \ + rmdir $(top_builddir)/test/$$D || \ + test ! -d $(top_builddir)/test/$$D || \ + exit 1 ; \ done ; \ fi diff --git a/test/Makefile.in b/test/Makefile.in index 0deb1890..ed2cc1d8 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -80,7 +80,7 @@ am__v_lt_0 = --silent @DBUS_BUILD_TESTS_TRUE@ test-sleep-forever$(EXEEXT) am__EXEEXT_2 = test-corrupt$(EXEEXT) test-dbus-daemon$(EXEEXT) \ test-loopback$(EXEEXT) test-marshal$(EXEEXT) \ - test-relay$(EXEEXT) + test-refs$(EXEEXT) test-relay$(EXEEXT) test-syslog$(EXEEXT) @DBUS_ENABLE_INSTALLED_TESTS_FALSE@@DBUS_ENABLE_MODULAR_TESTS_TRUE@am__EXEEXT_3 = $(am__EXEEXT_2) @DBUS_ENABLE_INSTALLED_TESTS_TRUE@@DBUS_ENABLE_MODULAR_TESTS_TRUE@am__EXEEXT_4 = $(am__EXEEXT_2) am__installdirs = "$(DESTDIR)$(testexecdir)" @@ -138,6 +138,10 @@ test_names_DEPENDENCIES = libdbus-testutils.la $(am__DEPENDENCIES_2) test_names_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(test_names_LDFLAGS) $(LDFLAGS) -o $@ +am_test_refs_OBJECTS = test_refs-refs.$(OBJEXT) +test_refs_OBJECTS = $(am_test_refs_OBJECTS) +test_refs_DEPENDENCIES = libdbus-testutils.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_2) am_test_relay_OBJECTS = test_relay-relay.$(OBJEXT) test_relay_OBJECTS = $(am_test_relay_OBJECTS) test_relay_DEPENDENCIES = $(top_builddir)/dbus/libdbus-1.la \ @@ -165,6 +169,10 @@ test_shell_service_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ am_test_sleep_forever_OBJECTS = test-sleep-forever.$(OBJEXT) test_sleep_forever_OBJECTS = $(am_test_sleep_forever_OBJECTS) test_sleep_forever_LDADD = $(LDADD) +am_test_syslog_OBJECTS = test_syslog-syslog.$(OBJEXT) +test_syslog_OBJECTS = $(am_test_syslog_OBJECTS) +test_syslog_DEPENDENCIES = libdbus-testutils.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_2) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles @@ -195,16 +203,18 @@ SOURCES = $(libdbus_testutils_la_SOURCES) $(shell_test_SOURCES) \ $(spawn_test_SOURCES) $(test_corrupt_SOURCES) \ $(test_dbus_daemon_SOURCES) $(test_exit_SOURCES) \ $(test_loopback_SOURCES) $(test_marshal_SOURCES) \ - $(test_names_SOURCES) $(test_relay_SOURCES) \ - $(test_segfault_SOURCES) $(test_service_SOURCES) \ - $(test_shell_service_SOURCES) $(test_sleep_forever_SOURCES) + $(test_names_SOURCES) $(test_refs_SOURCES) \ + $(test_relay_SOURCES) $(test_segfault_SOURCES) \ + $(test_service_SOURCES) $(test_shell_service_SOURCES) \ + $(test_sleep_forever_SOURCES) $(test_syslog_SOURCES) DIST_SOURCES = $(libdbus_testutils_la_SOURCES) $(shell_test_SOURCES) \ $(spawn_test_SOURCES) $(test_corrupt_SOURCES) \ $(test_dbus_daemon_SOURCES) $(test_exit_SOURCES) \ $(test_loopback_SOURCES) $(test_marshal_SOURCES) \ - $(test_names_SOURCES) $(test_relay_SOURCES) \ - $(test_segfault_SOURCES) $(test_service_SOURCES) \ - $(test_shell_service_SOURCES) $(test_sleep_forever_SOURCES) + $(test_names_SOURCES) $(test_refs_SOURCES) \ + $(test_relay_SOURCES) $(test_segfault_SOURCES) \ + $(test_service_SOURCES) $(test_shell_service_SOURCES) \ + $(test_sleep_forever_SOURCES) $(test_syslog_SOURCES) RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ @@ -367,6 +377,11 @@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ +PYTHON = @PYTHON@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ RC = @RC@ R_DYNAMIC_LDFLAG = @R_DYNAMIC_LDFLAG@ @@ -438,9 +453,13 @@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -506,6 +525,12 @@ shell_test_LDADD = libdbus-testutils.la $(TEST_LIBS) shell_test_LDFLAGS = @R_DYNAMIC_LDFLAG@ spawn_test_LDADD = $(TEST_LIBS) spawn_test_LDFLAGS = @R_DYNAMIC_LDFLAG@ +test_refs_SOURCES = internals/refs.c +test_refs_CPPFLAGS = -DDBUS_STATIC_BUILD $(GLIB_CFLAGS) +test_refs_LDADD = libdbus-testutils.la $(GLIB_LIBS) $(TEST_LIBS) +test_syslog_SOURCES = internals/syslog.c +test_syslog_CPPFLAGS = -DDBUS_STATIC_BUILD $(GLIB_CFLAGS) +test_syslog_LDADD = libdbus-testutils.la $(GLIB_LIBS) $(TEST_LIBS) EXTRA_DIST = dbus-test-runner testexecdir = $(libdir)/dbus-1.0/test installable_tests = \ @@ -513,7 +538,9 @@ installable_tests = \ test-dbus-daemon \ test-loopback \ test-marshal \ + test-refs \ test-relay \ + test-syslog \ $(NULL) installcheck_tests = $(am__append_3) @@ -709,6 +736,9 @@ test-marshal$(EXEEXT): $(test_marshal_OBJECTS) $(test_marshal_DEPENDENCIES) test-names$(EXEEXT): $(test_names_OBJECTS) $(test_names_DEPENDENCIES) @rm -f test-names$(EXEEXT) $(AM_V_CCLD)$(test_names_LINK) $(test_names_OBJECTS) $(test_names_LDADD) $(LIBS) +test-refs$(EXEEXT): $(test_refs_OBJECTS) $(test_refs_DEPENDENCIES) + @rm -f test-refs$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_refs_OBJECTS) $(test_refs_LDADD) $(LIBS) test-relay$(EXEEXT): $(test_relay_OBJECTS) $(test_relay_DEPENDENCIES) @rm -f test-relay$(EXEEXT) $(AM_V_CCLD)$(test_relay_LINK) $(test_relay_OBJECTS) $(test_relay_LDADD) $(LIBS) @@ -724,6 +754,9 @@ test-shell-service$(EXEEXT): $(test_shell_service_OBJECTS) $(test_shell_service_ test-sleep-forever$(EXEEXT): $(test_sleep_forever_OBJECTS) $(test_sleep_forever_DEPENDENCIES) @rm -f test-sleep-forever$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_sleep_forever_OBJECTS) $(test_sleep_forever_LDADD) $(LIBS) +test-syslog$(EXEEXT): $(test_syslog_OBJECTS) $(test_syslog_DEPENDENCIES) + @rm -f test-syslog$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_syslog_OBJECTS) $(test_syslog_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -744,7 +777,9 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_dbus_daemon-dbus-daemon.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_loopback-loopback.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_marshal-marshal.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_refs-refs.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_relay-relay.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_syslog-syslog.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @@ -834,6 +869,22 @@ test_marshal-marshal.obj: marshal.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_marshal_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o test_marshal-marshal.obj `if test -f 'marshal.c'; then $(CYGPATH_W) 'marshal.c'; else $(CYGPATH_W) '$(srcdir)/marshal.c'; fi` +test_refs-refs.o: internals/refs.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_refs_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT test_refs-refs.o -MD -MP -MF $(DEPDIR)/test_refs-refs.Tpo -c -o test_refs-refs.o `test -f 'internals/refs.c' || echo '$(srcdir)/'`internals/refs.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_refs-refs.Tpo $(DEPDIR)/test_refs-refs.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='internals/refs.c' object='test_refs-refs.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_refs_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o test_refs-refs.o `test -f 'internals/refs.c' || echo '$(srcdir)/'`internals/refs.c + +test_refs-refs.obj: internals/refs.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_refs_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT test_refs-refs.obj -MD -MP -MF $(DEPDIR)/test_refs-refs.Tpo -c -o test_refs-refs.obj `if test -f 'internals/refs.c'; then $(CYGPATH_W) 'internals/refs.c'; else $(CYGPATH_W) '$(srcdir)/internals/refs.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_refs-refs.Tpo $(DEPDIR)/test_refs-refs.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='internals/refs.c' object='test_refs-refs.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_refs_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o test_refs-refs.obj `if test -f 'internals/refs.c'; then $(CYGPATH_W) 'internals/refs.c'; else $(CYGPATH_W) '$(srcdir)/internals/refs.c'; fi` + test_relay-relay.o: relay.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_relay_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT test_relay-relay.o -MD -MP -MF $(DEPDIR)/test_relay-relay.Tpo -c -o test_relay-relay.o `test -f 'relay.c' || echo '$(srcdir)/'`relay.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_relay-relay.Tpo $(DEPDIR)/test_relay-relay.Po @@ -850,6 +901,22 @@ test_relay-relay.obj: relay.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_relay_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o test_relay-relay.obj `if test -f 'relay.c'; then $(CYGPATH_W) 'relay.c'; else $(CYGPATH_W) '$(srcdir)/relay.c'; fi` +test_syslog-syslog.o: internals/syslog.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_syslog_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT test_syslog-syslog.o -MD -MP -MF $(DEPDIR)/test_syslog-syslog.Tpo -c -o test_syslog-syslog.o `test -f 'internals/syslog.c' || echo '$(srcdir)/'`internals/syslog.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_syslog-syslog.Tpo $(DEPDIR)/test_syslog-syslog.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='internals/syslog.c' object='test_syslog-syslog.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_syslog_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o test_syslog-syslog.o `test -f 'internals/syslog.c' || echo '$(srcdir)/'`internals/syslog.c + +test_syslog-syslog.obj: internals/syslog.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_syslog_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT test_syslog-syslog.obj -MD -MP -MF $(DEPDIR)/test_syslog-syslog.Tpo -c -o test_syslog-syslog.obj `if test -f 'internals/syslog.c'; then $(CYGPATH_W) 'internals/syslog.c'; else $(CYGPATH_W) '$(srcdir)/internals/syslog.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_syslog-syslog.Tpo $(DEPDIR)/test_syslog-syslog.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='internals/syslog.c' object='test_syslog-syslog.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_syslog_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o test_syslog-syslog.obj `if test -f 'internals/syslog.c'; then $(CYGPATH_W) 'internals/syslog.c'; else $(CYGPATH_W) '$(srcdir)/internals/syslog.c'; fi` + mostlyclean-libtool: -rm -f *.lo @@ -1337,7 +1404,9 @@ clean-local: REVERSEDIRS="$$D $$REVERSEDIRS" ; \ done ; \ for D in $$REVERSEDIRS; do \ - rmdir $(top_builddir)/test/$$D || exit 1 ; \ + rmdir $(top_builddir)/test/$$D || \ + test ! -d $(top_builddir)/test/$$D || \ + exit 1 ; \ done ; \ fi diff --git a/test/data/valid-config-files/session.conf b/test/data/valid-config-files/session.conf deleted file mode 100644 index dde5ef6b..00000000 --- a/test/data/valid-config-files/session.conf +++ /dev/null @@ -1,63 +0,0 @@ -<!-- This configuration file controls the per-user-login-session message bus. - Add a session-local.conf and edit that rather than changing this - file directly. --> - -<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-Bus Bus Configuration 1.0//EN" - "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"> -<busconfig> - <!-- Our well-known bus type, don't change this --> - <type>session</type> - - <!-- If we fork, keep the user's original umask to avoid affecting - the behavior of child processes. --> - <keep_umask/> - - <listen>unix:tmpdir=/tmp</listen> - - <standard_session_servicedirs /> - - <policy context="default"> - <!-- Allow everything to be sent --> - <allow send_destination="*" eavesdrop="true"/> - <!-- Allow everything to be received --> - <allow eavesdrop="true"/> - <!-- Allow anyone to own anything --> - <allow own="*"/> - </policy> - - <!-- Config files are placed here that among other things, - further restrict the above policy for specific services. --> - <includedir>session.d</includedir> - - <!-- This is included last so local configuration can override what's - in this standard file --> - <include ignore_missing="yes">session-local.conf</include> - - <include if_selinux_enabled="yes" selinux_root_relative="yes">contexts/dbus_contexts</include> - - <!-- For the session bus, override the default relatively-low limits - with essentially infinite limits, since the bus is just running - as the user anyway, using up bus resources is not something we need - to worry about. In some cases, we do set the limits lower than - "all available memory" if exceeding the limit is almost certainly a bug, - having the bus enforce a limit is nicer than a huge memory leak. But the - intent is that these limits should never be hit. --> - - <!-- the memory limits are 1G instead of say 4G because they can't exceed 32-bit signed int max --> - <limit name="max_incoming_bytes">1000000000</limit> - <limit name="max_incoming_unix_fds">250000000</limit> - <limit name="max_outgoing_bytes">1000000000</limit> - <limit name="max_outgoing_unix_fds">250000000</limit> - <limit name="max_message_size">1000000000</limit> - <limit name="max_message_unix_fds">4096</limit> - <limit name="service_start_timeout">120000</limit> - <limit name="auth_timeout">240000</limit> - <limit name="max_completed_connections">100000</limit> - <limit name="max_incomplete_connections">10000</limit> - <limit name="max_connections_per_user">100000</limit> - <limit name="max_pending_service_starts">10000</limit> - <limit name="max_names_per_connection">50000</limit> - <limit name="max_match_rules_per_connection">50000</limit> - <limit name="max_replies_per_connection">50000</limit> - -</busconfig> diff --git a/test/data/valid-config-files/system.conf b/test/data/valid-config-files/system.conf deleted file mode 100644 index 828fd032..00000000 --- a/test/data/valid-config-files/system.conf +++ /dev/null @@ -1,83 +0,0 @@ -<!-- This configuration file controls the systemwide message bus. - Add a system-local.conf and edit that rather than changing this - file directly. --> - -<!-- Note that there are any number of ways you can hose yourself - security-wise by screwing up this file; in particular, you - probably don't want to listen on any more addresses, add any more - auth mechanisms, run as a different user, etc. --> - -<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-Bus Bus Configuration 1.0//EN" - "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"> -<busconfig> - - <!-- Our well-known bus type, do not change this --> - <type>system</type> - - <!-- Run as special user --> - <user>messagebus</user> - - <!-- Fork into daemon mode --> - <fork/> - - <!-- We use system service launching using a helper --> - <standard_system_servicedirs/> - - <!-- This is a setuid helper that is used to launch system services --> - <servicehelper>/usr/local/libexec/dbus-daemon-launch-helper</servicehelper> - - <!-- Write a pid file --> - <pidfile>/usr/local/var/run/dbus/pid</pidfile> - - <!-- Enable logging to syslog --> - <syslog/> - - <!-- Only allow socket-credentials-based authentication --> - <auth>EXTERNAL</auth> - - <!-- Only listen on a local socket. (abstract=/path/to/socket - means use abstract namespace, don't really create filesystem - file; only Linux supports this. Use path=/whatever on other - systems.) --> - <listen>unix:path=/usr/local/var/run/dbus/system_bus_socket</listen> - - <policy context="default"> - <!-- All users can connect to system bus --> - <allow user="*"/> - - <!-- Holes must be punched in service configuration files for - name ownership and sending method calls --> - <deny own="*"/> - <deny send_type="method_call"/> - - <!-- Signals and reply messages (method returns, errors) are allowed - by default --> - <allow send_type="signal"/> - <allow send_requested_reply="true" send_type="method_return"/> - <allow send_requested_reply="true" send_type="error"/> - - <!-- All messages may be received by default --> - <allow receive_type="method_call"/> - <allow receive_type="method_return"/> - <allow receive_type="error"/> - <allow receive_type="signal"/> - - <!-- Allow anyone to talk to the message bus --> - <allow send_destination="org.freedesktop.DBus"/> - <!-- But disallow some specific bus services --> - <deny send_destination="org.freedesktop.DBus" - send_interface="org.freedesktop.DBus" - send_member="UpdateActivationEnvironment"/> - </policy> - - <!-- Config files are placed here that among other things, punch - holes in the above policy for specific services. --> - <includedir>system.d</includedir> - - <!-- This is included last so local configuration can override what's - in this standard file --> - <include ignore_missing="yes">system-local.conf</include> - - <include if_selinux_enabled="yes" selinux_root_relative="yes">contexts/dbus_contexts</include> - -</busconfig> diff --git a/test/dbus-daemon.c b/test/dbus-daemon.c index ed10d098..e192c68f 100644 --- a/test/dbus-daemon.c +++ b/test/dbus-daemon.c @@ -34,6 +34,7 @@ #include <string.h> #ifdef DBUS_WIN +# include <io.h> # include <windows.h> #else # include <signal.h> @@ -44,7 +45,7 @@ typedef struct { DBusError e; GError *ge; - gint daemon_pid; + GPid daemon_pid; DBusConnection *left_conn; @@ -66,7 +67,7 @@ _assert_no_error (const DBusError *e, static gchar * spawn_dbus_daemon (gchar *binary, gchar *configuration, - gint *daemon_pid) + GPid *daemon_pid) { GError *error = NULL; GString *address; diff --git a/test/internals/refs.c b/test/internals/refs.c new file mode 100644 index 00000000..3d21c894 --- /dev/null +++ b/test/internals/refs.c @@ -0,0 +1,613 @@ +/* Regression test for thread-safe reference-counting + * + * Author: Simon McVittie <simon.mcvittie@collabora.co.uk> + * Copyright © 2011 Nokia Corporation + * + * 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 <glib.h> + +#define DBUS_COMPILATION /* this test uses libdbus-internal */ +#include <dbus/dbus.h> +#include <dbus/dbus-connection-internal.h> +#include <dbus/dbus-mainloop.h> +#include <dbus/dbus-message-internal.h> +#include <dbus/dbus-pending-call-internal.h> +#include <dbus/dbus-server-protected.h> +#include "test-utils.h" + +static void +assert_no_error (const DBusError *e) +{ + if (G_UNLIKELY (dbus_error_is_set (e))) + g_error ("expected success but got error: %s: %s", e->name, e->message); +} + +#define N_THREADS 200 +#define N_REFS 10000 +G_STATIC_ASSERT (((unsigned) N_THREADS * (unsigned) N_REFS) < G_MAXINT32); + +static dbus_int32_t connection_slot = -1; +static dbus_int32_t server_slot = -1; +static dbus_int32_t message_slot = -1; +static dbus_int32_t pending_call_slot = -1; + +typedef struct { + DBusError e; + DBusLoop *loop; + DBusServer *server; + DBusConnection *connection; + DBusConnection *server_connection; + DBusMessage *message; + GThread *threads[N_THREADS]; + gboolean last_unref; +} Fixture; + +typedef void *(*RefFunc) (void *); +typedef void (*VoidFunc) (void *); + +typedef struct { + void *thing; + RefFunc ref; + VoidFunc ref_void; + VoidFunc unref; + void *mutex; + VoidFunc lock; + VoidFunc unlock; +} Thread; + +static gpointer +ref_thread (gpointer data) +{ + Thread *thread = data; + int i; + + for (i = 0; i < N_REFS; i++) + { + if (thread->lock != NULL) + (thread->lock) (thread->mutex); + + if (thread->ref != NULL) + { + gpointer ret = (thread->ref) (thread->thing); + + g_assert (ret == thread->thing); + } + else + { + (thread->ref_void) (thread->thing); + } + + if (thread->unlock != NULL) + (thread->unlock) (thread->mutex); + } + + return NULL; +} + +static gpointer +cycle_thread (gpointer data) +{ + Thread *thread = data; + int i; + + for (i = 0; i < N_REFS; i++) + { + if (thread->lock != NULL) + (thread->lock) (thread->mutex); + + if (thread->ref != NULL) + { + gpointer ret = (thread->ref) (thread->thing); + + g_assert (ret == thread->thing); + } + else + { + (thread->ref_void) (thread->thing); + } + + (thread->unref) (thread->thing); + + if (thread->unlock != NULL) + (thread->unlock) (thread->mutex); + } + + return NULL; +} + +static gpointer +unref_thread (gpointer data) +{ + Thread *thread = data; + int i; + + for (i = 0; i < N_REFS; i++) + { + if (thread->lock != NULL) + (thread->lock) (thread->mutex); + + (thread->unref) (thread->thing); + + if (thread->unlock != NULL) + (thread->unlock) (thread->mutex); + } + + return NULL; +} + +static void +last_unref (void *data) +{ + Fixture *f = data; + + g_assert (!f->last_unref); + f->last_unref = TRUE; +} + +static void +wait_for_all_threads (Fixture *f) +{ + int i; + + for (i = 0; i < N_THREADS; i++) + g_thread_join (f->threads[i]); +} + +static void +new_conn_cb (DBusServer *server, + DBusConnection *server_connection, + void *data) +{ + Fixture *f = data; + dbus_bool_t have_mem; + + g_assert (f->server_connection == NULL); + f->server_connection = dbus_connection_ref (server_connection); + + test_connection_setup (f->loop, f->server_connection); +} + +static void +setup (Fixture *f, + gconstpointer data) +{ + if (!dbus_threads_init_default ()) + g_error ("OOM"); + + f->loop = _dbus_loop_new (); + g_assert (f->loop != NULL); + + dbus_error_init (&f->e); + + f->server = dbus_server_listen ("tcp:host=127.0.0.1", &f->e); + assert_no_error (&f->e); + g_assert (f->server != NULL); + + if (!dbus_connection_allocate_data_slot (&connection_slot)) + g_error ("OOM"); + + if (!dbus_server_allocate_data_slot (&server_slot)) + g_error ("OOM"); + + if (!dbus_message_allocate_data_slot (&message_slot)) + g_error ("OOM"); + + if (!dbus_pending_call_allocate_data_slot (&pending_call_slot)) + g_error ("OOM"); +} + +static void +setup_connection (Fixture *f, + gconstpointer data) +{ + char *address; + + setup (f, data); + + dbus_server_set_new_connection_function (f->server, + new_conn_cb, f, NULL); + + if (!test_server_setup (f->loop, f->server)) + g_error ("failed to set up server"); + + address = dbus_server_get_address (f->server); + g_assert (address != NULL); + f->connection = dbus_connection_open_private (address, &f->e); + assert_no_error (&f->e); + g_assert (f->connection != NULL); + dbus_free (address); + + if (!test_connection_setup (f->loop, f->connection)) + g_error ("failed to set up connection"); + + while (f->server_connection == NULL) + _dbus_loop_iterate (f->loop, TRUE); + + test_connection_shutdown (f->loop, f->connection); + test_server_shutdown (f->loop, f->server); +} + +static void +test_connection (Fixture *f, + gconstpointer data) +{ + Thread public_api = { f->connection, + (RefFunc) dbus_connection_ref, + NULL, + (VoidFunc) dbus_connection_unref, + NULL, + NULL, + NULL }; + Thread internal_api = { f->connection, + (RefFunc) _dbus_connection_ref_unlocked, + NULL, + (VoidFunc) _dbus_connection_unref_unlocked, + f->connection, + (VoidFunc) _dbus_connection_lock, + (VoidFunc) _dbus_connection_unlock }; + int i; + + /* Use a slot as a pseudo-weakref */ + if (!dbus_connection_set_data (f->connection, connection_slot, f, + last_unref)) + g_error ("OOM"); + + for (i = 0; i < N_THREADS; i++) + { + if ((i % 2) == 0) + f->threads[i] = g_thread_create (ref_thread, &public_api, TRUE, NULL); + else + f->threads[i] = g_thread_create (ref_thread, &internal_api, TRUE, + NULL); + + g_assert (f->threads[i] != NULL); + } + + wait_for_all_threads (f); + + for (i = 0; i < N_THREADS; i++) + { + if ((i % 2) == 0) + f->threads[i] = g_thread_create (cycle_thread, &public_api, TRUE, + NULL); + else + f->threads[i] = g_thread_create (cycle_thread, &internal_api, TRUE, + NULL); + + g_assert (f->threads[i] != NULL); + } + + wait_for_all_threads (f); + + for (i = 0; i < N_THREADS; i++) + { + if ((i % 2) == 0) + f->threads[i] = g_thread_create (unref_thread, &public_api, TRUE, + NULL); + else + f->threads[i] = g_thread_create (unref_thread, &internal_api, TRUE, + NULL); + + g_assert (f->threads[i] != NULL); + } + + wait_for_all_threads (f); + + /* Destroy the connection. This should be the last-unref. */ + g_assert (!f->last_unref); + dbus_connection_close (f->connection); + dbus_connection_unref (f->connection); + f->connection = NULL; + g_assert (f->last_unref); +} + +static void +server_lock (void *server) +{ + SERVER_LOCK (((DBusServer *) server)); +} + +static void +server_unlock (void *server) +{ + SERVER_UNLOCK (((DBusServer *) server)); +} + +static void +test_server (Fixture *f, + gconstpointer data) +{ + Thread public_api = { f->server, + (RefFunc) dbus_server_ref, + NULL, + (VoidFunc) dbus_server_unref, + NULL, + NULL, + NULL }; + Thread internal_api = { f->server, + NULL, + (VoidFunc) _dbus_server_ref_unlocked, + (VoidFunc) _dbus_server_unref_unlocked, + f->server, + server_lock, + server_unlock }; + int i; + + if (!dbus_server_set_data (f->server, server_slot, f, last_unref)) + g_error ("OOM"); + + for (i = 0; i < N_THREADS; i++) + { + if ((i % 2) == 0) + f->threads[i] = g_thread_create (ref_thread, &public_api, TRUE, NULL); + else + f->threads[i] = g_thread_create (ref_thread, &internal_api, TRUE, + NULL); + + g_assert (f->threads[i] != NULL); + } + + wait_for_all_threads (f); + + for (i = 0; i < N_THREADS; i++) + { + if ((i % 2) == 0) + f->threads[i] = g_thread_create (cycle_thread, &public_api, TRUE, + NULL); + else + f->threads[i] = g_thread_create (cycle_thread, &internal_api, TRUE, + NULL); + + g_assert (f->threads[i] != NULL); + } + + wait_for_all_threads (f); + + for (i = 0; i < N_THREADS; i++) + { + if ((i % 2) == 0) + f->threads[i] = g_thread_create (unref_thread, &public_api, TRUE, + NULL); + else + f->threads[i] = g_thread_create (unref_thread, &internal_api, TRUE, + NULL); + + g_assert (f->threads[i] != NULL); + } + + wait_for_all_threads (f); + + /* Destroy the server. This should be the last-unref. */ + g_assert (!f->last_unref); + dbus_server_disconnect (f->server); + dbus_server_unref (f->server); + f->server = NULL; + g_assert (f->last_unref); +} + +static void +test_message (Fixture *f, + gconstpointer data) +{ + DBusMessage *message = dbus_message_new_signal ("/foo", "foo.bar.baz", + "Foo"); + Thread public_api = { message, + (RefFunc) dbus_message_ref, + NULL, + (VoidFunc) dbus_message_unref, + NULL, + NULL, + NULL }; + int i; + + if (!dbus_message_set_data (message, message_slot, f, last_unref)) + g_error ("OOM"); + + for (i = 0; i < N_THREADS; i++) + { + f->threads[i] = g_thread_create (ref_thread, &public_api, TRUE, NULL); + g_assert (f->threads[i] != NULL); + } + + wait_for_all_threads (f); + + for (i = 0; i < N_THREADS; i++) + { + f->threads[i] = g_thread_create (cycle_thread, &public_api, TRUE, NULL); + g_assert (f->threads[i] != NULL); + } + + wait_for_all_threads (f); + + for (i = 0; i < N_THREADS; i++) + { + f->threads[i] = g_thread_create (unref_thread, &public_api, TRUE, NULL); + g_assert (f->threads[i] != NULL); + } + + wait_for_all_threads (f); + + /* Destroy the server. This should be the last-unref. */ + g_assert (!f->last_unref); + dbus_message_unref (message); + g_assert (f->last_unref); +} + +static void +test_pending_call (Fixture *f, + gconstpointer data) +{ + Thread public_api = { NULL, + (RefFunc) dbus_pending_call_ref, + NULL, + (VoidFunc) dbus_pending_call_unref, + NULL, + NULL, + NULL }; + Thread internal_api = { NULL, + (RefFunc) _dbus_pending_call_ref_unlocked, + NULL, + (VoidFunc) dbus_pending_call_unref, + f->connection, + (VoidFunc) _dbus_connection_lock, + (VoidFunc) _dbus_connection_unlock }; + /* This one can't be used to ref, only to cycle or unref. */ + Thread unref_and_unlock_api = { NULL, + (RefFunc) _dbus_pending_call_ref_unlocked, + NULL, + (VoidFunc) _dbus_pending_call_unref_and_unlock, + f->connection, + (VoidFunc) _dbus_connection_lock, + NULL }; + int i; + DBusPendingCall *pending_call; + + _dbus_connection_lock (f->connection); + pending_call = _dbus_pending_call_new_unlocked (f->connection, + DBUS_TIMEOUT_INFINITE, NULL); + g_assert (pending_call != NULL); + _dbus_connection_unlock (f->connection); + + public_api.thing = pending_call; + internal_api.thing = pending_call; + unref_and_unlock_api.thing = pending_call; + + if (!dbus_pending_call_set_data (pending_call, pending_call_slot, f, + last_unref)) + g_error ("OOM"); + + for (i = 0; i < N_THREADS; i++) + { + if ((i % 2) == 0) + f->threads[i] = g_thread_create (ref_thread, &public_api, TRUE, NULL); + else + f->threads[i] = g_thread_create (ref_thread, &internal_api, TRUE, + NULL); + + g_assert (f->threads[i] != NULL); + } + + wait_for_all_threads (f); + + for (i = 0; i < N_THREADS; i++) + { + switch (i % 3) + { + case 0: + f->threads[i] = g_thread_create (cycle_thread, &public_api, TRUE, + NULL); + break; + case 1: + f->threads[i] = g_thread_create (cycle_thread, &internal_api, TRUE, + NULL); + break; + default: + f->threads[i] = g_thread_create (cycle_thread, + &unref_and_unlock_api, TRUE, NULL); + } + + g_assert (f->threads[i] != NULL); + } + + wait_for_all_threads (f); + + for (i = 0; i < N_THREADS; i++) + { + switch (i % 3) + { + case 0: + f->threads[i] = g_thread_create (unref_thread, &public_api, TRUE, + NULL); + break; + case 1: + f->threads[i] = g_thread_create (unref_thread, &internal_api, TRUE, + NULL); + break; + default: + f->threads[i] = g_thread_create (unref_thread, + &unref_and_unlock_api, TRUE, NULL); + } + + g_assert (f->threads[i] != NULL); + } + + wait_for_all_threads (f); + + /* Destroy the pending call. This should be the last-unref. */ + g_assert (!f->last_unref); + dbus_pending_call_unref (pending_call); + g_assert (f->last_unref); +} + +static void +teardown (Fixture *f, + gconstpointer data) +{ + if (f->server_connection != NULL) + { + dbus_connection_close (f->server_connection); + dbus_connection_unref (f->server_connection); + } + + if (f->connection != NULL) + { + dbus_connection_close (f->connection); + dbus_connection_unref (f->connection); + } + + if (f->server != NULL) + { + dbus_server_disconnect (f->server); + dbus_server_unref (f->server); + } + + dbus_connection_free_data_slot (&connection_slot); + dbus_server_free_data_slot (&server_slot); + dbus_message_free_data_slot (&message_slot); + dbus_pending_call_free_data_slot (&pending_call_slot); + + _dbus_loop_unref (f->loop); + dbus_error_free (&f->e); +} + +int +main (int argc, + char **argv) +{ + g_thread_init (NULL); + g_test_init (&argc, &argv, NULL); + g_test_bug_base ("https://bugs.freedesktop.org/show_bug.cgi?id="); + + g_test_add ("/refs/connection", Fixture, NULL, setup_connection, + test_connection, teardown); + g_test_add ("/refs/message", Fixture, NULL, setup, + test_message, teardown); + g_test_add ("/refs/pending-call", Fixture, NULL, setup_connection, + test_pending_call, teardown); + g_test_add ("/refs/server", Fixture, NULL, setup, + test_server, teardown); + + return g_test_run (); +} diff --git a/test/internals/syslog.c b/test/internals/syslog.c new file mode 100644 index 00000000..4f6b7c22 --- /dev/null +++ b/test/internals/syslog.c @@ -0,0 +1,100 @@ +/* Manual regression test for syslog support + * + * Author: Simon McVittie <simon.mcvittie@collabora.co.uk> + * Copyright © 2011 Nokia Corporation + * + * 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 <stdlib.h> + +#include <glib.h> + +#define DBUS_COMPILATION /* this test uses libdbus-internal */ +#include <dbus/dbus.h> +#include <dbus/dbus-sysdeps.h> + +typedef struct { + int dummy; +} Fixture; + +static void +setup (Fixture *f, + gconstpointer data) +{ +} + +/* hopefully clear enough that people don't think these messages in syslog + * are a bug */ +#define MESSAGE "regression test for _dbus_system_log(): " + +static void +test_syslog (Fixture *f, + gconstpointer data) +{ + if (g_test_trap_fork (0, 0)) + { + _dbus_init_system_log (); + _dbus_system_log (DBUS_SYSTEM_LOG_FATAL, MESSAGE "%d", 23); + /* should not be reached: exit 0 so the assertion in the main process + * will fail */ + exit (0); + } + + g_test_trap_assert_failed (); + g_test_trap_assert_stderr ("*" MESSAGE "23\n*"); + + if (g_test_trap_fork (0, 0)) + { + _dbus_init_system_log (); + _dbus_system_log (DBUS_SYSTEM_LOG_INFO, MESSAGE "%d", 42); + _dbus_system_log (DBUS_SYSTEM_LOG_SECURITY, MESSAGE "%d", 666); + exit (0); + } + + g_test_trap_assert_passed (); + g_test_trap_assert_stderr ("*" MESSAGE "42\n*" MESSAGE "666\n*"); + + /* manual test (this is the best we can do on Windows) */ + _dbus_init_system_log (); + _dbus_system_log (DBUS_SYSTEM_LOG_INFO, MESSAGE "%d", 42); + _dbus_system_log (DBUS_SYSTEM_LOG_SECURITY, MESSAGE "%d", 666); +} + +static void +teardown (Fixture *f, + gconstpointer data) +{ +} + +int +main (int argc, + char **argv) +{ + g_test_init (&argc, &argv, NULL); + g_test_bug_base ("https://bugs.freedesktop.org/show_bug.cgi?id="); + + g_test_add ("/syslog", Fixture, NULL, setup, test_syslog, teardown); + + return g_test_run (); +} diff --git a/test/name-test/Makefile.am b/test/name-test/Makefile.am index 5f11f0be..45c21d46 100644 --- a/test/name-test/Makefile.am +++ b/test/name-test/Makefile.am @@ -4,7 +4,7 @@ INCLUDES=-I$(top_srcdir) $(DBUS_CLIENT_CFLAGS) $(DBUS_GLIB_CFLAGS) $(DBUS_TEST_C ## so if adding tests not to be run in make check, don't add them to ## TESTS if DBUS_BUILD_TESTS -TESTS_ENVIRONMENT=DBUS_TOP_BUILDDIR=@abs_top_builddir@ DBUS_TOP_SRCDIR=@abs_top_srcdir@ +TESTS_ENVIRONMENT=DBUS_TOP_BUILDDIR=@abs_top_builddir@ DBUS_TOP_SRCDIR=@abs_top_srcdir@ PYTHON=@PYTHON@ TESTS=run-test.sh run-test-systemserver.sh else TESTS= diff --git a/test/name-test/Makefile.in b/test/name-test/Makefile.in index ca488449..69360109 100644 --- a/test/name-test/Makefile.in +++ b/test/name-test/Makefile.in @@ -310,6 +310,11 @@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ +PYTHON = @PYTHON@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ RC = @RC@ R_DYNAMIC_LDFLAG = @R_DYNAMIC_LDFLAG@ @@ -381,9 +386,13 @@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -394,7 +403,7 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ INCLUDES = -I$(top_srcdir) $(DBUS_CLIENT_CFLAGS) $(DBUS_GLIB_CFLAGS) $(DBUS_TEST_CFLAGS) -DDBUS_COMPILATION -@DBUS_BUILD_TESTS_TRUE@TESTS_ENVIRONMENT = DBUS_TOP_BUILDDIR=@abs_top_builddir@ DBUS_TOP_SRCDIR=@abs_top_srcdir@ +@DBUS_BUILD_TESTS_TRUE@TESTS_ENVIRONMENT = DBUS_TOP_BUILDDIR=@abs_top_builddir@ DBUS_TOP_SRCDIR=@abs_top_srcdir@ PYTHON=@PYTHON@ EXTRA_DIST = run-test.sh run-test-systemserver.sh test-wait-for-echo.py test-activation-forking.py @DBUS_BUILD_TESTS_TRUE@AM_CPPFLAGS = -DDBUS_STATIC_BUILD @DBUS_BUILD_TESTS_TRUE@test_pending_call_dispatch_SOURCES = \ diff --git a/test/name-test/run-test-systemserver.sh b/test/name-test/run-test-systemserver.sh index d3b8d557..afd1f045 100755 --- a/test/name-test/run-test-systemserver.sh +++ b/test/name-test/run-test-systemserver.sh @@ -41,10 +41,11 @@ if ! grep -q 'DBus.Error' echo-error-output.tmp; then fi echo "running test echo signal" -if ! python $DBUS_TOP_SRCDIR/test/name-test/test-wait-for-echo.py; then +if test "x$PYTHON" = "x:"; then + echo "Skipped test-echo-signal: Python interpreter not found" +elif ! $PYTHON $DBUS_TOP_SRCDIR/test/name-test/test-wait-for-echo.py; then echo "Failed test-wait-for-echo" exit 1 fi - exit 0 diff --git a/test/name-test/run-test.sh b/test/name-test/run-test.sh index a70055bb..cad5937e 100755 --- a/test/name-test/run-test.sh +++ b/test/name-test/run-test.sh @@ -49,7 +49,9 @@ echo "running test-shutdown" ${DBUS_TOP_BUILDDIR}/libtool --mode=execute $DEBUG $DBUS_TOP_BUILDDIR/test/name-test/test-shutdown || die "test-shutdown failed" echo "running test activation forking" -if ! python $DBUS_TOP_SRCDIR/test/name-test/test-activation-forking.py; then +if test "x$PYTHON" = "x:"; then + echo "Skipped test-activation-forking: Python interpreter not found" +elif ! $PYTHON $DBUS_TOP_SRCDIR/test/name-test/test-activation-forking.py; then echo "Failed test-activation-forking" exit 1 fi diff --git a/test/relay.c b/test/relay.c index bad39f47..f4129d0a 100644 --- a/test/relay.c +++ b/test/relay.c @@ -137,12 +137,15 @@ test_connect (Fixture *f, gconstpointer data G_GNUC_UNUSED) { dbus_bool_t have_mem; + char *address; g_assert (f->left_server_conn == NULL); g_assert (f->right_server_conn == NULL); - f->left_client_conn = dbus_connection_open_private ( - dbus_server_get_address (f->server), &f->e); + address = dbus_server_get_address (f->server); + g_assert (address != NULL); + + f->left_client_conn = dbus_connection_open_private (address, &f->e); assert_no_error (&f->e); g_assert (f->left_client_conn != NULL); dbus_connection_setup_with_g_main (f->left_client_conn, NULL); @@ -153,12 +156,13 @@ test_connect (Fixture *f, g_main_context_iteration (NULL, TRUE); } - f->right_client_conn = dbus_connection_open_private ( - dbus_server_get_address (f->server), &f->e); + f->right_client_conn = dbus_connection_open_private (address, &f->e); assert_no_error (&f->e); g_assert (f->right_client_conn != NULL); dbus_connection_setup_with_g_main (f->right_client_conn, NULL); + dbus_free (address); + while (f->right_server_conn == NULL) { g_print ("."); diff --git a/tools/Makefile.in b/tools/Makefile.in index 06b702cd..5fc74453 100644 --- a/tools/Makefile.in +++ b/tools/Makefile.in @@ -276,6 +276,11 @@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ +PYTHON = @PYTHON@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ RC = @RC@ R_DYNAMIC_LDFLAG = @R_DYNAMIC_LDFLAG@ @@ -347,9 +352,13 @@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ |