platform/upstream/dbus.git
12 years agoMerge branch 'dbus-1.6'
Simon McVittie [Fri, 15 Jun 2012 15:03:49 +0000 (16:03 +0100)]
Merge branch 'dbus-1.6'

12 years agoNEWS
Simon McVittie [Fri, 15 Jun 2012 15:03:39 +0000 (16:03 +0100)]
NEWS

12 years agoOn Unix, link libdbus to a platform-specific threading library
Simon McVittie [Mon, 12 Mar 2012 15:40:30 +0000 (15:40 +0000)]
On Unix, link libdbus to a platform-specific threading library

On Linux, this is libpthread; on other Unixes, in principle it might be
called libpthreads or libthreads or something.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=47237
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
12 years agoWhen not producing a dynamic library, define DBUS_STATIC_BUILD
Simon McVittie [Mon, 12 Mar 2012 14:15:48 +0000 (14:15 +0000)]
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>
12 years agoCut minor version down to 255
Simon McVittie [Fri, 15 Jun 2012 13:11:50 +0000 (14:11 +0100)]
Cut minor version down to 255

Entertainingly, bits of libdbus assume that one byte is enough for each
version number component (as API!), and one test even fails if this
isn't true.

12 years agoDescribe how to marshal arrays, structs, dict-entries, variants in prose
Simon McVittie [Mon, 13 Jun 2011 13:59:20 +0000 (14:59 +0100)]
Describe how to marshal arrays, structs, dict-entries, variants in prose

Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=38252

12 years agoPromote the marshalling format to a top-level section
Simon McVittie [Mon, 13 Jun 2011 14:24:21 +0000 (15:24 +0100)]
Promote the marshalling format to a top-level section

Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=38252

12 years agoPromote the definition of valid object paths and signatures into the type system
Simon McVittie [Fri, 15 Jun 2012 12:58:24 +0000 (13:58 +0100)]
Promote the definition of valid object paths and signatures into the type system

Also remove the (double!) requirement that signatures be nul-terminated,
and turn it into a note about the marshalling format.

Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=38252

12 years agoDefine the fixed and string-like types a bit more formally
Simon McVittie [Mon, 13 Jun 2011 12:24:40 +0000 (13:24 +0100)]
Define the fixed and string-like types a bit more formally

Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=38252

12 years agoDon't claim that all basic types work like INT32: strings don't!
Simon McVittie [Tue, 26 Apr 2011 17:03:35 +0000 (18:03 +0100)]
Don't claim that all basic types work like INT32: strings don't!

Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=38252

12 years agoDefine single complete types in the overview of the type system
Simon McVittie [Wed, 25 May 2011 16:59:07 +0000 (17:59 +0100)]
Define single complete types in the overview of the type system

Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=38252

12 years agoSplit Basic and Container types into subsections, promote "Type Signatures" to be...
Simon McVittie [Wed, 25 May 2011 17:03:01 +0000 (18:03 +0100)]
Split Basic and Container types into subsections, promote "Type Signatures" to be an intro

The "Type Signatures" subsection is basically an introduction to the
type system, so it doesn't need a heading of its own.

Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=38252

12 years agoMerge branch 'dbus-1.6'
Simon McVittie [Fri, 15 Jun 2012 12:23:13 +0000 (13:23 +0100)]
Merge branch 'dbus-1.6'

Conflicts:
NEWS
configure.ac

12 years agoNEWS
Simon McVittie [Fri, 15 Jun 2012 12:22:16 +0000 (13:22 +0100)]
NEWS

12 years agoDocument that dbus-launch is not dbus-run-session
Simon McVittie [Tue, 7 Feb 2012 17:43:28 +0000 (17:43 +0000)]
Document that dbus-launch is not dbus-run-session

Architectural assumptions inside dbus-launch mean that it is unsuitable
for use in contexts where a particular process's lifetime defines the
session, unless there is an out-of-band mechanism (like the X server)
which can signal the end of the session.

Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=39197

12 years agodbus-launch: revise recommendations and put them in an EXAMPLES section
Simon McVittie [Tue, 7 Feb 2012 17:00:46 +0000 (17:00 +0000)]
dbus-launch: revise recommendations and put them in an EXAMPLES section

The first thing we should talk about is how to get a D-Bus session in
your X session - that's the common case.

