Commit graph

944 commits

Author SHA1 Message Date
Simon McVittie
5f12e6e081 Merge branch 'dbus-1.6'
Conflicts:
	NEWS
2013-04-22 16:16:03 +01:00
Simon McVittie
6b2add5e70 Accept non-characters when validating Unicode
Unicode Corrigendum #9 clarifies that the non-characters U+nFFFE
(for n in the range 0 to 0x10), U+nFFFF (for n in the same range),
and U+FDD0..U+FDEF are valid for interchange, and their presence
does not make a string ill-formed.

GLib 2.36 made the corresponding change in its definition of UTF-8
as used by g_utf8_validate() and similar functions.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=63072
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-04-22 15:36:32 +01:00
Simon McVittie
2ab900b678 Do not suppress syslog test's stderr just because init is systemd
This causes the test to fail. The assumption implicitly being made was
"if pid 1 is systemd, then every caller of _dbus_init_system_log() is a
systemd service" which is not valid for the regression test.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=63163
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Colin Walters <walters@verbum.org>
2013-04-08 12:17:28 +01:00
Simon McVittie
4a0b41ee31 Include config.h as the first thing in every .c file
...except for CheckForAbstractSockets.c, which runs before config.h is
generated, and sd-daemon.c, which is externally-maintained.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=59971
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Colin Walters <walters@verbum.org>
2013-02-22 13:08:27 +00:00
Simon McVittie
efddba53da When not producing a dynamic library, define DBUS_STATIC_BUILD
When targeting Windows, linking against the static library requires
special effort to turn off DLL import/export processing. We normally
link some things against the dynamic library, but if we're not building
that, we'll have to link everything statically.

Based on patches from 'william' on fd.o #46367.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33973
Tested-by: René Berber <Rene.Berber gmail com>
2012-06-15 14:25:48 +01:00
Simon McVittie
7db205d25d Fix distcheck: remove potentially-read-only files from builddir
During distcheck, the srcdir is read-only. During "make all", cp may
preserve the read-only status of the file copied from the srcdir,
resulting in failure to overwrite it with an identical file during
"make check" (which depends on all-local).

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2012-06-05 13:27:23 +01:00
Simon McVittie
e48de6be84 Merge branch 'dbus-1.4'
Conflicts:
	NEWS
	dbus/dbus-internals.c
	dbus/dbus-mainloop.c
	dbus/dbus-sysdeps-unix.c
	dbus/dbus-sysdeps-win.c
	dbus/dbus-sysdeps.c
	dbus/dbus-sysdeps.h
2012-04-25 19:24:55 +01:00
Antoine Jacoutot
069c96ccde use cp and mkdir -p instead of install within source tree
$(INSTALL) and $(INSTALL_DATA) try to change ownerships to root:bin when
copying tests to builddir. Presumably this is a difference in behaviour
between GNU and BSD install(1): the one in GNU coreutils doesn't try-and-fail
to change ownership if you're not root.

[Commit message added by smcv]

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=48127
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2012-04-25 19:12:03 +01:00
David Zeuthen
8703514397 Avoid using monotonic time in the DBUS_COOKIE_SHA1 authentication method
When libdbus-1 moved to using monotonic time support for the
DBUS_COOKIE_SHA1 authentication was broken, in particular
interoperability with non-libdbus-1 implementations such as GDBus.

The problem is that if monotonic clocks are available in the OS,
_dbus_get_current_time() will not return the number of seconds since
the Epoch so using it for DBUS_COOKIE_SHA1 will violate the D-Bus
specification. If both peers are using libdbus-1 it's not a problem
since both ends will use the wrong time and thus agree. However, if
the other end is another implementation and following the spec it will
not work.

First, we change _dbus_get_current_time() back so it always returns
time since the Epoch and we then rename it _dbus_get_real_time() to
make this clear. We then introduce _dbus_get_monotonic_time() and
carefully make all current users of _dbus_get_current_time() use it,
if applicable. During this audit, one of the callers,
_dbus_generate_uuid(), was currently using monotonic time but it was
decided to make it use real time instead.

Signed-off-by: David Zeuthen <davidz@redhat.com>
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=48580
2012-04-12 11:18:07 -04:00
David Zeuthen
8734e4a16f Avoid using monotonic time in the DBUS_COOKIE_SHA1 authentication method
When libdbus-1 moved to using monotonic time support for the
DBUS_COOKIE_SHA1 authentication was broken, in particular
interoperability with non-libdbus-1 implementations such as GDBus.

The problem is that if monotonic clocks are available in the OS,
_dbus_get_current_time() will not return the number of seconds since
the Epoch so using it for DBUS_COOKIE_SHA1 will violate the D-Bus
specification. If both peers are using libdbus-1 it's not a problem
since both ends will use the wrong time and thus agree. However, if
the other end is another implementation and following the spec it will
not work.

