D-Bus 1.5.8 (UNRELEASED)
==
+The "cross-metering" release.
+
• Clean up dead code (fd.o #39231, Simon McVittie)
+• 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)
• 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)
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
_DBUS_ASSERT_ERROR_IS_CLEAR (error);
+ retval = FALSE;
name = NULL;
exec = NULL;
user = NULL;
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;
}
* the entries hash table */
_dbus_hash_table_remove_string (entry->s_dir->entries,
entry->filename);
- bus_activation_entry_unref (entry);
- return FALSE;
+ goto out;
}
}
if (entry)
bus_activation_entry_unref (entry);
- return FALSE;
+ return retval;
}
static dbus_bool_t
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
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])
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])
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
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])
##### 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
#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,
*
* @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;
}
/**
#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).
*
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)
dist_doc_DATA = system-activation.txt
+# uploaded and distributed, but not installed
STATIC_DOCS = \
dbus-faq.xml \
dbus-specification.xml \
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 \
$(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 $@ $<
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"
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
test_refs_CPPFLAGS = $(static_cppflags)
test_refs_LDADD = libdbus-testutils.la $(GLIB_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
test-marshal \
test-refs \
test-relay \
+ test-syslog \
$(NULL)
installcheck_tests =
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
--- /dev/null
+/* 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 ();
+}
## 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=
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
${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