Secondarily, we can tell command-line addicts how to have a D-Bus session.
Do not recommend --exit-with-session here, since that polls (and reads
from) stdin, which is harmful to precisely those command-line users!
Until we have some better tool, the best we can do here is note that
the dbus-daemon is not automatically terminated.

Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=39197

12 years agodbus-launch: add --exit-with-x11 option
Simon McVittie [Tue, 7 Feb 2012 16:58:01 +0000 (16:58 +0000)]
dbus-launch: add --exit-with-x11 option

This is more suitable for distributions' Xsession scripts: it verifies
that X is already available, and so never results in an attempt to poll
stdin.

Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=39197

12 years agodbus-launch: if using X to define the session lifetime, do not poll stdin
Simon McVittie [Tue, 7 Feb 2012 16:55:05 +0000 (16:55 +0000)]
dbus-launch: if using X to define the session lifetime, do not poll stdin

dbus-launch --exit-with-session attempts to scope the session length
to various things:

- if DISPLAY points to an X server, exit when the X session ends
- if stdin is a terminal, exit when end-of-file is reached
- if both are true, exit when one of them happens, whichever is first
- if neither is true, fail

These are not particularly useful semantics: if the session is scoped to
the X session, then the terminal from which dbus-launch was launched
is irrelevant. This also causes practical problems when dbus-launch
consumes characters from the terminal from which it happens to have
been launched (some display managers, like slim and nodm, run users' X
sessions with stdin pointing to the terminal from which the init daemon
happens to have started the display manager during boot, usually tty1
on Linux).

Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=39197

12 years agodocument how the various processes in dbus-launch interact
Simon McVittie [Thu, 16 Jun 2011 10:56:30 +0000 (11:56 +0100)]
document how the various processes in dbus-launch interact

Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=39197

12 years agoStart 1.7.0 development
Simon McVittie [Tue, 5 Jun 2012 14:04:25 +0000 (15:04 +0100)]
Start 1.7.0 development

12 years agoStart 1.6.2 development
Simon McVittie [Tue, 5 Jun 2012 14:03:58 +0000 (15:03 +0100)]
Start 1.6.2 development

12 years agoFix distcheck with newer Doxygen: remove *.js, too, during uninstall dbus-1.6.0
Simon McVittie [Tue, 5 Jun 2012 12:29:11 +0000 (13:29 +0100)]
Fix distcheck with newer Doxygen: remove *.js, too, during uninstall

12 years agoFix distcheck: remove potentially-read-only files from builddir
Simon McVittie [Tue, 5 Jun 2012 12:27:23 +0000 (13:27 +0100)]
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>
12 years agoPrepare version 1.6.0 (new stable branch)
Simon McVittie [Tue, 5 Jun 2012 12:14:07 +0000 (13:14 +0100)]
Prepare version 1.6.0 (new stable branch)

12 years ago_dbus_transport_new_for_tcp_socket: add missing commas to address
Simon McVittie [Fri, 24 Feb 2012 11:15:21 +0000 (11:15 +0000)]
_dbus_transport_new_for_tcp_socket: add missing commas to address

Ralf pointed out that the address doesn't round-trip correctly.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=45896
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
Tested-by: Ralf Habacker <ralf.habacker@freenet.de>
12 years agoRemove duplicate nonce-tcp (service-side) transport on Windows
Simon McVittie [Fri, 10 Feb 2012 15:22:16 +0000 (15:22 +0000)]
Remove duplicate nonce-tcp (service-side) transport on Windows

Turns out this was duplicated too. We can just use the
platform-independent version, which uses the same code.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=45896
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
Tested-by: Ralf Habacker <ralf.habacker@freenet.de>
12 years agoRemove duplicate nonce-tcp (client side) transport on Windows
Simon McVittie [Fri, 10 Feb 2012 15:20:42 +0000 (15:20 +0000)]
Remove duplicate nonce-tcp (client side) transport on Windows

_dbus_transport_open_socket is called before
_dbus_transport_open_platform_specific, and now handles nonce-tcp, so
this version is no longer useful.

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=45896
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
Tested-by: Ralf Habacker <ralf.habacker@freenet.de>
12 years agoMerge branch 'dbus-1.4'
Simon McVittie [Wed, 25 Apr 2012 18:24:55 +0000 (19:24 +0100)]
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

