summaryrefslogtreecommitdiff
path: root/tools
AgeCommit message (Collapse)AuthorFilesLines
2016-10-10Rename distro-style CI build from "release" to "production"Simon McVittie1-2/+2
This avoids confusion with the meaning of "release" used by AX_IS_RELEASE. AX_IS_RELEASE is about facts about the source tree, namely the distinction between releases (tags) and random snapshots. The build variants in .travis.yml are about facts about the build being done, namely the distinction between production and debug/developer builds. Production builds are sometimes referred to as "release builds", for example in typical CMake and MSVC build environments, but a different term seems better here. Signed-off-by: Simon McVittie <smcv@debian.org> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97357
2016-10-10Fix warnings from compiler option '-Wsuggest-attribute=noreturn'Thomas Zimmermann2-2/+2
This patch fixes warnings from '-Wsuggest-attribute=noreturn'. We cannot enable it unconditionally as it would break libtool. Signed-off-by: Thomas Zimmermann <tdz@users.sourceforge.net>
2016-09-30dbus-launch: redirect dbus-daemon output to syslogSimon McVittie1-0/+3
Otherwise, it won't go anywhere at all. Signed-off-by: Simon McVittie <smcv@debian.org>
2016-08-15name-test, tools: add missing COVERAGE_CFLAGSSimon McVittie1-0/+4
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2016-08-15Use AX_CODE_COVERAGE for test-coverage statisticsThomas Zimmermann1-43/+0
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
2016-08-12dbus-daemon, dbus-launch: cope with callers having closed standard fdsSimon McVittie1-2/+17
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)
2016-08-12Merge branch 'dbus-1.10'Simon McVittie1-2/+4
2016-08-12update-activation-environment: produce better diagnostics on errorSimon McVittie1-2/+4
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>
2016-08-11dbus-launch: Protect concat2 by DBUS_ENABLE_EMBEDDED_TESTSThomas Zimmermann1-0/+2
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
2016-07-25dbus-launch: use _dbus_ensure_standard_fds when closing stderrSimon McVittie1-15/+3
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>
2016-07-25dbus-launch: use _dbus_ensure_standard_fds() in the babysitterSimon McVittie1-17/+15
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>
2016-07-25dbus-daemon, dbus-launch: cope with callers having closed standard fdsSimon McVittie1-2/+17
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>
2016-07-20dbus-launch: add --exit-with-x11 optionSimon McVittie1-6/+33
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>
2016-06-30Merge branch 'dbus-1.10' into dbus-1.10-ciSimon McVittie1-1/+1
2016-06-30Quote the DBUS_SESSION_BUS_ADDRESS variable in the shell fileThiago Macieira1-1/+1
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>
2016-06-30Quote the DBUS_SESSION_BUS_ADDRESS variable in the shell fileThiago Macieira1-1/+1
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>
2016-03-02Merge branch 'dbus-1.10'Simon McVittie1-1/+1
2016-03-02Merge branch 'dbus-1.10' into dbus-1.10-ciSimon McVittie1-1/+1
2016-03-02dbus-test-tool echo: fix sleep documentationDmitri Iouchtchenko1-1/+1
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=94244 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2016-02-12Replace $DBUS_USE_TEST_BINARY with $DBUS_TEST_DBUS_LAUNCHSimon McVittie2-8/+3
Instead of using $DBUS_USE_TEST_BINARY to control whether to use the hard-coded test binary TEST_BUS_LAUNCH_BINARY, we can just use $DBUS_TEST_DBUS_LAUNCH to control what we launch directly, as we were already doing for $DBUS_TEST_DAEMON. Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92899 Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2016-02-12Revert "Replace $DBUS_USE_TEST_BINARY with $DBUS_TEST_DBUS_LAUNCH"Simon McVittie2-3/+8
This reverts commit 8fd2be6013e3d0ff6a6ff63ea022f9606d9a87c6. This change was intended for 1.11.
2016-02-11Replace $DBUS_USE_TEST_BINARY with $DBUS_TEST_DBUS_LAUNCHSimon McVittie2-8/+3
Instead of using $DBUS_USE_TEST_BINARY to control whether to use the hard-coded test binary TEST_BUS_LAUNCH_BINARY, we can just use $DBUS_TEST_DBUS_LAUNCH to control what we launch directly, as we were already doing for $DBUS_TEST_DAEMON. Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92899 Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2016-02-11Consistently use socklen_t for getsockname, getsockopt etc.Simon McVittie1-2/+6
This fixes signedness mismatch warnings on platforms where socklen_t is unsigned, notably Linux (where it's an unsigned int). We still use int for the fallback case where the platform does not define socklen_t, because that was the traditional (pre-POSIX) type: for details see NOTES in Linux accept(2), <http://manpages.debian.org/cgi-bin/man.cgi?query=accept&sektion=2>. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=93069 Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk> Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2015-12-02add travis-ci.org build machinerySimon McVittie1-0/+204
The idea is that .travis.yml is specific to Travis-CI, but most of the actual work is done in tools/ci-build.sh, which should be reasonably CI-platform-agnostic (it currently assumes that build-dependendencies are preinstalled, that the "native" platform we're building on is GNU/Linux or something very close, and that "mingw" means mingw-w64 as packaged in Debian and Ubuntu). Bug: https://bugs.freedesktop.org/show_bug.cgi?id=93194 Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2015-12-02add travis-ci.org build machinerySimon McVittie1-0/+204
The idea is that .travis.yml is specific to Travis-CI, but most of the actual work is done in tools/ci-build.sh, which should be reasonably CI-platform-agnostic (it currently assumes that build-dependendencies are preinstalled, that the "native" platform we're building on is GNU/Linux or something very close, and that "mingw" means mingw-w64 as packaged in Debian and Ubuntu). Bug: https://bugs.freedesktop.org/show_bug.cgi?id=93194 Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2015-11-24Fix warning: "pointer targets in assignment differ in signedness ↵Ralf Habacker1-1/+1
[-Wpointer-sign]". The warnings are fixed by adding functions to dbus string name space returning unsigned char pointer, which avoids the need to use casts. Bug: https://bugs.freedesktop.org/attachment.cgi?id=93069 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-09-30Use C99 standard PRI*64 for printing 64 bit integersNatanael Copa1-10/+15
Use the standard C99 PRI*64 macros instead of checking for specific GNU libc version. We also specifically check for windows which does not have proper C99 support. This fixes printing of int64 on non-GNU 32 bit systems (like musl libc). Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92043 Reviewed-by: Thiago Macieira <thiago@kde.org> Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk> [smcv: fix extra % in the Windows fallbacks; include <inttypes.h> where needed]
2015-07-21dbus-monitor: disable automatic handling of o.fd.Peer messagesSimon McVittie1-0/+5
A normal DBusConnection will automatically reply to o.fd.Peer messages such as Ping. We don't want this: if we are using traditional eavesdropping with an older dbus-daemon, we'll confuse everyone else by replying to messages that weren't intended for us. If we are using the new Monitoring interface (since 1.9.12), the same still applies, but in addition, the dbus-daemon will disconnect us for not being a well-behaved monitor. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=90952 Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk> Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk>
2015-05-27Move session & system bus configuration to datadir, by default.Dimitri John Ledkov1-2/+0
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89280 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-05-14Make UUID generation failableSimon McVittie1-5/+2
Previously, this would always succeed, but might use weak random numbers in rare failure cases. I don't think these UUIDs are security-sensitive, but if they're generated by a PRNG as weak as rand() (<= 32 bits of entropy), we certainly can't claim that they're universally unique. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=90414 Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de> [smcv: document @error] Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-05-01tools: MSVC compile fixesRalf Habacker2-2/+10
unistd.h and sleep() are normally Unix-specific, although mingw also provides them. The Windows C runtime documents _environ as its equivalent of Unix environ. https://bugs.freedesktop.org/show_bug.cgi?id=90089 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-05-01dbus_test_tool_spam: Fix 'variable payload going out of scope leaks the ↵Ralf Habacker1-0/+1
storage it points to' (CID 54759) Reported by Coverity: CID 54759: Resource leak (RESOURCE_LEAK) Bug: https://bugs.freedesktop.org/show_bug.cgi?id=90021 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-05-01dbus_test_tool_spam: Fix 'variable random_sizes going out of scope leaks the ↵Ralf Habacker1-0/+2
storage it points to' (CID 54761) Reported by Coverity: CID 54761: Resource leak (RESOURCE_LEAK) Bug: https://bugs.freedesktop.org/show_bug.cgi?id=90021 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-03-24Fix assorted compiler warnings on Windows.Simon McVittie1-4/+2
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89444 Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de> [rh: rebased because a few hunks have already been applied with commit 92c39d1d8a30110c5760bd8d5e695e26a8538d1a]
2015-03-17Fix of 'warning: variable ‘..‘ set but not used ↵Ralf Habacker1-5/+1
[-Wunused-but-set-variable]'. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89284 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-03-05dbus-print-message: conditionalize Unix FD handling on DBUS_UNIXSimon McVittie1-0/+2
We close() the fd after we have printed it, but close() isn't standard functionality on Windows. Unix FD-passing is never going to work on non-Unix platforms anyway. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89428 Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2015-03-05dbus-monitor: use _dbus_get_real_time instead of gettimeofdaySimon McVittie1-10/+4
gettimeofday is implicitly declared (i.e. not in our #include'd header files) when cross-compiling for on Windows. Now that fd.o#83115 has been fixed, using _dbus functions is not a problem. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89428 Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2015-03-04Add missing header for _dbus_sleep_milliseconds() (commit 43d2455)Simon McVittie1-0/+1
2015-03-04Drop duplicated function tool_millisleep() and use dbus_sleep_milliseconds() ↵Ralf Habacker3-21/+1
instead. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89284 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-03-04Fix warning 'conversion to ‘long unsigned int’ from ‘WriteResult’ ↵Ralf Habacker1-5/+8
may change the sign of the result [-Wsign-conversion]'. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89284 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-03-04Fix of 'warning: conversion to ‘dbus_bool_t‘ from ‘int‘ may change ↵Ralf Habacker1-2/+2
the sign of the result [-Wsign-conversion]'. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89284 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-03-04Fix warning: conversion to 'DWORD' from 'int' may change the sign of the ↵Ralf Habacker2-2/+2
result [-Wsign-conversion]. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89284 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-03-04Trivial -Wsign-compare fixes.Ralf Habacker2-3/+3
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=17289 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-02-24dbus-monitor: Keep term 'dest' in --monitor output in sync with related ↵Ralf Habacker1-2/+2
watch expression. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=88896 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk> [smcv: rebase onto differently indented version of previous commit] Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2015-02-24dbus-monitor: Add timestamp to --monitor mode.Ralf Habacker4-64/+37
Use cross platform function _dbus_get_real_time() for fetching current time. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=88896 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk> [smcv: use %ld to avoid needing casts; reinstate printing the timestamp; libdbus-1 is sufficient now that fd.o#83115 is fixed; print timestamp for non-literal dbus-send replies too] Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2015-02-24dbus-monitor: Keep parameter list of method returns in --monitor mode in ↵Ralf Habacker1-1/+2
sync with --profile mode. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=88896 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-02-24dbus-monitor: convert remaining hard tabs to 8 space.Ralf Habacker1-216/+216
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=88896 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-02-24dbus-launch: if autolaunching, use XDG_RUNTIME_DIR/bus if availableSimon McVittie2-4/+62
This provides backwards-compatible autolaunching behaviour, as long as dbus-launch inherits the XDG_RUNTIME_DIR (which it presumably did if it's going to work at all, since it must also have inherited the DISPLAY). In particular, we go through the motions of starting the dbus-daemon, so that we can start the "babysitter" process that will maintain the X11 window to store the bus address. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=61301 Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk> [smcv: decorate _dbus_lookup_user_bus with DBUS_PRIVATE_EXPORT so we can still call it after fixing fd.o#83115; update cmake to match Autotools]
2015-02-24dbus-launch: use libdbus to read the UUIDSimon McVittie3-35/+21
As a side benefit, this means that dbus-launch now understands /etc/machine-id and not just /var/lib/dbus/machine-id. Since machine_uuid comes out of libdbus allocated with dbus_malloc, to avoid having to copy it from malloc-allocated to dbus_malloc-allocated storage, it makes sense to change it to be consistently dbus_malloc-allocated (particularly now that Bug #83115 has made use of internal symbols relatively painless). However, I'm deliberately not changing the allocation model of any other strings in dbus-launch right now; that's a larger yak-shaving exercise.
2015-02-24Add dbus-update-activation-environment toolSimon McVittie2-0/+425
If OS builders (distributions) have chosen to use the per-user bus, this provides two possible modes of operation for compatibility with existing X session startup hooks. A legacy-free system can just upload DISPLAY, XAUTHORITY and possibly DBUS_SESSION_BUS_ADDRESS into dbus-daemon's and systemd's activation environments, similar to http://cgit.freedesktop.org/systemd/systemd/tree/xorg/50-systemd-user.sh installed by systemd (but unlike systemctl, dbus-update-activation-environment works for traditional D-Bus-activated services, not just for systemd services). A system where compatibility is required for environment variables exported by snippets in /etc/X11/xinit/xinitrc.d (in Red Hat derivatives, Gentoo, etc.) or /etc/X11/Xsession.d (Debian derivatives) can upload the entire environment of the X session, minus some selected environment variables which are specific to a login session (notably XDG_SESSION_ID). In Debian, I plan to put the former in a new dbus-user-session package that enables a user-session-centric mode of operation for D-Bus, and the latter in the existing dbus-x11 package, with the intention that dbus-x11 eventually becomes a tool for change-averse setups or goes away entirely. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=61301 Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk>