Commit graph

2784 commits

Author SHA1 Message Date
Simon McVittie
90f36efbc3 Add support for building "modular" tests, which require GLib and dbus-glib
For the moment, the CMake build system only knows about the existing
"embedded tests"; make it define both symbols, though.

We use GLib because it has GTester (and life's too short to write yet another
JUnit clone), and dbus-glib for the main-loop integration only (see
fd.o #31515 for thoughts on incorporating just those two functions in a
separate library in the dbus tarball).

I'm not using DBusLoop for the main loop because I specifically don't
want to use non-public API or ABI of libdbus in the modular tests. If we make
sure they work against a shared libdbus, we can use them to test the
installed system, with "make installcheck".

Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=34570
2011-06-10 18:31:31 +01:00
Simon McVittie
77e208ac1d Don't disable GLib assertions when disabling our own assertions
We no longer use GLib internally, and assertions are how it'll report test
failures when we add GTest-based tests.

Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=34570
2011-06-10 18:31:07 +01:00
Simon McVittie
90ac05171d dbus_message_demarshal_bytes_needed: correct a wrong assertion
It's entirely possible for a message to indicate how many bytes we need,
without actually being complete.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=38120
Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
2011-06-10 18:10:17 +01:00
Simon McVittie
c3223ba6c4 _dbus_header_byteswap: change the first byte of the message, not just the struct member
This has been wrong approximately forever, for instance see:
http://lists.freedesktop.org/archives/dbus/2007-March/007357.html

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=38120
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=629938
Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
2011-06-10 18:09:41 +01:00
Simon McVittie
50732523a7 Consistently use atomic operations for all access to DBusConnection refcount
Trying to mix atomic operations with locked non-atomic operations is
broken: the atomic ops aren't necessarily atomic with respect to the
locked non-atomic ops, and the non-atomic ops aren't protected by the
lock because the atomic ops can change the refcount behind their back.

In theory we could use the connection lock if atomic ops aren't supported
(making a per-connection lock cheaper than the global lock used to
implement atomic ops) *and* our mutexes are recursive (making it safe
against deadlocks)... but life's too short.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=38005
Tested-by: Will Manley <freedesktop williammanley net>
Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
2011-06-10 18:08:11 +01:00
Simon McVittie
73e259322d NEWS 2011-06-08 11:35:22 +01:00
Simon McVittie
3b82500b1b bus: use ln -fs to enable dbus in systemd, not $(LN_S)
Using $(LN_S) is inappropriate because it could in theory mean either
ln -s, ln or cp -p depending on autoconf checks.

Not using -f breaks reinstallation directly from source (DESTDIR unset),
because the symlinks will already exist.

Because systemd isn't currently portable to non-Linux, let alone
non-SUS-compliant systems, it seems safe to assume that ln -fs behaves
as specified by SUS if systemd was found.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=37870
Reviewed-by: Colin Walters <walters@verbum.org>
2011-06-08 11:33:21 +01:00
Simon McVittie
f0d4e0fc97 NEWS 2011-06-07 14:36:15 +01:00
Simon McVittie
ff2047a75a Remove support for -Wl,--gc-sections altogether
Packagers should only enable this flag if they have confirmed that it
actually works on their toolchain (it's the sort of rarely used feature
that frequently regresses on obscure architectures/OSs without anyone
noticing), and also confirmed that it is actually a significant size win
for their configuration.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33466
Reviewed-by: Colin Walters <walters@verbum.org>
2011-06-07 14:26:20 +01:00
Mark Brand
add71e5d7a don't try to build dbus-daemon-launch-helper for Windows
Fixed regression in b0acded which breaks build for Windows.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=37838
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2011-06-07 14:20:05 +01:00
Simon McVittie
638a742a38 Use #!/bin/sh for run-with-tmp-session-bus.sh
It doesn't seem to have any bashisms, and bash isn't in /bin on *BSD.

Suggested by Timothy Redaelli.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=35880
2011-06-01 18:36:23 +01:00
Simon McVittie
9972fabafb add a release name here too 2011-06-01 17:04:27 +01:00
Simon McVittie
b0503e03fd Development version 2011-06-01 12:16:53 +01:00
Simon McVittie
7a235d28d9 Prepare version 1.4.10 2011-06-01 12:01:58 +01:00
Simon McVittie
8f5f59488d NEWS 2011-05-25 18:17:53 +01:00
Simon McVittie
6e255ae93d bus_context_log: divert messages to stderr if we're not using syslog
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=35358
Reviewed-by: Colin Walters <walters@verbum.org>
2011-05-25 18:16:37 +01:00
Simon McVittie
c9af1526d1 process_config_first_time_only: initialize syslog as intended.
On Linux, we previously called openlog() (with different options!) while
initializing SELinux; leave SELinux messages as LOG_USER|LOG_INFO in case
anyone was relying on that, but let the rest of our log messages come
out as LOG_DAEMON.