12 years agoNEWS
Simon McVittie [Wed, 25 Apr 2012 18:12:15 +0000 (19:12 +0100)]
NEWS

12 years agouse cp and mkdir -p instead of install within source tree
Antoine Jacoutot [Wed, 25 Apr 2012 18:04:07 +0000 (19:04 +0100)]
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>
12 years agoAvoid using monotonic time in the DBUS_COOKIE_SHA1 authentication method
David Zeuthen [Thu, 12 Apr 2012 15:16:48 +0000 (11:16 -0400)]
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

12 years agoAvoid using monotonic time in the DBUS_COOKIE_SHA1 authentication method
David Zeuthen [Thu, 12 Apr 2012 03:05:33 +0000 (23:05 -0400)]
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

12 years ago1.5.13
Simon McVittie [Tue, 27 Mar 2012 18:18:23 +0000 (19:18 +0100)]
1.5.13

12 years agoPrepare dbus 1.5.12 dbus-1.5.12
Simon McVittie [Tue, 27 Mar 2012 16:25:25 +0000 (17:25 +0100)]
Prepare dbus 1.5.12

12 years agoBuild _dbus_string_starts_with_c_str even if not building tests
Simon McVittie [Tue, 27 Mar 2012 16:19:44 +0000 (17:19 +0100)]
Build _dbus_string_starts_with_c_str even if not building tests

It's used by the own_prefix implementation.

12 years agoMerge remote-tracking branch 'alban/own_prefix2'
Simon McVittie [Tue, 27 Mar 2012 14:05:51 +0000 (15:05 +0100)]
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

12 years agoMerge branch 'dbus-1.4'
Simon McVittie [Tue, 27 Mar 2012 13:52:24 +0000 (14:52 +0100)]
Merge branch 'dbus-1.4'

Conflicts:
NEWS
configure.ac

12 years agoStart 1.4.21
Simon McVittie [Tue, 27 Mar 2012 13:25:49 +0000 (14:25 +0100)]
Start 1.4.21

12 years agoPrepare version 1.4.20 dbus-1.4.20
Simon McVittie [Tue, 27 Mar 2012 12:00:19 +0000 (13:00 +0100)]
Prepare version 1.4.20

12 years agoFix duplicate case value compiling with mingw-w64
Andoni Morales Alastruey [Wed, 14 Mar 2012 20:59:04 +0000 (21:59 +0100)]
Fix duplicate case value compiling with mingw-w64

In mingw-w64 both ESOMETHING and WSASOMETHING are defined,
leading to a duplicate case in the switch.

Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=47321

12 years agoPort to glib 2.31.x g_thread API
Martin Pitt [Mon, 23 Jan 2012 11:11:24 +0000 (11:11 +0000)]
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>
12 years agotest: enforce own_prefix policy rules
Alban Crequy [Wed, 21 Mar 2012 19:05:42 +0000 (19:05 +0000)]
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

12 years agotest: parse own_prefix policy rules
Alban Crequy [Sun, 4 Mar 2012 15:11:45 +0000 (15:11 +0000)]
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

12 years agopolicy: remove unused parameter
Alban Crequy [Wed, 21 Mar 2012 17:55:18 +0000 (17:55 +0000)]
policy: remove unused parameter

12 years agodoc: update documentation with own_prefix policy rules
Alban Crequy [Sun, 4 Mar 2012 15:18:38 +0000 (15:18 +0000)]
doc: update documentation with own_prefix policy rules

https://bugs.freedesktop.org/show_bug.cgi?id=46886

12 years agotransport: add new unixexec transport on Unix
Lennart Poettering [Fri, 11 Mar 2011 21:35:16 +0000 (22:35 +0100)]
transport: add new unixexec transport on Unix

The "unixexec:" transport will create a local AF_UNIX socket with
socketpair(), then fork and execute a binary on one side with STDIN and
STDOUT connected to it and then use the other side.

This is useful to implement D-Bus tunneling schemes, for example to get
a D-Bus connection to the system bus on a different host, similar how
udisks is already doing it. (udisks uses SSH TCP tunneling for this,
which is a bit ugly and less secure than this solution).

Suggested use is with connection strings like the following:

  unixexec:path=ssh,argv1=foobar,argv2=system-bus-bridge

