platform/upstream/dbus.git
7 years ago_dbus_warn, _dbus_warn_check_failed: unify with _dbus_logv
Simon McVittie [Wed, 20 Jul 2016 08:25:57 +0000 (09:25 +0100)]
_dbus_warn, _dbus_warn_check_failed: unify with _dbus_logv

This means that dbus-daemon will log something like

    dbus-daemon[123]: Unable to add reload watch to main loop

to syslog and/or stderr according to its configuration, while other
libdbus users will print something like this to stderr:

    dbus[4567]: arguments to dbus_foo() were incorrect, assertion
    "connection != NULL" failed at file dbus-foo.c line 123.
    This is normally a bug in some application using the D-Bus library.

This slightly changes the meaning of the argument to _dbus_warn()
and _dbus_warn_check_failed. Previously, a trailing newline was
expected, and a missing newline would have resulted in incorrect
output. Now, a newline is supplied automatically by the
library (like g_warning()), and messages that end with a newline will
result in an unnecessary extra newline in output.

This extra newline is harmless, so I'm not going to change all the
callers immediately.

Signed-off-by: Simon McVittie <smcv@debian.org>
7 years agobus_context_log: remove special handling of !context->syslog
Simon McVittie [Wed, 20 Jul 2016 08:28:02 +0000 (09:28 +0100)]
bus_context_log: remove special handling of !context->syslog

_dbus_log() and _dbus_logv() are always the right functions to call now.

Signed-off-by: Simon McVittie <smcv@debian.org>
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97009

7 years ago_dbus_logv: configurably log to syslog and/or stderr
Simon McVittie [Fri, 12 Aug 2016 16:59:45 +0000 (17:59 +0100)]
_dbus_logv: configurably log to syslog and/or stderr

This changes the behaviour of _dbus_logv() if _dbus_init_system_log() was
not called. Previously, _dbus_logv() would always log to syslog;
additionally, it would log to stderr, unless the process is dbus-daemon
and it was started by systemd. Now, it will log to stderr only,
unless _dbus_init_system_log() was called first.

This is the desired behaviour because when we hook up
_dbus_warn_check_failed() to _dbus_logv() in the next commit, we don't
want typical users of libdbus to start logging their check failures to
syslog - we only want the dbus-daemon to do that.

In practice this is not usually a behaviour change, because there was
only one situation in which we called _dbus_logv() without first calling
_dbus_init_system_log(), namely an error while parsing configuration
files. Initialize the system log "just in time" in that situation
to preserve existing behaviour.

Signed-off-by: Simon McVittie <smcv@debian.org>
7 years agoUpdate autoconf-archive, and use snapshot.debian.org
Simon McVittie [Fri, 30 Sep 2016 18:35:59 +0000 (19:35 +0100)]
Update autoconf-archive, and use snapshot.debian.org

This way the link won't expire in future.

Signed-off-by: Simon McVittie <smcv@debian.org>
8 years agoFix building with CMake for a Unix platform where functions like recv() are in a...
Ralf Habacker [Wed, 17 Aug 2016 16:43:41 +0000 (18:43 +0200)]
Fix building with CMake for a Unix platform where functions like recv() are in a separate -lsocket, like QNX.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=94096
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
8 years agoFix building with CMake for a Unix platform that does not have -lrt, such as Android.
Ralf Habacker [Wed, 17 Aug 2016 16:42:02 +0000 (18:42 +0200)]
Fix building with CMake for a Unix platform that does not have -lrt, such as Android.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=94096
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
8 years agoDocument default limits in system.conf.in
Simon McVittie [Tue, 18 Nov 2014 13:46:39 +0000 (13:46 +0000)]
Document default limits in system.conf.in

I left them commented out to minimize the impact if we change them in
one place and not the other, but we should try to keep them in sync
anyway.

8 years agoLog max_pending_service_starts (aka max_pending_activations) when exceeded
Simon McVittie [Tue, 18 Nov 2014 12:35:28 +0000 (12:35 +0000)]
Log max_pending_service_starts (aka max_pending_activations) when exceeded

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

8 years agoLog service_start_timeout (aka activation_timeout) when we exceed it
Simon McVittie [Tue, 18 Nov 2014 19:12:01 +0000 (19:12 +0000)]
Log service_start_timeout (aka activation_timeout) when we exceed it

Also upgrade it to a warning.

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

8 years agodbus-daemon test: exercise pending fd timeout test
Simon McVittie [Tue, 16 Aug 2016 17:27:43 +0000 (18:27 +0100)]
dbus-daemon test: exercise pending fd timeout test

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
8 years agoLog to syslog when pending_fd_timeout is exceeded
Simon McVittie [Tue, 16 Aug 2016 15:12:35 +0000 (16:12 +0100)]
Log to syslog when pending_fd_timeout is exceeded

