Simon McVittie [Mon, 21 Jan 2019 14:28:24 +0000 (14:28 +0000)]
configure.ac: Forbid AX_-prefixed patterns more selectively
We want to make autoconf fail early and with a user-comprehensible
message if autoconf-archive isn't installed, rather than generating
a configure script with syntax errors, or a configure script that runs
successfully but doesn't do what we intended.
However, autoconf-archive doesn't actually guarantee not to use
AX_-prefixed shell variable names without m4_pattern_allow'ing them
(unlike Autoconf, Automake, Libtool and pkg-config, which explicitly use
m4_pattern_allow for variables with AC_, AM_, LT_ and PKG_ prefixes), so
it isn't safe to assume that they won't be used. In particular, recent
versions of AX_CHECK_GNU_MAKE appear to be using
$AX_CHECK_GNU_MAKE_HEADLINE as a shell variable.
Instead, specifically forbid the names of the finite list of macros
that we actually use.
Signed-off-by: Simon McVittie <smcv@collabora.com>
Resolves: dbus#249
Ralf Habacker [Thu, 10 Jan 2019 14:29:59 +0000 (15:29 +0100)]
Make sure ctest on Windows uses the currently built dbus library
The ctest application is usually not installed in the dbus build
directory. If an older dbus library is contained in this path, it will
be used instead of the currently built one, which can lead to runtime
errors (e.g.: c0000139) if the internal dbus API differs.
Simon McVittie [Thu, 20 Dec 2018 15:17:13 +0000 (15:17 +0000)]
dbus-spawn-win: Move _dbus_spawn_program() to main thread
We would like to stop taking ownership of envp, but we can't do that
without a deep copy if a different thread might still be using it
(asynchronously) after the main thread has returned from
_dbus_spawn_async_with_babysitter().
Originally part of a larger commit by Ralf Habacker.
Signed-off-by: Simon McVittie <smcv@collabora.com>
Simon McVittie [Wed, 19 Dec 2018 17:29:11 +0000 (17:29 +0000)]
dbus-daemon(1): Give more comprehensive examples of how to add services
While writing the wording to deprecate XML policy installed by packages
into ${sysconfdir}, I realised we didn't give a typical example of
what packages *should* do.
Signed-off-by: Simon McVittie <smcv@collabora.com>
Simon McVittie [Wed, 19 Dec 2018 17:27:15 +0000 (17:27 +0000)]
Officially deprecate package-supplied dbus-daemon policy in ${sysconfdir}
Now that dbus 1.10 has become widely available, we should start to
treat ${sysconfdir} as reserved for the sysadmin, and encourage
third-party software packages to install their integration files into
${datadir}.
Signed-off-by: Simon McVittie <smcv@collabora.com>
Ralf Habacker [Mon, 17 Dec 2018 15:36:32 +0000 (16:36 +0100)]
Add cmake support for session based test executables
This patch introduces a new cmake macro add_session_test_executable,
which uses dbus-run-session to start a dbus-daemon process with a
temporary session bus in the background and the desired client file.
add_session_test_executable requires additional environment variables
defined in the top level CMakeLists.txt.
Ralf Habacker [Mon, 17 Dec 2018 15:13:00 +0000 (16:13 +0100)]
Add cmake support for session based test executables
This patch introduces a new cmake macro add_session_test_executable,
which uses dbus-run-session to start a dbus-daemon process with a
temporary session bus in the background and the desired client file.
add_session_test_executable requires additional environment variables
defined in the top level CMakeLists.txt.
Ralf Habacker [Sat, 15 Dec 2018 09:54:47 +0000 (10:54 +0100)]
Fix setup of build time output paths in cmake
Instead of the variables EXECUTABLE_OUTPUT_PATH and
LIBRARY_OUTPUT_PATH, which have become obsolete since
cmake 3.x, CMAKE_xxx_OUTPUT_PATH is now used to define
output paths in the build directory.
Simon McVittie [Fri, 14 Dec 2018 20:31:31 +0000 (20:31 +0000)]
test-wrappers: Copy strings that might come from getenv()
It is not safe to assume that the result of getenv() is not invalidated
by a subsequent call to setenv(), and dbus#240 demonstrates that this
can be a problem in practice when running Windows code under Wine.
Closes: https://gitlab.freedesktop.org/dbus/dbus/issues/240 Signed-off-by: Simon McVittie <smcv@collabora.com>
Simon McVittie [Mon, 3 Sep 2018 21:53:24 +0000 (14:53 -0700)]
tests: Collect common code from embedded-test main executables
This all seems to have been written by Red Hat or by Collabora, so we
have permission to relicense it under the MIT/X11 license, and we
might as well do so.
Signed-off-by: Simon McVittie <smcv@collabora.com>
Simon McVittie [Mon, 17 Dec 2018 10:56:38 +0000 (10:56 +0000)]
trivial: Remove trailing whitespace from copyright notices
We don't usually mass-remove trailing whitespace from the actual source
code because it would complicate cherry-picking bug fixes to older
branches, but that reasoning doesn't really apply to the comments
containing copyright and licensing notices.
Removing trailing whitespace makes it much easier to move code around:
we have a commit hook that rejects commits containing trailing
whitespace, but that commit hook counts moving a file as a delete + add
pair, so it objects to moving code that contains trailing whitespace.
Signed-off-by: Simon McVittie <smcv@collabora.com>
Simon McVittie [Fri, 14 Dec 2018 20:06:02 +0000 (20:06 +0000)]
_dbus_threads_init_debug: Remove
libdbus has been thread-safe by default since 1.7.6 (2013):
dbus_threads_init_default() is called on a just-in-time basis
whenever needed, and _dbus_thread_init_debug() is equivalent to that.
Signed-off-by: Simon McVittie <smcv@collabora.com>
Simon McVittie [Fri, 14 Dec 2018 12:51:51 +0000 (12:51 +0000)]
.gitignore: Normalize into LC_ALL=C sort order
If lists are in a completely arbitrary order, sorting them consistently
means that there is only one correct place to insert a new entry, avoiding
the merge conflicts that would occur if we always append new entries.
Signed-off-by: Simon McVittie <smcv@collabora.com>
Simon McVittie [Fri, 14 Dec 2018 12:46:35 +0000 (12:46 +0000)]
.gitignore: Consolidate generic patterns at top level
Patterns in the top-level .gitignore match in all subdirectories, so
there's no need to repeat ourselves quite so much for generic
C, Autotools and gcov patterns.
Signed-off-by: Simon McVittie <smcv@collabora.com>
Simon McVittie [Fri, 14 Dec 2018 12:42:52 +0000 (12:42 +0000)]
Top level .gitignore: Sort anchored patterns in LC_ALL=C sort order
If lists are in a completely arbitrary order, sorting them consistently
means that there is only one correct place to insert a new entry, avoiding
the merge conflicts that would occur if we always append new entries.
Signed-off-by: Simon McVittie <smcv@collabora.com>
Simon McVittie [Fri, 14 Dec 2018 12:42:22 +0000 (12:42 +0000)]
Top level .gitignore: Group anchored and unanchored patterns
The anchored patterns match only in the top directory; the unanchored
patterns match in any subdirectory. While I'm moving the unanchored
patterns around anyway, sort them in lexicographical (LC_ALL=C sort)
order.
Signed-off-by: Simon McVittie <smcv@collabora.com>
Ralf Habacker [Fri, 7 Dec 2018 16:52:58 +0000 (17:52 +0100)]
Decrease the runtime of test refs under Windows by default
If the environment variable DBUS_TEST_SLOW is not set or is 0
fewer iterations are performed in test-refs enough to demonstrate
that it works, rather than seriously trying to reproduce race
conditions.
This solves the long runtime that Wine 3.x (4 times longer than
native Windows 7) or Windows 7 as a VirtualBox 5.22 guest (10
times longer) is to be seen.
Simon McVittie [Tue, 11 Dec 2018 11:52:38 +0000 (11:52 +0000)]
test-privserver: Move helper executable out of name-test/
This means we don't need to distinguish between DBUS_NAME_TEST_EXEC and
DBUS_TEST_EXEC any more, because all test helper executables are in the
same place, both during build and when installed (we don't install
test-privserver since no installed test requires it yet, but in
principle we could).
Signed-off-by: Simon McVittie <smcv@collabora.com>
Simon McVittie [Thu, 13 Dec 2018 13:07:20 +0000 (13:07 +0000)]
test-privserver: Add copyright and licensing information
I've assumed that trivial changes from Scott James Remnant (correcting
some bus names) and Marcus Brinkmann (adding a <config.h> include
tree-wide) are not significant here. All the other potential copyright
holders from the git log are listed, and all have given permission to
relicense their dbus contributions under the MIT/X11 license.
Signed-off-by: Simon McVittie <smcv@collabora.com>
Simon McVittie [Wed, 29 Aug 2018 19:06:00 +0000 (20:06 +0100)]
build: Add a way to set CFLAGS for AddressSanitizer etc.
We don't want to set these globally via the normal CFLAGS, because if
we did, AddressSanitizer would catch test-segfault deliberately
segfaulting, and "helpfully" turn it into exit status 1, which in turn
makes our test fail because it asserts that the segfault is reported
as a segfault.
A typical use with gcc as compiler, on a reasonably recent Debian,
would be:
Simon McVittie [Mon, 3 Dec 2018 16:04:56 +0000 (16:04 +0000)]
Move _dbus_disable_crash_handling() back into test/ directory
It's only used in test code. We have to put it in its own translation
unit with no non-libc dependencies so that we can compile a copy of it
without AddressSanitizer support, because in a subsequent commit we will
special-case test-segfault to be compiled without using AddressSanitizer,
which would make linking to an AddressSanitizer-instrumented libdbus fail.
Signed-off-by: Simon McVittie <smcv@collabora.com>
Simon McVittie [Thu, 6 Dec 2018 13:49:56 +0000 (13:49 +0000)]
Don't cast user-supplied pointers to DBusBasicValue *
If we cast a user-supplied pointer to DBusBasicValue *, that's like
promising that the pointer is to an object at least as strictly aligned
as a DBusBasicValue. In practice, it often isn't: for example, when
we marshal a dbus_uint32_t, a pointer to it is only guaranteed to be
32-bit-aligned, whereas DBusBasicValue typically requires 64-bit
alignment.
Signed-off-by: Simon McVittie <smcv@collabora.com>
Ralf Habacker [Fri, 7 Dec 2018 18:02:14 +0000 (19:02 +0100)]
run-session: Fix warning 'array subscript 3 is above array bounds of 'char *[3]' on Windows
After the merge request !22 was created, this bug was fixed in !23,
the associated branch was used for local tests, but the fix was not
transferred to !22. After merging !22 into the master branch and
rebasing !23 to the master, this fix was lost.
Ralf Habacker [Thu, 6 Dec 2018 16:08:29 +0000 (17:08 +0100)]
Skip server oom wildcard test on Windows to avoid firewall exception request
After starting the test on Windows 10, whether the local user is an
administrator or not, a dialog box appears with a warning that some
features of the app have been blocked by the firewall and prompts for
credentials for an administrator account while the test continues to
run and pass.
If this request is aborted, the dialog disappears; no restrictions are
visible for the test case. When the test is restarted, the dialog is also
no longer displayed.
In the firewall configuration you can then see that test-server-oom.exe
has been added (but not enabled) for public networks, although no
confirmation has been received from an administrator account.
Ralf Habacker [Wed, 5 Dec 2018 07:30:17 +0000 (08:30 +0100)]
Add new cmake configure option DBUS_USE_WINE
If this variable is set, ctest uses wine to run cross compiled
test applications. Otherwise, they are assumed to run on a native
Windows operating system.
The new cmake variables Z_DRIVE_IF_WINE and TEST_WRAPPER have been
added to support this function.
Ralf Habacker [Wed, 5 Dec 2018 06:56:22 +0000 (07:56 +0100)]
Adds uac manifest to all executable test files to prevent the Windows 740 error when running
The case occurred during test-pending-call-dispatch. To avoid further
applications being affected in the future, the manifest is added to
all test applications.
Windows Error 740 is defined as 'The Requested Operation Requires Elevation'
Simon McVittie [Wed, 5 Dec 2018 13:16:10 +0000 (13:16 +0000)]
CI: Don't install weak dependencies (Recommends)
In particular this avoids installing the TeX toolchain.
However, this also means we don't install dbus, which broke some tests
in minimal containers where dbus wasn't already installed, because the
messagebus user wouldn't have been created. Make sure that user exists,
using the same adduser call as the Debian dbus package.
CMake really wants to find a C++ compiler (even though we only use C++
when compiling for Windows), so explicitly install the default
version of the GNU C++ compiler, g++.
Signed-off-by: Simon McVittie <smcv@collabora.com>
Simon McVittie [Wed, 5 Dec 2018 12:58:22 +0000 (12:58 +0000)]
sysdeps test: Wait for spawned process to exit
On Windows, the "out" parameter for the process handle isn't set
unless we specify G_SPAWN_FLAGS_DO_NOT_REAP_CHILD. That means we
can't terminate it, and the child process is leaked. When running the
test individually, the leaked process is harmless apart from its
resource cost, but when running under CTest, it holds a file descriptor
open (or something) which causes CTest to not exit.
If we *do* specify G_SPAWN_FLAGS_DO_NOT_REAP_CHILD, we become
responsible for "reaping" the child process by waiting for its exit
status, which is an OS-specific action.
Signed-off-by: Simon McVittie <smcv@collabora.com>
Resolves: https://gitlab.freedesktop.org/dbus/dbus/issues/238
Simon McVittie [Wed, 5 Dec 2018 13:40:46 +0000 (13:40 +0000)]
syslog test: Don't assert that we see plain LF newlines
In at least some build configurations that target Windows, we see CRLF
newlines in the stderr of the subprocess. Leave the newlines unspecified
and let "*" match them.
Signed-off-by: Simon McVittie <smcv@collabora.com>
Resolves: https://gitlab.freedesktop.org/dbus/dbus/issues/243
Ralf Habacker [Wed, 24 Oct 2018 10:03:14 +0000 (12:03 +0200)]
Fix test-shutdown bail out on Windows
test-shutdown expects a GUID in the bus address by default,
which is not available under Windows, because on this platform
an autolaunch address is provided by dbus-run-session and is
not returned by dbus-daemon.
Bug: https://gitlab.freedesktop.org/dbus/dbus/merge_requests/59 Reviewed-by: Simon McVittie <smcv@collabora.com>
Simon McVittie [Mon, 3 Dec 2018 19:44:47 +0000 (19:44 +0000)]
CI: Stop building on Ubuntu 14.04 'trusty'
The version of gcc in trusty is too old for AddressSanitizer, which we
want to be able to start using, and Travis-CI finally supports Ubuntu
16.04 'xenial' now. This lets us remove some workarounds, but we need
to update others.
Signed-off-by: Simon McVittie <smcv@collabora.com>