or:

  unixexec:path=pkexec,argv1=system-bus-bridge

or even:

  unixexec:path=sudo,argv1=system-bus-bridge

The first line would execute the binary 'system-bus-bridge' on host
'foobar' and then pass D-Bus traffic to it. This (hypothetical) bridge
binary would then forward the information to the local system bus.

The second and third line use this scheme locally to acquire a
privileged connection through pkexec resp. sudo: instead of connecting
directly to the bus, they use the same bridge binary which will forward
all information to the system bus.

The arguments of the protocol are 'path' for the first execlp()
argument, and argv0, argv1, and so on for the following arguments. argv0
can be left out in which case path will be used.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=35230
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
12 years agosysdeps-unix: introduce dbus_close_all() and make use of it where appropriate
Lennart Poettering [Thu, 28 Jul 2011 03:33:46 +0000 (05:33 +0200)]
sysdeps-unix: introduce dbus_close_all() and make use of it where appropriate

This is optimized on Linux and enumerates through /proc/self/fd with a
fallback on brute-force closing of fds, in case /proc is not available.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=35230
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
12 years agospec: document unixexec transports
Lennart Poettering [Thu, 2 Feb 2012 04:46:09 +0000 (05:46 +0100)]
spec: document unixexec transports

This adds a specification text for the new unixexec: transport.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=35230
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
12 years agoFix spelling errors in dbus-launch(1)
John Bradshaw [Mon, 12 Mar 2012 13:53:05 +0000 (13:53 +0000)]
Fix spelling errors in dbus-launch(1)

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=47076
Bug-Fedora: https://bugzilla.redhat.com/show_bug.cgi?id=675491
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
12 years agoMerge branch 'dbus-1.4'
Simon McVittie [Mon, 12 Mar 2012 11:55:27 +0000 (11:55 +0000)]
Merge branch 'dbus-1.4'

12 years agoEnumerate data files used in the build rather than using find(1)
Simon McVittie [Mon, 26 Sep 2011 10:20:41 +0000 (11:20 +0100)]
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>
12 years agopolicy: enforce policy on "allow own_prefix"
Alban Crequy [Sun, 4 Mar 2012 14:56:02 +0000 (14:56 +0000)]
policy: enforce policy on "allow own_prefix"

https://bugs.freedesktop.org/show_bug.cgi?id=46886

12 years agoconfig parser: add own_prefix
Alban Crequy [Sun, 4 Mar 2012 14:36:56 +0000 (14:36 +0000)]
config parser: add own_prefix

https://bugs.freedesktop.org/show_bug.cgi?id=46882

12 years agoUpdate NEWS
Simon McVittie [Tue, 28 Feb 2012 12:51:26 +0000 (12:51 +0000)]
Update NEWS

12 years agoMake dbus-daemon.exe --print-address work under Windows
Simon McVittie [Mon, 13 Feb 2012 19:54:52 +0000 (19:54 +0000)]
Make dbus-daemon.exe --print-address work under Windows

The DBusPipe code was broken by commit 6e214b5b3c2837, which switched
from C runtime API to Win32 API for WinCE's benefit. In a DBusPipe,
fd_or_handle is in fact always a C runtime file descriptor, which can't
be used with the Win32 API (which expects a HANDLE).

This commit goes back to the C runtime API. It might cause WinCE support
to regress, but at least dbus-daemon.exe --print-address works again.

This is enough to make a few tests work under Wine when cross-compiling
from Linux to mingw-w64: in particular, this now works:

    DBUS_TEST_DAEMON=bus/dbus-daemon.exe DBUS_TEST_DATA=test/data \
    wine test/test-dbus-daemon.exe -p /echo/session

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=46049
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
12 years agoAdd a regression test for validating various string types with the public API
Simon McVittie [Fri, 24 Feb 2012 12:44:14 +0000 (12:44 +0000)]
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>
12 years agoAdd dbus-syntax.[ch]
Simon McVittie [Fri, 24 Feb 2012 12:43:55 +0000 (12:43 +0000)]
Add dbus-syntax.[ch]

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>
12 years agoDBusBasicValue: add bool_val and fd members to complete the set
Simon McVittie [Tue, 15 Nov 2011 13:11:03 +0000 (13:11 +0000)]
DBusBasicValue: add bool_val and fd members to complete the set