This is either a denial-of-service attempt, a pathological performance
problem or a dbus-daemon bug. Sysadmins should be told about any of
these.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=86442
[smcv: add units to timeout: it is in milliseconds]
Signed-off-by: Simon McVittie <smcv@debian.org>
8 years agodbus-daemon test: exercise max_names_per_connection limit
Simon McVittie [Fri, 1 Jul 2016 12:17:23 +0000 (13:17 +0100)]
dbus-daemon test: exercise max_names_per_connection limit

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=86442
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
8 years agoLog when we exceed max_names_per_connection (aka max_services_per_connection)
Simon McVittie [Tue, 18 Nov 2014 19:19:37 +0000 (19:19 +0000)]
Log when we exceed max_names_per_connection (aka max_services_per_connection)

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

8 years agodbus-daemon test: exercise maximum match rules per connection
Simon McVittie [Fri, 1 Jul 2016 12:07:49 +0000 (13:07 +0100)]
dbus-daemon test: exercise maximum match rules per connection

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=86442
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
8 years agoLog when we exceed max_match_rules_per_connection
Simon McVittie [Tue, 18 Nov 2014 19:19:16 +0000 (19:19 +0000)]
Log when we exceed max_match_rules_per_connection

8 years agodbus-daemon test: exercise maximum replies per connection
Simon McVittie [Fri, 1 Jul 2016 12:02:04 +0000 (13:02 +0100)]
dbus-daemon test: exercise maximum replies per connection

This time we're doing so deliberately.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=86442
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
8 years agodbus-daemon test: avoid reaching pending reply limit
Simon McVittie [Fri, 1 Jul 2016 11:38:33 +0000 (12:38 +0100)]
dbus-daemon test: avoid reaching pending reply limit

We were not actually doing what was intended (flooding the bus with
10k or 100k messages for the other side) because the bus was limiting
the sender to 128 parallel method calls.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=86442
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
8 years agoLog when we exceed max_replies_per_connection
Simon McVittie [Tue, 18 Nov 2014 19:18:47 +0000 (19:18 +0000)]
Log when we exceed max_replies_per_connection

8 years agodbus-daemon test: exercise maximum connection counts
Simon McVittie [Fri, 1 Jul 2016 11:30:22 +0000 (12:30 +0100)]
dbus-daemon test: exercise maximum connection counts

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=86442
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
8 years agoLog to syslog if max_completed_connections or max_connections_per_user are exceeded
Simon McVittie [Fri, 1 Jul 2016 10:53:17 +0000 (11:53 +0100)]
Log to syslog if max_completed_connections or max_connections_per_user are exceeded

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

8 years agoOnly compile test-bus-launch-helper, etc. if embedded tests are enabled
Simon McVittie [Thu, 11 Feb 2016 20:43:23 +0000 (20:43 +0000)]
Only compile test-bus-launch-helper, etc. if embedded tests are enabled

These source files are specific to the embedded tests and make no sense
otherwise.

Also remove a comment in the CMake build system about fixing the
build of the activation helper on Windows: the activation helper
is Unix-specific and always will be, since it relies on Unix setuid
to function.

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

8 years agoMerge remote-tracking branch 'github/master'
Simon McVittie [Mon, 15 Aug 2016 23:25:01 +0000 (00:25 +0100)]
Merge remote-tracking branch 'github/master'

8 years ago1.11.5
Simon McVittie [Mon, 15 Aug 2016 23:21:48 +0000 (00:21 +0100)]
1.11.5

8 years agoMerge remote-tracking branch 'origin/master'
Simon McVittie [Mon, 15 Aug 2016 23:21:19 +0000 (00:21 +0100)]
Merge remote-tracking branch 'origin/master'

8 years ago1.11.4
Simon McVittie [Mon, 15 Aug 2016 20:44:06 +0000 (21:44 +0100)]
1.11.4

8 years agoMerge branch 'dbus-1.10'
Simon McVittie [Mon, 15 Aug 2016 20:38:52 +0000 (21:38 +0100)]
Merge branch 'dbus-1.10'

8 years agoTravis-CI: fetch a newer autoconf-archive from Debian
Simon McVittie [Mon, 15 Aug 2016 19:41:28 +0000 (20:41 +0100)]
Travis-CI: fetch a newer autoconf-archive from Debian

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
8 years agoTravis-CI: install new autoconf-archive build-dependency
Simon McVittie [Mon, 15 Aug 2016 19:12:19 +0000 (20:12 +0100)]
Travis-CI: install new autoconf-archive build-dependency

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
8 years agoautogen.sh: fail cleanly if autoconf fails
Simon McVittie [Mon, 15 Aug 2016 19:11:49 +0000 (20:11 +0100)]
autogen.sh: fail cleanly if autoconf fails

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
8 years ago1.10.10
Simon McVittie [Mon, 15 Aug 2016 18:59:18 +0000 (19:59 +0100)]
1.10.10

