From f4c02e7829648bf8a5f966fd9a132f9ea4f73cda Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 20 Sep 2011 18:44:25 +0100 Subject: [PATCH 01/15] Fix maintainer-upload-docs target to work out-of-tree The STATIC_DOCS, DTDS and all dist_ files except XMLTO_OUTPUT are in the source tree. The XMLTO_OUTPUT and the man2html output are in the build tree, and the BONUS_FILES already have $(srcdir) in their names. Also change the rules that generate the dbus-docs directory so that if they fail, they leave behind a temporary directory, rather than leaving behind a dbus-docs directory that causes make to not run those rules if re-run; and change the rules to scp files to the server, to put a trailing "/" on paths, ensuring that the tarball won't be uploaded as "www" if the www directory doesn't already exist. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=41047 Reviewed-by: Will Thompson --- doc/Makefile.am | 39 +++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/doc/Makefile.am b/doc/Makefile.am index b36777cd..3fdb7803 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -30,6 +30,7 @@ DTDS = \ dist_doc_DATA = system-activation.txt +# uploaded and distributed, but not installed STATIC_DOCS = \ dbus-faq.xml \ dbus-specification.xml \ @@ -47,11 +48,19 @@ EXTRA_DIST = \ html_DATA = -# we distribute these in the tarball so users don't necessarily need xmlto -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 \ - $(XMLTO_OUTPUT) + $(NULL) + +dist_html_DATA += $(STATIC_HTML) + +# we distribute these in the tarball so users don't necessarily need xmlto +dist_html_DATA += $(XMLTO_OUTPUT) XMLTO_OUTPUT= \ dbus-faq.html \ @@ -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 From 9708294c052820e7914025d7bae6d29b37cd9298 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 23 Aug 2011 12:05:00 +0100 Subject: [PATCH 02/15] On Solaris, define CMSG_ALIGN, CMSG_LEN, CMSG_SPACE if undefined Bug: https://bugs.freedesktop.org/show_bug.cgi?id=40235 Tested-by: Dagobert Michelsen Reviewed-by: Will Thompson --- dbus/dbus-sysdeps-unix.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/dbus/dbus-sysdeps-unix.c b/dbus/dbus-sysdeps-unix.c index e69f3b59..171977d3 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, From 14ed371845c50aa8fe5849c373ca2c65e96ec153 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 5 Aug 2011 13:16:47 +0100 Subject: [PATCH 03/15] Make "make -C test clean" idempotent Previously, it'd fail when done twice, because you can't rmdir a nonexistent directory. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=40004 Reviewed-by: Will Thompson --- test/Makefile.am | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/Makefile.am b/test/Makefile.am index e5fd756b..74744559 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -272,6 +272,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 From a4e9dc6780cc2187257f6eb232f1b241e78900ba Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 23 Aug 2011 16:10:03 +0100 Subject: [PATCH 04/15] Cope with Unixes that don't have LOG_PERROR, like Solaris 10 Bug: https://bugs.freedesktop.org/show_bug.cgi?id=39987 Reviewed-by: Will Thompson --- configure.ac | 5 +++++ dbus/dbus-sysdeps-util-unix.c | 20 +++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index ad046e06..864303fa 100644 --- a/configure.ac +++ b/configure.ac @@ -520,6 +520,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 ]]) +fi + #### Check for broken poll; taken from Glib's configure AC_MSG_CHECKING([for broken poll]) 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) From 029ecdf40268b1c0db04bb617f067487719bf251 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 23 Aug 2011 16:14:21 +0100 Subject: [PATCH 05/15] Add a semi-automatic test for _dbus_system_log Bug: https://bugs.freedesktop.org/show_bug.cgi?id=39987 Reviewed-by: Will Thompson --- test/Makefile.am | 5 ++ test/internals/syslog.c | 100 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 105 insertions(+) create mode 100644 test/internals/syslog.c diff --git a/test/Makefile.am b/test/Makefile.am index 74744559..0981d1f0 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -101,6 +101,10 @@ 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 @@ -114,6 +118,7 @@ installable_tests = \ test-marshal \ test-refs \ test-relay \ + test-syslog \ $(NULL) installcheck_tests = 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 + * 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 + +#include + +#include + +#define DBUS_COMPILATION /* this test uses libdbus-internal */ +#include +#include + +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 (); +} From 7fc9c026669976463adcd1e02ad19c582ed27289 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 21 Jun 2011 14:09:32 +0100 Subject: [PATCH 06/15] Cope with platforms whose vsnprintf violates both POSIX and C99 Bug: https://bugs.freedesktop.org/show_bug.cgi?id=11668 Reviewed-by: Will Thompson --- dbus/dbus-sysdeps-unix.c | 52 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 49 insertions(+), 3 deletions(-) diff --git a/dbus/dbus-sysdeps-unix.c b/dbus/dbus-sysdeps-unix.c index 171977d3..f51f6fcb 100644 --- a/dbus/dbus-sysdeps-unix.c +++ b/dbus/dbus-sysdeps-unix.c @@ -3021,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; } /** From 5defa43b6f809f39ec79cc426414f2f6b1896065 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 24 Aug 2011 10:59:41 +0100 Subject: [PATCH 07/15] Check for Python; skip Python tests if not found As with the optional test-dependencies on GLib and dbus-glib, we make this a hard dependency if --enable-tests[=yes], but not if --enable-tests=auto. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=37847 Reviewed-by: Will Thompson --- configure.ac | 9 +++++++++ test/name-test/Makefile.am | 2 +- test/name-test/run-test-systemserver.sh | 5 +++-- test/name-test/run-test.sh | 4 +++- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 864303fa..efe14f4d 100644 --- a/configure.ac +++ b/configure.ac @@ -218,6 +218,15 @@ 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]) + AM_PATH_PYTHON([2.6]) +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 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/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 From d55b3efbdef877642a154dfdca43d760795cdd9c Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 24 Aug 2011 11:00:35 +0100 Subject: [PATCH 08/15] Give better diagnostics if --enable-tests=yes is given We want to indicate why it's a problem that GLib, dbus-glib are missing. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=37847 Reviewed-by: Will Thompson --- configure.ac | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index efe14f4d..7566447c 100644 --- a/configure.ac +++ b/configure.ac @@ -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]) From 3f1af382a13cd21eea7e7e0addd0183400e7fd69 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 16 Sep 2011 10:50:01 +0100 Subject: [PATCH 09/15] Only ask pkg-config for the systemd unit directory if both are installed pkg-config is not a hard dependency, and this check avoids errors in a minimal build environment: ./configure: line 21777: --variable=systemdsystemunitdir: command not found Bug: https://bugs.freedesktop.org/show_bug.cgi?id=37847 Reviewed-by: Will Thompson --- configure.ac | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 7566447c..f44dfe3e 100644 --- a/configure.ac +++ b/configure.ac @@ -1373,7 +1373,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 From dc632829db498795824f08af0f9191874e7ef672 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 24 Aug 2011 12:24:28 +0100 Subject: [PATCH 10/15] If --enable-tests=yes, require Python modules for complete test coverage The two relevant tests already exit 0 with a message if importing those modules fails. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=37847 Reviewed-by: Will Thompson --- configure.ac | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index f44dfe3e..94797430 100644 --- a/configure.ac +++ b/configure.ac @@ -229,8 +229,15 @@ AM_CONDITIONAL([DBUS_ENABLE_INSTALLED_TESTS], 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]) + 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], [], [:]) From 4dd6abc9535dcf920cf2b0757769e6450c235d49 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 21 Sep 2011 11:25:40 +0100 Subject: [PATCH 11/15] NEWS --- NEWS | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/NEWS b/NEWS index 632f5948..7425d7da 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,16 @@ D-Bus 1.4.16 (UNRELEASED) == +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) @@ -22,6 +32,12 @@ D-Bus 1.4.16 (UNRELEASED) 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 From 9e93d82862c4c9af9f2da9cba74b70ff98fd3b60 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Thu, 21 Jul 2011 13:06:21 +0100 Subject: [PATCH 12/15] update_desktop_file_entry: don't leak file_path on one particular OOM Revenge of #33126: most, but not all, temporary variables were freed on this code path. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=39230 Reviewed-by: Will Thompson --- bus/activation.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bus/activation.c b/bus/activation.c index 3177d023..c1f0e949 100644 --- a/bus/activation.c +++ b/bus/activation.c @@ -457,8 +457,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; } } From c38e9823da1980d4323006f86ec5968be7d64e76 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Thu, 21 Jul 2011 13:12:15 +0100 Subject: [PATCH 13/15] update_desktop_file_entry: if the service name already existed, set error If we're going to return FALSE for this (which has apparently always been the case), then we should set an error properly. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=39230 Reviewed-by: Will Thompson --- bus/activation.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bus/activation.c b/bus/activation.c index c1f0e949..8c9f5598 100644 --- a/bus/activation.c +++ b/bus/activation.c @@ -427,8 +427,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; } From 423ab7cdd033f10350c580256c9a06e70590de8b Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Thu, 21 Jul 2011 13:21:29 +0100 Subject: [PATCH 14/15] update_desktop_file_entry: initialize return value properly, and actually return it Since 1.4.4 (commit 75cfd97f) this function always returned FALSE. As far as I can see this was actually harmless, because both of its callers ignore any error that is not NoMemory (and treat it the same as success). Bug: https://bugs.freedesktop.org/show_bug.cgi?id=39230 Reviewed-by: Will Thompson --- bus/activation.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bus/activation.c b/bus/activation.c index 8c9f5598..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; @@ -478,7 +479,7 @@ out: if (entry) bus_activation_entry_unref (entry); - return FALSE; + return retval; } static dbus_bool_t From bdfec550544d353e60228b0553534467cbb36a06 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 21 Sep 2011 11:38:22 +0100 Subject: [PATCH 15/15] NEWS --- NEWS | 3 +++ 1 file changed, 3 insertions(+) diff --git a/NEWS b/NEWS index 7425d7da..f3fc3181 100644 --- a/NEWS +++ b/NEWS @@ -23,6 +23,9 @@ The "this answerphone fails to answer the phone" release. • 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)