dbus_bool_t is the same as dbus_uint32_t, but if we have a separate
bool_val member, it's more obvious that people are getting it right.
It's not called bool because that's a keyword in C++.

int (for file descriptors) doesn't appear in the D-Bus message wire
format, but then again neither does char *, and
dbus_message_iter_get_basic() and friends can return an int (due to
internal index-into-array-of-fds -> fd remapping in libdbus).
In theory int might not be the same size as any of the dbus_intNN_t
types, and anyway it's easier to see that people are getting it right
if we make it explicit.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=11191
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
12 years agoPromote DBusBasicValue and DBus8ByteStruct to be API
Simon McVittie [Mon, 10 Oct 2011 10:20:31 +0000 (11:20 +0100)]
Promote DBusBasicValue and DBus8ByteStruct to be API

In practice, D-Bus bindings end up reinventing DBusBasicValue anyway,
so it might as well be API.

Also stop claiming that all basic-typed values are guaranteed to fit in
8 bytes - this is not true if your platform has more than 8-byte pointers
(I'm not aware of any such platform now, but let's not rule it out).

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=11191
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
12 years agoDevelopment version
Simon McVittie [Tue, 21 Feb 2012 20:23:55 +0000 (20:23 +0000)]
Development version

12 years agoPrepare 1.5.10 dbus-1.5.10
Simon McVittie [Tue, 21 Feb 2012 17:03:14 +0000 (17:03 +0000)]
Prepare 1.5.10

12 years agoMark shell-test as modular and installable
Simon McVittie [Wed, 9 Nov 2011 17:19:19 +0000 (17:19 +0000)]
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>
12 years agoAllow a reduced set of installable tests (none yet) to be built without GLib
Simon McVittie [Wed, 9 Nov 2011 17:18:36 +0000 (17:18 +0000)]
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>
12 years agodbus-memory: add optional checking for system malloc() (etc.) failing
Simon McVittie [Thu, 23 Jun 2011 10:43:33 +0000 (11:43 +0100)]
dbus-memory: add optional checking for system malloc() (etc.) failing