Signed-off-by: Simon McVittie <smcv@debian.org>
8 years agoname-test, tools: add missing COVERAGE_CFLAGS
Simon McVittie [Mon, 15 Aug 2016 14:15:13 +0000 (15:15 +0100)]
name-test, tools: add missing COVERAGE_CFLAGS

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
8 years agoDocument use of AX_CODE_COVERAGE
Simon McVittie [Mon, 15 Aug 2016 13:29:56 +0000 (14:29 +0100)]
Document use of AX_CODE_COVERAGE

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
8 years agoUse AX_CODE_COVERAGE for test-coverage statistics
Thomas Zimmermann [Fri, 12 Aug 2016 08:50:53 +0000 (10:50 +0200)]
Use AX_CODE_COVERAGE for test-coverage statistics

DBus uses custom rules in its Makefiles to implement test-coverage
statistics.

This patch implements test-coverage statistics with the autoconf macro
AX_CODE_COVERAGE. The script automatically tests for tools (e.g., gcov,
lcov), sets build variables and creates Makefile rules.

Run 'configure' with '--enable-code-coverage' to enable support for
test-coverage statistics. Run 'make check-code-coverage' to run the
tests and generate the statistics.

Signed-off-by: Thomas Zimmermann <tdz@users.sourceforge.net>
[smcv: do not alter compiler.m4; move AM_CXXFLAGS to the one place we
compile C++]
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=88922

8 years agoMerge branch 'dbus-1.10'
Simon McVittie [Fri, 12 Aug 2016 17:24:10 +0000 (18:24 +0100)]
Merge branch 'dbus-1.10'

8 years agoAdd a regression test for dbus-launch in X11
Simon McVittie [Fri, 12 Aug 2016 09:58:13 +0000 (10:58 +0100)]
Add a regression test for dbus-launch in X11

[Modified for the dbus-1.10 branch: DBUS_USE_TEST_BINARY is needed.]

Signed-off-by: Simon McVittie <smcv@debian.org>
8 years agotest-dbus-daemon-fork: exercise closed stdin, stdout, stderr
Simon McVittie [Wed, 20 Jul 2016 12:31:50 +0000 (13:31 +0100)]
test-dbus-daemon-fork: exercise closed stdin, stdout, stderr

Signed-off-by: Simon McVittie <smcv@debian.org>
8 years agotest: expand dbus-launch-eval test to cover stdin being closed
Simon McVittie [Wed, 20 Jul 2016 11:07:03 +0000 (12:07 +0100)]
test: expand dbus-launch-eval test to cover stdin being closed

Signed-off-by: Simon McVittie <smcv@debian.org>
8 years agoAdd a simple test for dbus-daemon --fork
Simon McVittie [Wed, 20 Jul 2016 12:12:45 +0000 (13:12 +0100)]
Add a simple test for dbus-daemon --fork

[Modified for the dbus-1.10 branch: DBUS_USE_TEST_BINARY is needed.]

Signed-off-by: Simon McVittie <smcv@debian.org>
8 years agotest: add a regression test for eval "$(dbus-launch --sh-syntax)"
Simon McVittie [Wed, 20 Jul 2016 11:00:34 +0000 (12:00 +0100)]
test: add a regression test for eval "$(dbus-launch --sh-syntax)"

[Modified for the dbus-1.10 branch: DBUS_USE_TEST_BINARY is needed.]

Signed-off-by: Simon McVittie <smcv@debian.org>
8 years agotest-dbus-launch-x11: extend to cover --exit-with-x11
Simon McVittie [Fri, 12 Aug 2016 10:12:59 +0000 (11:12 +0100)]
test-dbus-launch-x11: extend to cover --exit-with-x11

Signed-off-by: Simon McVittie <smcv@debian.org>
8 years agoAdd a regression test for dbus-launch in X11
Simon McVittie [Fri, 12 Aug 2016 09:58:13 +0000 (10:58 +0100)]
Add a regression test for dbus-launch in X11

Signed-off-by: Simon McVittie <smcv@debian.org>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97008

8 years agotest-dbus-daemon-fork: exercise closed stdin, stdout, stderr
Simon McVittie [Wed, 20 Jul 2016 12:31:50 +0000 (13:31 +0100)]
test-dbus-daemon-fork: exercise closed stdin, stdout, stderr

Signed-off-by: Simon McVittie <smcv@debian.org>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97008