First, we change _dbus_get_current_time() back so it always returns
time since the Epoch and we then rename it _dbus_get_real_time() to
make this clear. We then introduce _dbus_get_monotonic_time() and
carefully make all current users of _dbus_get_current_time() use it,
if applicable. During this audit, one of the callers,
_dbus_generate_uuid(), was currently using monotonic time but it was
decided to make it use real time instead.

Signed-off-by: David Zeuthen <davidz@redhat.com>
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=48580
2012-04-12 10:53:50 -04:00
Simon McVittie
a183a33fb5 Merge remote-tracking branch 'alban/own_prefix2'
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=46273
2012-03-27 15:05:56 +01:00
Martin Pitt
19343fb6a8 Port to glib 2.31.x g_thread API
g_thread_init() is deprecated since glib 2.24, call g_type_init() instead.
Bump glib requirement accordingly.

g_thread_create is deprecated since 2.31, use g_thread_new() instead. When
building with a glib earlier than 2.31, provide a backwards compatibility shim.

[Added a comment about why we're using g_type_init() in a test that
doesn't otherwise use GObject -smcv]

[Applied to 1.4 despite just being a deprecation fix because it also fixes
linking with GLib 2.32, in which gthread has been removed from gobject's
Requires and moved to Requires.private, Debian #665665 -smcv]

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=44413
Bug-Debian: http://bugs.debian.org/665665
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2012-03-27 12:10:00 +01:00
Alban Crequy
f1cfc138ef test: enforce own_prefix policy rules
After parsing [allow|deny] rules with own_prefix, check they are enforced
correctly.

https://bugs.freedesktop.org/show_bug.cgi?id=46886
2012-03-22 11:51:23 +00:00
Alban Crequy
d0591d318f test: parse own_prefix policy rules
Just check that the parser accept [allow|deny] rules with own_prefix

https://bugs.freedesktop.org/show_bug.cgi?id=46886
2012-03-22 11:50:27 +00:00
Simon McVittie
30361bac5d Merge branch 'dbus-1.4' 2012-03-12 11:55:27 +00:00
Simon McVittie
bee5d4fb05 Enumerate data files used in the build rather than using find(1)
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33840
Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
2012-03-12 11:45:27 +00:00
Simon McVittie
5ed44952d9 Add a regression test for validating various string types with the public API
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=39549
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
2012-02-24 12:44:14 +00:00
Simon McVittie
37f41b64a9 Mark shell-test as modular and installable
This test needs non-public API and so is statically linked, but is OK
to install.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=42811
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2012-02-21 15:15:28 +00:00
Simon McVittie
4b31fcf4d4 Allow a reduced set of installable tests (none yet) to be built without GLib
--enable-modular-tests=auto will build as many as possible, perhaps
excluding the GLib ones. --enable-modular-tests=yes or --enable-tests=yes
will insist on having GLib, to be able to run everything.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=42811
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2012-02-21 15:15:24 +00:00
Simon McVittie
88498b706a Merge branch 'socket-set-33337'
Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33337
2012-02-07 15:04:25 +00:00
Simon McVittie
11b31b864f Port to glib 2.31.x g_thread API
g_thread_init() is deprecated since glib 2.24, call g_type_init() instead.
Bump glib requirement accordingly.

g_thread_create is deprecated since 2.31, use g_thread_new() instead. When
building with a glib earlier than 2.31, provide a backwards compatibility shim.

[Added a comment about why we're using g_type_init() in a test that
doesn't otherwise use GObject -smcv]

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=44413
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2012-01-23 11:11:24 +00:00
Simon McVittie
08dd53c14b Revert addition of files which were only meant to exist on master, too
This completes the reversion started in 5df8c3db12.
2012-01-23 10:27:32 +00:00
Simon McVittie
5df8c3db12 Revert all changes since a36d4918a6
Someone seems to have merged part of master into 1.4. Again. Let's go
back to the "last known good" point (the branch-point of some 1.4
branches I had locally), then we can cherry-pick the changes that
should have gone in.
2012-01-04 17:44:23 +00:00
Ralf Habacker
ef8d0d75d5 Merge branch 'dbus-1.4' of ssh://git.freedesktop.org/git/dbus/dbus into dbus-1.4 2011-12-21 20:40:22 +01:00
Simon McVittie
a2c623b881 Merge branch 'dbus-1.4' 2011-11-02 15:31:09 +00:00
Simon McVittie
a36d4918a6 corrupt test: compile successfully against older GLib (Debian stable)
We don't really need g_socket_send_with_blocking here.

Also, don't leak the GLib socket objects.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=41219
Reviewed-by: Lennart Poettering <lennart@poettering.net>
2011-11-02 15:20:51 +00:00
Simon McVittie
c587e56b8a Set DBUS_TEST_HOMEDIR when running installcheck
This avoids spamming ~/.dbus and ~/.dbus-keyrings with filesystem activity
while running the tests.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=41218
Reviewed-by: Lennart Poettering <lennart@poettering.net>
2011-11-02 15:19:54 +00:00
Simon McVittie
e9f0378bbf Merge tests' cmake and autotools bus configuration
In Unix, the tests listened on both debug-pipe (which is a socketpair,
or a TCP emulation of socketpair on Windows) and a Unix socket.

In the Windows port, the tests were hard-coded to listen on a particular
port, which allowed the dispatch test to connect to that port, as long
as no two tests ran simultaneously (which I don't think was ever guaranteed -
make -j can violate this). That's valid out-of-process, and also
fully-specified, so they only needed one <listen> directive, so the
CMake input only had one.

To make the tests work under CMake on Unix, there was a hack: the string
substituted for the content of the <listen> directive contained
</listen><listen> to get the other address in, which is pretty nasty.

Instead of doing that, I've made both build systems, on both Unix and
Windows, use both debug-pipe and a more normal transport (Unix or TCP).
debug-pipe has a Windows implementation and it's used in
dbus-spawn-win.c, so it'd better work. The use of debug-pipe is now
hard-coded rather than being a configure parameter (there's no reason
to vary it in different builds), and I used TEST_LISTEN as the name of the
Unix/TCP address, because it's a "vague" address (no specific Unix path, no
TCP port), that you can listen on but not connect to.

This in turn means that we can merge the Autoconf .in and CMake .cmake
files, similar to Bug #41033.

You might wonder why I've kept debug-pipe. I did try to get rid of it, but
it turns out that the tests in dispatch.c rely on
dbus_connection_open_private() not blocking, and normal socket
connections block on connect(). Until we fix that by adding an async
version of dbus_connection_open_private(), it won't be safe to have a
test like dispatch.c that "talks to itself", unless it uses a transport
as trivial as debug-pipe in which neither end has to block on the other.

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=41222
2011-09-28 19:00:56 +01:00
Simon McVittie
33c43947cd Simplify substitution of test executables to use fewer variables
Also use EXEEXT in all the service files, even in the automake build
system.

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=41222
2011-09-28 19:00:49 +01:00
Simon McVittie
6934bc6927 Simplify generation of bus configuration files
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=41222
2011-09-28 19:00:11 +01:00
Simon McVittie
0db406cb19 refs test: fix unused variable
This one was added since my more-unused-39231 branch.
2011-09-21 11:56:28 +01:00
Simon McVittie
87d37f0867 Fix compilation of syslog test in master 2011-09-21 11:56:28 +01:00
Simon McVittie
b3b9fc03da Merge branch 'more-unused-39231'
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=39231
Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
2011-09-21 11:45:13 +01:00
Simon McVittie
bf3d8259ac Merge branch 'dbus-1.4'
Conflicts:
	NEWS
2011-09-21 11:39:32 +01:00
Simon McVittie
5defa43b6f 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 <will.thompson@collabora.co.uk>
2011-09-21 11:25:48 +01:00
Simon McVittie
029ecdf402 Add a semi-automatic test for _dbus_system_log
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=39987
Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
2011-09-21 11:25:48 +01:00
Simon McVittie
14ed371845 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 <will.thompson@collabora.co.uk>
2011-09-21 11:25:48 +01:00
Simon McVittie
bf2a1b169f Remove more never-used variables 2011-09-19 13:50:37 +01:00
Simon McVittie
74868224e4 dbus-daemon-eavesdrop test: apply the same Windows fixes as dbus-daemon test
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=40003
2011-08-12 10:45:15 +01:00
Simon McVittie
39e3866c0a Fix linking of libdbus-testutils.la with Automake targeting Windows
This regressed in commit 9875480ed - libdbus-testutils.la needs static
linking too.
2011-08-12 10:26:26 +01:00
Simon McVittie
c99a3df254 Merge branch 'dbus-1.4' 2011-08-12 10:26:13 +01:00
Simon McVittie
bc643f81a5 Fix compiler warnings when cross-compiling dbus-daemon test for mingw32
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=40003
Reviewed-by: Colin Walters <walters@verbum.org>
2011-08-12 10:21:50 +01:00
Simon McVittie
a1c90cacfa Merge branch 'dbus-1.4'
Conflicts:
	bus/main.c
2011-08-05 14:52:37 +01:00
Simon McVittie
6c6ae1efcd Add a regression test for fd.o #38005
(The dbus-1.4 version.)

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=39836
Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
2011-08-05 14:46:31 +01:00
Simon McVittie
9f64c1930a relay test: don't leak the server's address
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=39836
Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
2011-08-05 14:46:09 +01:00
Simon McVittie
0c4a2087c6 Remove various never-used variables
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=39231
Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
2011-08-05 12:26:51 +01:00
Simon McVittie
565ae9dea9 test-service, test-shell-service: check what RequestName returned
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=39231
Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
2011-08-05 12:26:48 +01:00
Simon McVittie
7430df2416 test, test/name-test: remove SOURCES where they can be inferred from the name of the executable 2011-07-29 11:49:15 +01:00
Simon McVittie
590a835974 test/name-test: remove useless CFLAGS 2011-07-29 11:49:14 +01:00
Simon McVittie
add0b02ee0 test/name-test: use AM_CPPFLAGS instead of INCLUDES 2011-07-29 11:49:13 +01:00