If tests are enabled and DBUS_MALLOC_CANNOT_FAIL is set, abort on system
malloc() failures (as GLib's g_malloc does). This can be used in
conjunction with a resource limit, to turn runaway memory leaks into a
debuggable core-dump.

Reviewed-by: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=41048

12 years agodbus_realloc: don't crash if realloc() returns NULL while using guards
Simon McVittie [Thu, 23 Jun 2011 10:26:38 +0000 (11:26 +0100)]
dbus_realloc: don't crash if realloc() returns NULL while using guards

Reviewed-by: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=41048

12 years agoTurn the non-valgrind code path into inline functions to avoid compiler warnings
Simon McVittie [Tue, 21 Feb 2012 14:52:49 +0000 (14:52 +0000)]
Turn the non-valgrind code path into inline functions to avoid compiler warnings

Recent gcc will warn if you have a statement that's just a macro
expanding to (0), but not if you have an inline stub function that
always returns 0, so let's do the latter.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=37286
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
12 years agoDBusTransport: don't include dbus-marshal-header.h either
Simon McVittie [Wed, 22 Jun 2011 10:10:00 +0000 (11:10 +0100)]
DBusTransport: don't include dbus-marshal-header.h either

No longer needed.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=46095
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
12 years agoMove _dbus_check_fdleaks_enter to dbus-message-internal.h
Simon McVittie [Wed, 22 Jun 2011 10:06:30 +0000 (11:06 +0100)]
Move _dbus_check_fdleaks_enter to dbus-message-internal.h

This means the bus test can use them without needing
dbus-message-private.h, reducing its view of message internals.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=46095
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
12 years agoDBusTransport: don't use dbus-message-private.h
Simon McVittie [Wed, 22 Jun 2011 10:00:58 +0000 (11:00 +0100)]
DBusTransport: don't use dbus-message-private.h

It seems it's no longer needed here.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=46095
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
12 years agoZero-initialize DBusCounter at allocation
Simon McVittie [Mon, 19 Sep 2011 14:17:26 +0000 (15:17 +0100)]
Zero-initialize DBusCounter at allocation

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=46095
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
12 years agoDo not AC_SUBST systemd flags from PKG_CHECK_MODULES
Simon McVittie [Mon, 13 Feb 2012 17:59:06 +0000 (17:59 +0000)]
Do not AC_SUBST systemd flags from PKG_CHECK_MODULES

They're automatically substituted already.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=46095
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
12 years agoInvoke PKG_PROG_PKG_CONFIG early in configure.ac
Simon McVittie [Mon, 13 Feb 2012 17:58:29 +0000 (17:58 +0000)]
Invoke PKG_PROG_PKG_CONFIG early in configure.ac

Otherwise, autoconf can generate wrong code, because our first use of
PKG_CHECK_MODULES is conditional.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=46095
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
12 years agointernal_bus_get: centralize error handling
Simon McVittie [Tue, 22 Feb 2011 18:47:51 +0000 (18:47 +0000)]
internal_bus_get: centralize error handling

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=46095
Reviewed-by: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
12 years agoAdd a macro to centralize checking for string-like types
Simon McVittie [Wed, 16 Feb 2011 17:52:03 +0000 (17:52 +0000)]
Add a macro to centralize checking for string-like types

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=46095
Reviewed-by: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
12 years agoRemove declaration of _dbus_type_is_fixed, no longer exists
Simon McVittie [Thu, 14 Jul 2011 10:37:38 +0000 (11:37 +0100)]
Remove declaration of _dbus_type_is_fixed, no longer exists

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=46095
Reviewed-by: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
12 years ago_dbus_verbose_real: tidy conditional prototype to not break nesting
Simon McVittie [Tue, 26 Jul 2011 15:03:20 +0000 (16:03 +0100)]
_dbus_verbose_real: tidy conditional prototype to not break nesting

The mismatched opening parenthesis caused vim syntax highlighting to
consider every subsequent brace in the file to be an error, which was
pretty annoying.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=46095
Reviewed-by: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
12 years agoRemove _dbus_condvar_wake_all and both of its implementations
Simon McVittie [Mon, 20 Feb 2012 12:56:01 +0000 (12:56 +0000)]
Remove _dbus_condvar_wake_all and both of its implementations

Neither was used, and the Windows version could lead to live-locks.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=43744
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=44609
Reviewed-by: Thiago Macieira <thiago@kde.org>
12 years agoNever use non-libdbus threading primitives
Simon McVittie [Mon, 20 Feb 2012 15:20:41 +0000 (15:20 +0000)]
Never use non-libdbus threading primitives

This lets us simplify considerably, by assuming that we always have both
recursive and suitable-for-condition-variable mutexes.

The Windows implementation has been compiled (on 32-bit mingw-w64)
but not tested. Justification for the approach used on Windows,
and in particular, using the existing "non-recursive" locks as if
they were recursive:

* We've been using them in conjunction with condition variables all
  along, so they'd better be suitable

* On fd.o #36204, Ralf points out that mutexes created via CreateMutex
  are, in fact, recursive

* Havoc's admonitions about requiring "Java-style" recursive locking
  (waiting for a condition variable while holding a recursive lock
  requires releasing that lock n times) turn out not to apply to
  either of our uses of DBusCondVar in DBusConnection, because the
  lock is only held for a short time, without calling into user code;
  indeed, our Unix implementation isn't recursive anyway, so if
  the Windows implementation reaches the deadlocking situation
  somehow (waiting for condition variable while locked more than once),
  the Unix implementation would already have deadlocked on the same
  code path (trying to lock more than once)

One possible alternative to a CreateMutex mutex for use with condition
variables would be a CRITICAL_SECTION. I'm not going to implement this,
but Windows developers are welcome to do so.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=36204
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=43744
Reviewed-by: Thiago Macieira <thiago@kde.org>
12 years agodbus-threads: improve documentation
Simon McVittie [Wed, 15 Feb 2012 11:49:06 +0000 (11:49 +0000)]
dbus-threads: improve documentation

This reinstates documentation for _dbus_mutex_new() and
_dbus_mutex_free(), and fixes some typos spotted during review.
It also documents the newly-introduced functions.

Reviewed-by: Thiago Macieira <thiago@kde.org>
12 years agoUse actual recursive pthreads mutexes, rather than NIH'ing them, wrong
Simon McVittie [Tue, 14 Feb 2012 19:02:20 +0000 (19:02 +0000)]
Use actual recursive pthreads mutexes, rather than NIH'ing them, wrong

Very loosely based on a patch from Sigmund Augdal.

For the moment, we make PTHREAD_MUTEX_RECURSIVE a hard requirement:
it's required by POSIX 2008 Base and SUSv2.

If your (non-Windows) platform doesn't have PTHREAD_MUTEX_RECURSIVE,
please report a bug on freedesktop.org bugzilla with details of the
platform in question.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=43744
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Thiago Macieira <thiago@kde.org>
12 years agoAllow both recursive and non-recursive mutexes to be supplied
Simon McVittie [Tue, 14 Feb 2012 18:38:48 +0000 (18:38 +0000)]
Allow both recursive and non-recursive mutexes to be supplied

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=43744
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Thiago Macieira <thiago@kde.org>
12 years agoDistinguish between two flavours of mutex
Simon McVittie [Tue, 14 Feb 2012 19:58:56 +0000 (19:58 +0000)]
Distinguish between two flavours of mutex

dbus-threads.h warns that recursive pthreads mutexes are not compatible
with our expectations for condition variables. However, the only two
condition variables we actually use only have their corresponding
mutexes locked briefly (and we don't call out to user code from there),
so the mutexes don't need to be recursive anyway. That's just as well,
because it turns out our implementation of recursive mutexes on
pthreads is broken!

The goal here is to be able to distinguish between "cmutexes" (mutexes
compatible with a condition variable) and "rmutexes" (mutexes which
are recursive if possible, to avoid deadlocking if we hold them while
calling user code).

This is complicated by the fact that callers are not guaranteed to have
provided us with both versions of mutexes, so we might have to implement
one by using the other (in particular, DBusRMutex *aims to be*
recursive, it is not *guaranteed to be* recursive).

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=43744
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Thiago Macieira <thiago@kde.org>
12 years agoMake _dbus_mutex_new, _dbus_mutex_free static
Simon McVittie [Tue, 14 Feb 2012 19:39:41 +0000 (19:39 +0000)]
Make _dbus_mutex_new, _dbus_mutex_free static

They're only called within their module.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=43744
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Thiago Macieira <thiago@kde.org>
12 years agoFixed runtime error caused by using uninitialized variable detected with msvc build.
Ralf Habacker [Mon, 20 Feb 2012 12:06:19 +0000 (13:06 +0100)]
Fixed runtime error caused by using uninitialized variable detected with msvc build.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=46335
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
12 years agoMerge branch 'dbus-1.4'
Simon McVittie [Mon, 20 Feb 2012 11:32:44 +0000 (11:32 +0000)]
Merge branch 'dbus-1.4'

Conflicts:
NEWS

12 years agoNEWS for 1.4
Simon McVittie [Mon, 20 Feb 2012 11:31:53 +0000 (11:31 +0000)]
NEWS for 1.4

12 years agodbus-protocol.h: compile under C++11
Marc Mutz [Thu, 16 Feb 2012 07:43:40 +0000 (08:43 +0100)]
dbus-protocol.h: compile under C++11

C++11 compilers have a feature called 'user-defined string literals' which
allow arbitrary string suffixes to have user-defined meaning.

This makes code that concatenates macros with string literals without
intervening whitespace illegal under C++11. Fortunately, string literal
concatenation has allowed intervening whitespace since the dawn of time,
so the solution is to simply pad with spaces.

Tested (header) with GCC 4.7 (trunk).

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=46147
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
12 years agoNEWS
Simon McVittie [Tue, 14 Feb 2012 16:31:39 +0000 (16:31 +0000)]
NEWS

12 years agodbus-send.1: document --reply-timeout
Simon McVittie [Wed, 8 Feb 2012 14:14:17 +0000 (14:14 +0000)]
dbus-send.1: document --reply-timeout

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=14005
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Lennart Poettering <lennart@poettering.net>
12 years agodbus-send.1, dbus-send: document --print-reply=literal consistently
Simon McVittie [Wed, 8 Feb 2012 14:14:01 +0000 (14:14 +0000)]
dbus-send.1, dbus-send: document --print-reply=literal consistently

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=14005
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Lennart Poettering <lennart@poettering.net>
12 years agodbus-send.1: use bold and italic type consistently
Simon McVittie [Wed, 8 Feb 2012 14:09:20 +0000 (14:09 +0000)]
dbus-send.1: use bold and italic type consistently

According to man-pages(7)

* bold is for literal text, the name of the thing being documented,
  or the name of another man page

* italic is for replaceable text, usually in all-caps

* normal type (in the SYNOPSIS) is for special syntax like the []
  indicating optional things

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=14005
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Lennart Poettering <lennart@poettering.net>
12 years agomore NEWS
Simon McVittie [Mon, 13 Feb 2012 17:57:23 +0000 (17:57 +0000)]
more NEWS

12 years agoadd and use _dbus_connection_trace_ref
Simon McVittie [Tue, 26 Jul 2011 15:35:57 +0000 (16:35 +0100)]
add and use _dbus_connection_trace_ref

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=37286
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Lennart Poettering <lennart@poettering.net>
12 years agoadd and use _dbus_server_trace_ref
Simon McVittie [Tue, 26 Jul 2011 15:28:41 +0000 (16:28 +0100)]
add and use _dbus_server_trace_ref

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=37286
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Lennart Poettering <lennart@poettering.net>
12 years agoadd and use _dbus_pending_call_trace_ref
Simon McVittie [Tue, 26 Jul 2011 15:16:28 +0000 (16:16 +0100)]
add and use _dbus_pending_call_trace_ref

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=37286
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Lennart Poettering <lennart@poettering.net>
12 years agoAdd and use _dbus_message_trace_ref
Simon McVittie [Mon, 19 Sep 2011 14:57:02 +0000 (15:57 +0100)]
Add and use _dbus_message_trace_ref

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=37286
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Lennart Poettering <lennart@poettering.net>
12 years agoProvide a hook to allow refcounting to be traced
Simon McVittie [Tue, 26 Jul 2011 14:52:56 +0000 (15:52 +0100)]
Provide a hook to allow refcounting to be traced

This is designed to be used from a wrapper function, partly to supply
the same arguments every time for a particular class of object, and partly
to provide a more specific gdb breakpoint. It has several purposes:

* when under gdb, provide a function which can be used in breakpoints
* when not under valgrind and DBUS_MESSAGE_TRACE=1 is set, emit a
  _dbus_verbose when a message's refcount changes
* when under valgrind and DBUS_MESSAGE_TRACE=1 is set, emit a
  VALGRIND_PRINTF_BACKTRACE when a message's refcount changes,
  which lets you see the complete history of each message to track down
  reference leaks

Compile-time support is currently conditional on DBUS_ENABLE_VERBOSE_MODE,
but could be separated out if desired.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=37286
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Lennart Poettering <lennart@poettering.net>
12 years agodbus_message_cache_or_finalize: allow message cache to be disabled at runtime
Simon McVittie [Thu, 12 May 2011 12:01:32 +0000 (13:01 +0100)]
dbus_message_cache_or_finalize: allow message cache to be disabled at runtime

This should make it easier to diagnose message-related ref leaks,
use-after-free, etc. with Valgrind: for optimal results (and pessimal
performance), we want to avoid re-using memory blocks for as long as
possible.

For now this is conditional on DBUS_BUILD_TESTS. It could get its own
conditional if desired.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=37286
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Lennart Poettering <lennart@poettering.net>
12 years agoDBusMemPool: inform valgrind what we're up to
Simon McVittie [Thu, 12 May 2011 11:56:22 +0000 (12:56 +0100)]
DBusMemPool: inform valgrind what we're up to

If we tell valgrind what we're doing, it can give better diagnostics.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=37286
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Lennart Poettering <lennart@poettering.net>
12 years agoAdd support for inserting (a subset of) Valgrind client requests
Simon McVittie [Mon, 13 Feb 2012 17:53:51 +0000 (17:53 +0000)]
Add support for inserting (a subset of) Valgrind client requests

If valgrind support is disabled, we define stub versions of the
Valgrind client requests I plan to use, so the actual code doesn't
need #ifdef hell.

[With unnecessary AC_SUBST removed as per Lennart's review -smcv]

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=37286
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Lennart Poettering <lennart@poettering.net>