8 years agoAdd a simple test for dbus-daemon --fork
Simon McVittie [Wed, 20 Jul 2016 12:12:45 +0000 (13:12 +0100)]
Add a simple test for dbus-daemon --fork

Signed-off-by: Simon McVittie <smcv@debian.org>
Reviewed-by: Colin Walters
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97008

8 years agotest: add a regression test for eval "$(dbus-launch --sh-syntax)"
Simon McVittie [Wed, 20 Jul 2016 11:00:34 +0000 (12:00 +0100)]
test: add a regression test for eval "$(dbus-launch --sh-syntax)"

Signed-off-by: Simon McVittie <smcv@debian.org>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97008

8 years ago_dbus_change_to_daemon_user (audit code path): set DBusError correctly
Simon McVittie [Thu, 21 Jul 2016 09:55:06 +0000 (10:55 +0100)]
_dbus_change_to_daemon_user (audit code path): set DBusError correctly

The other error cases here all set the error instead of just warning.

Signed-off-by: Simon McVittie <smcv@debian.org>
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97009

8 years agoRemove trailing newlines from _dbus_assert_not_reached
Simon McVittie [Thu, 21 Jul 2016 09:59:50 +0000 (10:59 +0100)]
Remove trailing newlines from _dbus_assert_not_reached

This was never necessary: _dbus_assert_not_reached() always added one.

Signed-off-by: Simon McVittie <smcv@debian.org>
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97009

8 years agodbus-daemon, dbus-launch: cope with callers having closed standard fds
Simon McVittie [Thu, 21 Jul 2016 07:24:38 +0000 (08:24 +0100)]
dbus-daemon, dbus-launch: cope with callers having closed standard fds

In Debian bug <https://bugs.debian.org/829348>, lightdm appears to
have been starting dbus-launch with at least one of the three
standard fds 0, 1, 2 (stdin, stdout, stderr) closed. This resulted
in the dbus-daemon's epoll_create1() returning a fd less than 3.
Later, _dbus_become_daemon() replaces fds 0-2 with /dev/null. As a
result, a subsequent call to _dbus_loop_add_watch() for the reload
pipe resulted in calling epoll_ctl on the non-epoll fd pointing to
/dev/null, which fails with EINVAL, resulting in the dbus-daemon
exiting unsuccessfully.

Unix programs are not normally expected to behave correctly when
launched with the standard fds not already open; but at the same time,
X11 autolaunching means that dbus-launch (and hence the dbus-daemon)
can get started from an arbitrarily precarious situation.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97008
Signed-off-by: Simon McVittie <smcv@debian.org>
Reviewed-by: Thiago Macieira <thiago@kde.org>
(cherry picked from commit c8f73a2a3a9d9d10587f596a62ebb64e8963197e)

8 years ago_dbus_ensure_standard_fds: new function to ensure std* fds are open
Simon McVittie [Thu, 21 Jul 2016 07:23:12 +0000 (08:23 +0100)]
_dbus_ensure_standard_fds: new function to ensure std* fds are open

This function opens stdin, stdout, stderr pointing to /dev/null
if they aren't already open. Optionally, it can also replace
whatever is available on those fds with /dev/null.

To allow for use in contexts where only async-signal-safe functions
should be used, such as between fork() and a following exec(),
this function does not use conventional libdbus error handling
(which would require malloc). Instead, it sets errno and returns
an explanatory string.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97008
Signed-off-by: Simon McVittie <smcv@debian.org>
Reviewed-by: Thiago Macieira <thiago@kde.org>
(cherry picked from commit 69123a6bd2adabbaec1f770fc4573fc3ed4ceca6)

8 years agovarious tests: produce better diagnostics on error
Simon McVittie [Mon, 11 Jul 2016 10:09:26 +0000 (11:09 +0100)]
various tests: produce better diagnostics on error

Same root cause as <https://bugs.freedesktop.org/show_bug.cgi?id=96653>:
we didn't check whether the message was in fact an error reply.

Signed-off-by: Simon McVittie <smcv@debian.org>
8 years agoMore NEWS for 1.11
Simon McVittie [Fri, 12 Aug 2016 09:17:46 +0000 (10:17 +0100)]
More NEWS for 1.11

8 years agoMerge branch 'dbus-1.10'
Simon McVittie [Fri, 12 Aug 2016 09:14:46 +0000 (10:14 +0100)]
Merge branch 'dbus-1.10'

8 years agoNEWS for 1.10
Simon McVittie [Fri, 12 Aug 2016 09:12:28 +0000 (10:12 +0100)]
NEWS for 1.10

8 years agoMark WaitingForOK state as unused
Simon McVittie [Thu, 11 Aug 2016 15:08:39 +0000 (16:08 +0100)]
Mark WaitingForOK state as unused