Also enable LOG_PERROR (copy syslog messages to stderr) unconditionally;
we can make this an autoconf check if anyone's pet Unix doesn't have
LOG_PERROR.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=35358
Reviewed-by: Colin Walters <walters@verbum.org>
2011-05-25 18:16:35 +01:00
Simon McVittie
7f0685a46d _dbus_init_system_log: remove FIXME on Windows
We don't need any initialization here, so there's nothing to fix.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=35358
Reviewed-by: Colin Walters <walters@verbum.org>
2011-05-25 18:16:33 +01:00
Simon McVittie
b28ddba9bd bus_context_check_security_policy: syslog if we hit the outgoing quota
In practice, nothing copes with missing broadcast signals, so the least
we can do is make the failure mode visible.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=35358
Reviewed-by: Colin Walters <walters@verbum.org>
2011-05-25 18:16:31 +01:00
Simon McVittie
be07ce6362 bus_context_check_security_policy: for SELinux denials, share code to set errors
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=35358
Reviewed-by: Colin Walters <walters@verbum.org>
2011-05-25 18:16:29 +01:00
Simon McVittie
79f02ca04a bus_context_check_security_policy: factor out complain_about_message
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=35358
Reviewed-by: Colin Walters <walters@verbum.org>
2011-05-25 18:16:02 +01:00
Simon McVittie
cea055514a Check for X even if X11 autolaunching is disabled
DBUS_ENABLE_X11_AUTOLAUNCH obviously requires DBUS_BUILD_X11. However,
the converse is not true.

If DBUS_BUILD_X11 is defined, dbus-launch will be able to connect to
the X server to determine when the session ends; most distributors will
want this, but it can be disabled with the standard Autoconf option
--without-x.

If DBUS_ENABLE_X11_AUTOLAUNCH is *also* defined, dbus-launch and libdbus
will be willing to perform autolaunch. Again, most distributors will want
this, but it can be disabled with --disable-x11-autolaunch.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=19997
Reviewed-by: Colin Walters <walters@verbum.org>
2011-05-25 17:38:44 +01:00
Simon McVittie
2bfac1b73d test-autolaunch: don't expect autolaunching to work if X11 is disabled
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=19997
Reviewed-by: Colin Walters <walters@verbum.org>
2011-05-25 17:38:21 +01:00
Simon McVittie
0092a75153 NEWS 2011-05-25 17:00:07 +01:00
Simon McVittie
dfb6affd68 When checking for __sync_sub_and_fetch, don't underquote, to shut up recent autoconf
Without the correct number of levels of quoting, autoconf mistakenly
believes we didn't use AC_LANG_SOURCE where required. (In fact,
AC_LANG_PROGRAM calls AC_LANG_SOURCE.)

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=19681
Reviewed-by: Colin Walters <walters@verbum.org>
2011-05-25 16:57:19 +01:00
Simon McVittie
5a66520300 When checking for va_copy, use AC_LANG_SOURCE to shut up recent autoconf
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=19681
Reviewed-by: Colin Walters <walters@verbum.org>
2011-05-25 16:57:13 +01:00
Simon McVittie
80d0847012 Use TP_ADD_COMPILER_FLAG to simplify application of warning-like CFLAGS
This also means we check for support for them.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=19681
Reviewed-by: Colin Walters <walters@verbum.org>
2011-05-25 16:57:07 +01:00
Simon McVittie
e9bf1355d7 Use TP_COMPILER_WARNINGS for all -Wfoo options
This consistently checks whether all these options actually work in the
current version of gcc.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=19681
Reviewed-by: Colin Walters <walters@verbum.org>
2011-05-25 16:57:02 +01:00
Simon McVittie
ad4e7af759 Import tp-compiler-flag.m4 and tp-compiler-warnings.m4 from telepathy-glib
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=19681
Reviewed-by: Colin Walters <walters@verbum.org>
2011-05-25 16:56:45 +01:00
Simon McVittie
4a6c68c0ff NEWS 2011-05-25 16:50:09 +01:00
Simon McVittie
42297fb4e4 handle_server_data_anonymous_mech: remove unnecessary debug output
Doing a malloc and a hex-encoding pass just to produce a _dbus_verbose
message (i.e. a message that, in practice, nobody will see) seems like
overkill, and this block had incorrect error handling (not checking the
result of _dbus_string_init) which upsets static analysis tools.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=29881
Bug-NB: NB#180486
Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk>
2011-05-25 16:13:26 +01:00
Simon McVittie
c559ec0525 dbus-launch: pass_info: always free strings on OOM
This doesn't really do anything, because we're about to exit anyway, but
it placates static analysis tools.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=29881
Bug-NB: NB#180486
Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk>
2011-05-25 16:13:19 +01:00
Simon McVittie
2ae391ccb3 dbus-send: remove minor dead code
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33128
Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk>
2011-05-25 16:11:27 +01:00
Simon McVittie
05f822e3fb dbus_connection_dispatch: remove dead code
There's no way pending can be non-NULL here; if it was, we'd have jumped
straight past this block (getting filters from the connection), because
replies to pending calls don't go through filters.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33128
Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk>
2011-05-25 16:11:05 +01:00
Ralf Habacker
c84e26826e Spelling fix. 2011-05-25 16:08:33 +01:00
Ralf Habacker
0c47090d0e Definition is obsolate with commit e0fc90bdf2 2011-05-25 16:08:19 +01:00
Ralf Habacker
45de11f029 To avoid double dbus version definitions take values from configure.ac. 2011-05-25 16:08:16 +01:00
Simon McVittie
54de9c060a DBusNonceFile: don't always fail when use_subdir=TRUE, i.e. on Unix
In shell-like pseudocode, the desired result is:

if $use_subdir
  dir = $tmpdir/dbus_nonce-$random
  path = $dir/nonce
  mkdir $dir
  write file at $path
else
  dir = $user_owned_place
  path = $dir/dbus_nonce-$random
  write file at $path

However, /nonce was accidentally appended to $dir instead of $path,
resulting in an attempt to mkdir /tmp/dbus_nonce-XXXX/nonce when
dbus_nonce-XXXX hadn't been created yet.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=34569
Tested-by: David Zeuthen <davidz@redhat.com>
Reviewed-by: David Zeuthen <davidz@redhat.com>
2011-05-25 16:03:31 +01:00
Simon McVittie
4bcffe1e05 Relax review criteria for the review cabal themselves, as discussed on-list
Colin agreed in principle and nobody actually objected, so here we go...
2011-05-25 16:02:43 +01:00
Simon McVittie
ec48c71f70 Add davidz to the review cabal
Acked-by: Will Thompson <will.thompson@collabora.co.uk>
Acked-by: Colin Walters <walters@verbum.org>
2011-05-25 16:01:57 +01:00
Simon McVittie
7daecaecf1 dbus_connection_can_send_type: clarify that invalid codes are allowed here
This is sufficiently unusual that it seems worth saying explicitly

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=35182
Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
2011-05-03 10:27:30 +01:00
Simon McVittie
53a74c3d05 NEWS 2011-04-29 15:44:35 +01:00
Will Thompson
435ddb0df1 minotaur: bail if asked to monitor >1 bus
A coworker was just tripped up by `dbus-monitor --session --system` only
monitoring the system bus. This patch would have saved him reproducing a
tricky bug several times!

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=26548
Reviewed-by: Colin Walters <walters@verbum.org>
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2011-04-29 15:42:18 +01:00
Simon McVittie
8e333e682a NEWS for 1.4 2011-04-27 17:59:28 +01:00
Lennart Poettering
66e52541d5 machine-id: fall back to reading /etc/machine-id if D-Bus machine ID is not available
Newer systemd-based systems support a global machine ID with the same
metrics as the D-Bus machine ID, but more powerful semantics (for
example on ro media) in /etc/machine-id.

If the D-Bus machine ID cannot be read, fall back to the systemd machine
ID.

This is a first step towards allowing D-Bus to be started up during
early boot where /var is not available.

[plus a whitespace fix -smcv]

Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Colin Walters <walters@verbum.org>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=35228
2011-04-27 17:54:38 +01:00
Simon McVittie
9c690c8b4f _dbus_check_fdleaks_enter, _dbus_check_fdleaks_leave: whitespace
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=35173
Reviewed-by: Colin Walters <walters@verbum.org>
2011-04-27 16:29:05 +01:00
Simon McVittie
e4abc1d1a5 Don't report file descriptors as "leaked" if they were already open
This is necessary to run the regression tests under valgrind (if
telling it to output to a dedicated fd), gdb, fakeroot etc.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=35173
Reviewed-by: Colin Walters <walters@verbum.org>
2011-04-27 16:28:36 +01:00
Simon McVittie
614ea05b18 NEWS 2011-04-26 19:19:24 +01:00
Simon McVittie
de2ebdf245 Merge remote-tracking branch 'origin/dbus-1.4' into dbus-1.4 2011-04-26 19:18:35 +01:00
Simon McVittie
a902c51295 NEWS 2011-04-26 19:15:09 +01:00