It should probably be used (see #97298) but the fact that it isn't
is breaking compatibility with gcc 6, so apply a quick workaround
while we look into what's wrong here.

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97282
(cherry picked from commit 21d61180819c141e779d6ecf9919e62e768b6fd9)

8 years agoupdate-activation-environment: produce better diagnostics on error
Simon McVittie [Mon, 11 Jul 2016 09:52:44 +0000 (10:52 +0100)]
update-activation-environment: produce better diagnostics on error

If dbus-daemon or systemd replied to our method call with an error,
we would report it as "invalid arguments" instead of the true error
name and message.

Same root cause as <https://bugs.freedesktop.org/show_bug.cgi?id=96653>.

Signed-off-by: Simon McVittie <smcv@debian.org>
8 years agoconfig-parser: remove unnecessary newline from _dbus_log()
Simon McVittie [Wed, 20 Jul 2016 07:55:55 +0000 (08:55 +0100)]
config-parser: remove unnecessary newline from _dbus_log()

_dbus_log() already adds a newline.

Signed-off-by: Simon McVittie <smcv@debian.org>
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97009

8 years ago_dbus_system_log: rename to _dbus_log
Simon McVittie [Wed, 20 Jul 2016 07:55:14 +0000 (08:55 +0100)]
_dbus_system_log: rename to _dbus_log

This is a step towards making it write to either stderr or syslog
or both, as configured globally.

Signed-off-by: Simon McVittie <smcv@debian.org>
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97009

8 years ago_dbus_init_system_log: record a syslog tag (executable name)
Simon McVittie [Thu, 21 Jul 2016 09:29:10 +0000 (10:29 +0100)]
_dbus_init_system_log: record a syslog tag (executable name)

Instead of hard-coding "dbus", report what the executable really is.

Signed-off-by: Simon McVittie <smcv@debian.org>
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97009

8 years agosysdeps: move _dbus_system_log() into the shared library
Simon McVittie [Wed, 20 Jul 2016 09:07:12 +0000 (10:07 +0100)]
sysdeps: move _dbus_system_log() into the shared library

This is in preparation for optionally making _dbus_warn() use it.
dbus-daemon closes its stderr under some circumstances, including
when launched by dbus-launch, which makes failures in that
situation rather hard to debug.

_dbus_system_log() is the same on Unix and Windows, so move it
to dbus-sysdeps.c. _dbus_system_logv() remains platform-specific.

Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97009
[smcv: move the #include for syslog.h, too]
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
8 years agotest-bus: don't write to the syslog
Simon McVittie [Wed, 20 Jul 2016 09:14:51 +0000 (10:14 +0100)]
test-bus: don't write to the syslog

We want to emulate the behaviour of the system bus, but we don't
really want to spam the system log with lots of test messages.

Signed-off-by: Simon McVittie <smcv@debian.org>
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97009

8 years agoFix misleading indentation to avoid respective compiler warning
Thomas Zimmermann [Tue, 9 Aug 2016 16:22:04 +0000 (18:22 +0200)]
Fix misleading indentation to avoid respective compiler warning

Signed-off-by: Thomas Zimmermann <tdz@users.sourceforge.net>
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97282

8 years agoProtect 'i' in _handle_inotify_watch by DBUS_ENABLE_VERBOSE_MODE
Thomas Zimmermann [Tue, 9 Aug 2016 16:19:56 +0000 (18:19 +0200)]
Protect 'i' in _handle_inotify_watch by DBUS_ENABLE_VERBOSE_MODE

Signed-off-by: Thomas Zimmermann <tdz@users.sourceforge.net>
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97282

8 years agoInitialize 'klass' in _dbus_type_reader_recurse to NULL
Thomas Zimmermann [Tue, 9 Aug 2016 14:48:59 +0000 (16:48 +0200)]
Initialize 'klass' in _dbus_type_reader_recurse to NULL

Initializing 'klass' in _dbus_type_reader_recurse avoids a
compile-time warning about the variable being uninitialized.

Signed-off-by: Thomas Zimmermann <tdz@users.sourceforge.net>
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97282

8 years agoProtect 'orig_len' in recover_unused_bytes by DBUS_ENABLE_VERBOSE_MODE
Thomas Zimmermann [Tue, 9 Aug 2016 16:26:56 +0000 (18:26 +0200)]
Protect 'orig_len' in recover_unused_bytes by DBUS_ENABLE_VERBOSE_MODE

Signed-off-by: Thomas Zimmermann <tdz@users.sourceforge.net>
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97282

8 years agodbus-launch: Protect concat2 by DBUS_ENABLE_EMBEDDED_TESTS
Thomas Zimmermann [Tue, 9 Aug 2016 16:15:25 +0000 (18:15 +0200)]
dbus-launch: Protect concat2 by DBUS_ENABLE_EMBEDDED_TESTS

Signed-off-by: Thomas Zimmermann <tdz@users.sourceforge.net>
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97282

8 years agoMark WaitingForOK state as unused
Simon McVittie [Thu, 11 Aug 2016 15:08:39 +0000 (16:08 +0100)]
Mark WaitingForOK state as unused

It should probably be used (see #97298) but the fact that it isn't
is breaking compatibility with gcc 6, so apply a quick workaround
while we look into what's wrong here.

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

8 years agoMerge branch 'dbus-1.10'
Simon McVittie [Fri, 29 Jul 2016 18:15:21 +0000 (19:15 +0100)]
Merge branch 'dbus-1.10'

8 years agoNEWS for 1.10 branch
Simon McVittie [Fri, 29 Jul 2016 18:14:18 +0000 (19:14 +0100)]
NEWS for 1.10 branch

8 years agoconfigure.ac: explicitely check stdint.h
Ioan-Adrian Ratiu [Thu, 28 Jul 2016 22:19:37 +0000 (01:19 +0300)]
configure.ac: explicitely check stdint.h

Otherwise HAVE_STDINT_H will not be defined or the var will not be
picked up from cache so builds could fail with errors like:
| ../../dbus-1.10.8/dbus/dbus-internals.h:239:8: error: ‘uintptr_t’ undeclared (first use in this function)

Signed-off-by: Ioan-Adrian Ratiu <adrian.ratiu@ni.com>
[smcv: fix Autoconf underquoting]
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
8 years agoMerge branch 'dbus-1.10'
Simon McVittie [Mon, 25 Jul 2016 11:11:39 +0000 (12:11 +0100)]
Merge branch 'dbus-1.10'

8 years agoUpdate NEWS for 1.11
Simon McVittie [Mon, 25 Jul 2016 11:11:00 +0000 (12:11 +0100)]
Update NEWS for 1.11

8 years agoUpdate NEWS for merge of dbus-1.10-ci branch
Simon McVittie [Mon, 25 Jul 2016 10:53:13 +0000 (11:53 +0100)]
Update NEWS for merge of dbus-1.10-ci branch

8 years agoMerge branch 'dbus-1.10-ci' into dbus-1.10
Simon McVittie [Mon, 25 Jul 2016 10:43:54 +0000 (11:43 +0100)]
Merge branch 'dbus-1.10-ci' into dbus-1.10

8 years ago_read_subprocess_line_argv: use _dbus_ensure_standard_fds
Simon McVittie [Thu, 21 Jul 2016 07:27:36 +0000 (08:27 +0100)]
_read_subprocess_line_argv: use _dbus_ensure_standard_fds

This also gives us an opportunity to improve the error reporting.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97008
Signed-off-by: Simon McVittie <smcv@debian.org>
Reviewed-by: Thiago Macieira <thiago@kde.org>
8 years agodbus-launch: use _dbus_ensure_standard_fds when closing stderr
Simon McVittie [Thu, 21 Jul 2016 07:27:06 +0000 (08:27 +0100)]
dbus-launch: use _dbus_ensure_standard_fds when closing stderr

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97008
Signed-off-by: Simon McVittie <smcv@debian.org>
Reviewed-by: Thiago Macieira <thiago@kde.org>
8 years agodbus-launch: use _dbus_ensure_standard_fds() in the babysitter
Simon McVittie [Thu, 21 Jul 2016 07:26:40 +0000 (08:26 +0100)]
dbus-launch: use _dbus_ensure_standard_fds() in the babysitter

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97008
Signed-off-by: Simon McVittie <smcv@debian.org>
Reviewed-by: Thiago Macieira <thiago@kde.org>
8 years ago_dbus_become_daemon: use _dbus_ensure_standard_fds, and report errors
Simon McVittie [Thu, 21 Jul 2016 07:25:21 +0000 (08:25 +0100)]
_dbus_become_daemon: use _dbus_ensure_standard_fds, and report errors

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97008
Signed-off-by: Simon McVittie <smcv@debian.org>
Reviewed-by: Thiago Macieira <thiago@kde.org>
8 years agodbus-daemon, dbus-launch: cope with callers having closed standard fds
Simon McVittie [Thu, 21 Jul 2016 07:24:38 +0000 (08:24 +0100)]
dbus-daemon, dbus-launch: cope with callers having closed standard fds

In Debian bug <https://bugs.debian.org/829348>, lightdm appears to
have been starting dbus-launch with at least one of the three
standard fds 0, 1, 2 (stdin, stdout, stderr) closed. This resulted
in the dbus-daemon's epoll_create1() returning a fd less than 3.
Later, _dbus_become_daemon() replaces fds 0-2 with /dev/null. As a
result, a subsequent call to _dbus_loop_add_watch() for the reload
pipe resulted in calling epoll_ctl on the non-epoll fd pointing to
/dev/null, which fails with EINVAL, resulting in the dbus-daemon
exiting unsuccessfully.

Unix programs are not normally expected to behave correctly when
launched with the standard fds not already open; but at the same time,
X11 autolaunching means that dbus-launch (and hence the dbus-daemon)
can get started from an arbitrarily precarious situation.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97008
Signed-off-by: Simon McVittie <smcv@debian.org>
Reviewed-by: Thiago Macieira <thiago@kde.org>
8 years ago_dbus_ensure_standard_fds: new function to ensure std* fds are open
Simon McVittie [Thu, 21 Jul 2016 07:23:12 +0000 (08:23 +0100)]
_dbus_ensure_standard_fds: new function to ensure std* fds are open

This function opens stdin, stdout, stderr pointing to /dev/null
if they aren't already open. Optionally, it can also replace
whatever is available on those fds with /dev/null.

To allow for use in contexts where only async-signal-safe functions
should be used, such as between fork() and a following exec(),
this function does not use conventional libdbus error handling
(which would require malloc). Instead, it sets errno and returns
an explanatory string.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97008
Signed-off-by: Simon McVittie <smcv@debian.org>
Reviewed-by: Thiago Macieira <thiago@kde.org>
8 years agodbus: do not include unused afxres.h on windows.
Ralf Habacker [Wed, 25 May 2016 08:54:32 +0000 (10:54 +0200)]
dbus: do not include unused afxres.h on windows.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=96181
Reviewed-by: simon.mcvittie@collabora.co.uk
8 years agodbus-launch: add --exit-with-x11 option
Simon McVittie [Mon, 11 Jul 2016 11:10:39 +0000 (12:10 +0100)]
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.

We read the machine UUID because it is needed to set the X atoms.
x11_init() assumes that the machine UUID (global variable) has been
set, either via read_machine_uuid_if_needed() or save_machine_uuid().
This is pretty tangled, but to make The Right Thing happen
automatically, we'd need to redo dbus-launch in terms of DBusError.

Reviewed-by: Will Thompson
Reviewed-by: Thiago Macieira
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=39197
Signed-off-by: Simon McVittie <smcv@debian.org>
8 years agoBe explicit about enum comparison in bus_config_load()
Deepika Aggarwal [Thu, 3 Dec 2015 05:52:56 +0000 (11:22 +0530)]
Be explicit about enum comparison in bus_config_load()

XML_Parse() can potentially return values other than OK (1) or ERROR (0),
and they aren't errors.

Signed-off-by: Deepika Aggarwal <deepika.a@samsung.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=93205
[smcv: improve commit message, fix whitespace]
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
8 years agobus: reassure static analysis tool that server slot allocation can't fail
Deepika Aggarwal [Mon, 7 Dec 2015 11:26:06 +0000 (16:56 +0530)]
bus: reassure static analysis tool that server slot allocation can't fail

The NULL-dereference is not actually possible in this case, because we
know that the allocation and setup were done previously.

Signed-off-by: Deepika Aggarwal <deepika.a@samsung.com>
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=93210

8 years agoAdd an invalid state in DBusAuthState to use for invalid lines in auth scripts.
Nick Lewycky [Thu, 28 Jan 2016 20:58:43 +0000 (12:58 -0800)]
Add an invalid state in DBusAuthState to use for invalid lines in auth scripts.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=93909
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
8 years agoNEWS for 1.11.x
Simon McVittie [Thu, 30 Jun 2016 13:47:21 +0000 (14:47 +0100)]
NEWS for 1.11.x

8 years agoMerge branch 'dbus-1.10'
Simon McVittie [Thu, 30 Jun 2016 13:41:23 +0000 (14:41 +0100)]
Merge branch 'dbus-1.10'

8 years agoUpdate NEWS
Simon McVittie [Thu, 30 Jun 2016 13:40:24 +0000 (14:40 +0100)]
Update NEWS

8 years agospec: Clarify the marshaling format in a few minor ways
Philip Withnall [Tue, 15 Dec 2015 09:25:36 +0000 (09:25 +0000)]
spec: Clarify the marshaling format in a few minor ways

This is an attempt to make that section a little clearer. I don’t think
any factual inaccuracies have been fixed (because I couldn’t find any).

Including some wording and an example by Simon McVittie.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=93382
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
8 years agoMerge branch 'dbus-1.10' into dbus-1.10-ci
Simon McVittie [Thu, 30 Jun 2016 12:57:29 +0000 (13:57 +0100)]
Merge branch 'dbus-1.10' into dbus-1.10-ci

8 years agoMerge branch 'dbus-1.10'
Simon McVittie [Thu, 30 Jun 2016 12:56:44 +0000 (13:56 +0100)]
Merge branch 'dbus-1.10'

8 years agoactivation: set children oom_score_adj to 0
WaLyong Cho [Tue, 7 Jun 2016 14:26:42 +0000 (23:26 +0900)]
activation: set children oom_score_adj to 0

If dbus is running as systemd service, dbus daemon is running with
oom_score_adj -900 by OOMScoreAdjust=-900. And children will also have
same value with dbus daemon.
To avoid this, set the child itself values after fork () to 0.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=32851
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
8 years agoUse dbus_set_error_from_message() to check for an error
Руслан Ижбулатов [Thu, 23 Jun 2016 12:26:45 +0000 (12:26 +0000)]
Use dbus_set_error_from_message() to check for an error

Do not rely on dbus_message_get_args() to turn an ERROR message
into DBusError.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=96653
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
8 years agoQuote the DBUS_SESSION_BUS_ADDRESS variable in the shell file
Thiago Macieira [Tue, 29 Mar 2016 19:15:15 +0000 (12:15 -0700)]
Quote the DBUS_SESSION_BUS_ADDRESS variable in the shell file

Some D-Bus daemon versions set multiple addresses separated by semi-colon,
which breaks sourcing of the file.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=94746
Signed-off-by: Thiago Macieira <thiago@kde.org>
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
8 years agoQuote the DBUS_SESSION_BUS_ADDRESS variable in the shell file
Thiago Macieira [Tue, 29 Mar 2016 19:15:15 +0000 (12:15 -0700)]
Quote the DBUS_SESSION_BUS_ADDRESS variable in the shell file

Some D-Bus daemon versions set multiple addresses separated by semi-colon,
which breaks sourcing of the file.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=94746
Signed-off-by: Thiago Macieira <thiago@kde.org>
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
8 years agoMigrate platform specific spawn tests into cross platform tests.
Ralf Habacker [Mon, 16 May 2016 13:35:01 +0000 (15:35 +0200)]
Migrate platform specific spawn tests into cross platform tests.

Also enable segfault checks on windows because the reason why it
has been disabled has been fixed with bug #95155.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=95191
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
8 years agotravis: compile with mingw in both production and debug flavours
Simon McVittie [Mon, 16 May 2016 12:48:37 +0000 (13:48 +0100)]
travis: compile with mingw in both production and debug flavours

This should detect anything that is only a build failure when embedded
tests or verbose mode are enabled, such as the missing include fixed
in commit 4858faf. I'm not enabling embedded tests and verbose mode
orthogonally because we don't want CI builds to take too long.

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
(cherry picked from commit 8f6fe1451ead14b82475177f40bbc2c256cba876)

8 years agoMerge branch 'dbus-1.10' into dbus-1.10-ci
Simon McVittie [Wed, 18 May 2016 17:14:16 +0000 (18:14 +0100)]
Merge branch 'dbus-1.10' into dbus-1.10-ci

8 years agotest-segfault: add missing include of <stdio.h> on Windows
Simon McVittie [Mon, 16 May 2016 13:10:36 +0000 (14:10 +0100)]
test-segfault: add missing include of <stdio.h> on Windows

Needed for fprintf (stderr, ...).

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
(cherry picked from commit 07b7dcd7178f927cd0b3a3282396b7f99c0b1d29)

8 years agotravis: compile with mingw in both production and debug flavours
Simon McVittie [Mon, 16 May 2016 12:48:37 +0000 (13:48 +0100)]
travis: compile with mingw in both production and debug flavours

This should detect anything that is only a build failure when embedded
tests or verbose mode are enabled, such as the missing include fixed
in commit 4858faf. I'm not enabling embedded tests and verbose mode
orthogonally because we don't want CI builds to take too long.

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
8 years agotest-segfault: add missing include of <stdio.h> on Windows
Simon McVittie [Mon, 16 May 2016 13:10:36 +0000 (14:10 +0100)]
test-segfault: add missing include of <stdio.h> on Windows

Needed for fprintf (stderr, ...).

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
8 years agoFix memory leak issue in spawn code on Windows.
Ralf Habacker [Sat, 14 May 2016 09:42:04 +0000 (11:42 +0200)]
Fix memory leak issue in spawn code on Windows.

In _dbus_babysitter_block_for_child_exit () use spawning
thread handle to have a reliable way to detect spawning
thread termination.

See https://bugs.freedesktop.org/show_bug.cgi?id=95191#c33
for more informations.

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