Simon McVittie [Fri, 1 Dec 2017 19:18:28 +0000 (19:18 +0000)]
_dbus_header_load: Operate on the entire string, not a substring
This function worked with a (string,position,length) triple, but it
turns out to only have one caller, which tells it to look at the
entire string anyway. It'll be easier to document if all the offsets
start from 0.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=100317 Reviewed-by: Philip Withnall <withnall@endlessm.com> Signed-off-by: Simon McVittie <smcv@collabora.com>
Simon McVittie [Mon, 27 Nov 2017 16:23:16 +0000 (16:23 +0000)]
_dbus_server_new_for_socket: Iterate over arrays as intended
Commit 0c03b505 was meant to clear all the fds indexed by j in
[0, n_fds), which socket_disconnect() can't be allowed to close
(because on failure the caller remains responsible for closing them);
but instead it closed the one we failed to add to the main loop
(fd i), repeatedly.
Similarly, it was meant to invalidate all the watches indexed by j
in [i, n_fds) (the one we failed to add to the main loop and the ones
we didn't try to add to the main loop yet), which socket_disconnect()
can't be allowed to see (because it would fail to remove them from
the main loop and hit an assertion failure); but instead it invalidated
fd i, repeatedly.
These happen to be the same thing if you only have one fd, resulting
in the test-case passing on an IPv4-only system, but failing on a
system with both IPv4 and IPv6.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89104 Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com>
Simon McVittie [Tue, 21 Nov 2017 16:01:02 +0000 (16:01 +0000)]
tests: Use test_main_context_call_and_wait
Also use test_oom() where the relevant lines are changing anyway.
Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=103600
Simon McVittie [Tue, 21 Nov 2017 12:15:04 +0000 (12:15 +0000)]
test_main_context_call_and_wait: Add
Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=103600
Simon McVittie [Tue, 21 Nov 2017 12:10:01 +0000 (12:10 +0000)]
test-utils: Use TAP syntax to die with a fatal error
Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=103600
Simon McVittie [Tue, 21 Nov 2017 11:59:20 +0000 (11:59 +0000)]
tests: Don't use the same variable for call and reply
It seemed like a nice idea at the time, but I now think it's more
confusing than it's worth.
Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=103600
Simon McVittie [Tue, 21 Nov 2017 12:03:34 +0000 (12:03 +0000)]
test/sd-activation: Make more use of dbus_clear_message()
Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=103600
Simon McVittie [Tue, 21 Nov 2017 12:01:23 +0000 (12:01 +0000)]
tests: Don't leak pending calls
Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=103600
Simon McVittie [Tue, 21 Nov 2017 10:56:56 +0000 (10:56 +0000)]
test/dbus-daemon: Don't leak method call messages if we skip tests
Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=103600
Simon McVittie [Tue, 21 Nov 2017 10:50:37 +0000 (10:50 +0000)]
test_peer_ping: Don't leak one method call per invocation
Previously, we allocated m both during initialization, and after
deciding not to skip this test.
Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=103600
Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89104
Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89104
Simon McVittie [Tue, 21 Nov 2017 13:36:10 +0000 (13:36 +0000)]
Add a targeted test for OOM during _dbus_server_new_for_tcp_socket()
This also covers _dbus_server_new_for_socket(), which is one of the
worse places in terms of complexity of the error-unwinding path
(3 labels).
Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89104
Simon McVittie [Tue, 21 Nov 2017 14:46:06 +0000 (14:46 +0000)]
dbus-nonce: Don't crash on encountering OOM
Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89104
Simon McVittie [Tue, 21 Nov 2017 14:43:01 +0000 (14:43 +0000)]
_dbus_listen_tcp_socket: Don't rely on dbus_realloc setting errno
dbus_realloc() doesn't guarantee to set errno (if it did, the
only reasonable thing it could set it to would be ENOMEM). In
particular, faking OOM conditions doesn't set it. This can cause an
assertion failure when OOM tests assert that the only error that can
validly occur is DBUS_ERROR_NO_MEMORY.
Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89104
Simon McVittie [Tue, 21 Nov 2017 14:39:58 +0000 (14:39 +0000)]
_dbus_server_new_for_tcp_socket: Don't pile up errors on OOM
If _dbus_noncefile_create() has failed and set error, it is incorrect
for us to set it again.
Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89104
Simon McVittie [Tue, 21 Nov 2017 14:39:11 +0000 (14:39 +0000)]
_dbus_server_new_for_launchd: Don't leak fd on failure
If _dbus_server_new_for_socket() fails, it is the caller's
responsibility to close the fds. All other callers did this.
Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89104
Simon McVittie [Tue, 21 Nov 2017 14:38:13 +0000 (14:38 +0000)]
_dbus_server_new_for_socket: Properly disconnect during error unwinding
_dbus_server_finalize_base() asserts that the socket has been
disconnected, but in some OOM code paths we would call it without
officially disconnecting. Do so.
This means we need to be a bit more careful about what is
socket_disconnect()'s responsibility to clean up, what is
_dbus_server_new_for_socket()'s responsibility, and what is the caller's
responsibility.
Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89104
Simon McVittie [Tue, 21 Nov 2017 14:36:02 +0000 (14:36 +0000)]
_dbus_server_new_for_socket: Invalidate watches during error unwinding
We assert that every watch is invalidated before it is freed, but
in some OOM code paths this didn't happen.
Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89104
Simon McVittie [Tue, 21 Nov 2017 12:40:07 +0000 (12:40 +0000)]
_dbus_transport_new_for_socket: Simplify with _DBUS_STRING_INIT_INVALID
This is one of the few places that has test coverage for all the OOM
code paths. It was also one of the worst (most complicated)
error-unwinding locations, with labels failed_0 up to failed_4.
Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89104
Simon McVittie [Mon, 3 Jul 2017 16:59:10 +0000 (17:59 +0100)]
DBusString: Add _DBUS_STRING_INIT_INVALID and allow "freeing" it
This means we can finally use patterns like this:
DBusString buffer = _DBUS_STRING_INIT_INVALID;
dbus_bool_t ret = FALSE;
... some long setup ...
if (!_dbus_string_init (&buffer))
goto out;
... some long operation ...
ret = TRUE;
out:
... free things ...
_dbus_string_free (&buffer);
... free more things ...
return ret;
without having to have a separate boolean to track whether buffer has
been initialized.
One observable difference is that if s is a "const" (borrowed pointer)
string, _dbus_string_free (&s) now sets it to be invalid. Previously,
it would have kept its (borrowed pointer) contents, which seems like
a violation of least-astonishment.
Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89104
Simon McVittie [Mon, 3 Jul 2017 16:31:37 +0000 (17:31 +0100)]
DBusString: Reverse the sense of ->invalid
It's easier to implement a stack-allocated string that is valid to
free (but for no other purpose) if we consider all-bits-zero to be
invalid.
Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89104
Simon McVittie [Wed, 15 Nov 2017 12:28:21 +0000 (12:28 +0000)]
Remove test data in the "message builder" domain-specific language
These tests were disabled by commit 9c3d566, which rewrote the D-Bus
type system to be fully recursive, back in 2005. The message builder
was subsequently removed by commit 9d21554, also in early 2005.
It will probably take significant work to turn these files into
test-cases that use the current D-Bus type system and so can be run
this decade. Until that work is done, let's not ship them: we can
always fetch them from git history if we want them.
The single .message-raw file can still be read and has been retained,
although it hasn't actually tested the intended failure mode since
2005 due to changes to the D-Bus specification (it is a wire-protocol
version 0 message, and the recursive type system introduced in commit 9c3d566 changed the wire-protocol version to 1).
Reviewed-by: Philip Withnall <withnall@endlessm.com> Signed-off-by: Simon McVittie <smcv@collabora.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=103758
Simon McVittie [Wed, 15 Nov 2017 12:14:16 +0000 (12:14 +0000)]
_dbus_test_diag: Flush stdout after each diagnostic
If we crash, we'll want to know what the most recent diagnostic was.
Reviewed-by: Philip Withnall <withnall@endlessm.com> Signed-off-by: Simon McVittie <smcv@collabora.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=103601
Simon McVittie [Tue, 14 Nov 2017 19:07:22 +0000 (19:07 +0000)]
dispatch test: Output finer-grained TAP
This lets us see which bits are painfully slow. (Spoilers:
check_existent_service_no_auto_start.)
Reviewed-by: Philip Withnall <withnall@endlessm.com> Signed-off-by: Simon McVittie <smcv@collabora.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=103601
Simon McVittie [Tue, 14 Nov 2017 17:53:31 +0000 (17:53 +0000)]
test-bus*: Output TAP directly
Reviewed-by: Philip Withnall <withnall@endlessm.com> Signed-off-by: Simon McVittie <smcv@collabora.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=103601
Simon McVittie [Tue, 14 Nov 2017 17:20:40 +0000 (17:20 +0000)]
test-dbus: Produce machine-readable TAP output
See http://testanything.org/ for more information on TAP.
Reviewed-by: Philip Withnall <withnall@endlessm.com> Signed-off-by: Simon McVittie <smcv@collabora.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=103601
Simon McVittie [Tue, 14 Nov 2017 16:41:23 +0000 (16:41 +0000)]
bus: Silence the output of the test services when doing OOM testing
The echo service frequently fails to connect to the bus when we are
testing OOM code paths, again causing a lot of noise in the log.
Reviewed-by: Philip Withnall <withnall@endlessm.com> Signed-off-by: Simon McVittie <smcv@collabora.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=103601
Simon McVittie [Tue, 14 Nov 2017 16:06:05 +0000 (16:06 +0000)]
bus: Silence most log messages when testing OOM handling
In parts of the OOM testing, our logging produces multiple megabytes
of output. Let's not do that.
Reviewed-by: Philip Withnall <withnall@endlessm.com> Signed-off-by: Simon McVittie <smcv@collabora.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=103601
Simon McVittie [Tue, 14 Nov 2017 15:30:03 +0000 (15:30 +0000)]
Unix: Flush stdout and stderr streams before forking
stdout and stderr are close-on-exec and buffered, so we can't rely on
their buffers being empty. If we continue to execute application code
after forking (as opposed to immediately exec()ing), then the child
process might later flush the libc stdio buffers, resulting in
output that is printed by the parent also being printed by the child.
In particular, test-bus.log sometimes grows extremely large for
this reason, because this test repeatedly attempts to carry out
legacy activation.
Reviewed-by: Philip Withnall <withnall@endlessm.com> Signed-off-by: Simon McVittie <smcv@collabora.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=103601
Simon McVittie [Tue, 14 Nov 2017 14:17:53 +0000 (14:17 +0000)]
Prefer to use _dbus_test_fatal() for assertion failures in tests
This is a little more self-documenting - it justifies why it's
acceptable to fail hard on out-of-memory conditions. _dbus_test_fatal()
isn't compiled unless we are compiling embedded tests, so compiling
with embedded tests disabled provides reasonable confidence that we
aren't using _dbus_test_fatal() inappropriately.
Reviewed-by: Philip Withnall <withnall@endlessm.com> Signed-off-by: Simon McVittie <smcv@collabora.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=103601
Simon McVittie [Tue, 14 Nov 2017 14:13:45 +0000 (14:13 +0000)]
Use _dbus_test_fatal to include more detail in test failure diagnostics
Unlike _dbus_assert_not_reached(), this new function takes a printf-style
format string, so we don't need to use a _dbus_warn() to explain why
the failure occurred (unless the failure message is multi-line).
Reviewed-by: Philip Withnall <withnall@endlessm.com> Signed-off-by: Simon McVittie <smcv@collabora.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=103601
Simon McVittie [Tue, 14 Nov 2017 14:09:59 +0000 (14:09 +0000)]
Embedded tests: Emit TAP diagnostics instead of printf
Reviewed-by: Philip Withnall <withnall@endlessm.com> Signed-off-by: Simon McVittie <smcv@collabora.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=103601
Simon McVittie [Tue, 14 Nov 2017 14:01:56 +0000 (14:01 +0000)]
Add utility functions to emit TAP diagnostics and fatal errors
Reviewed-by: Philip Withnall <withnall@endlessm.com>
[smcv: Add an explanatory comment as suggested] Signed-off-by: Simon McVittie <smcv@collabora.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=103601
Simon McVittie [Tue, 14 Nov 2017 15:17:32 +0000 (15:17 +0000)]
Do not export dbus_internal_do_not_use_run_tests if unused
Reviewed-by: Philip Withnall <withnall@endlessm.com> Signed-off-by: Simon McVittie <smcv@collabora.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=103601
Simon McVittie [Tue, 14 Nov 2017 14:11:25 +0000 (14:11 +0000)]
Windows autolaunch: Turn stdout spam into stderr spam
This is still not how warnings and diagnostics should be done
(the advice should probably be included in the DBusError) but at least
this way it won't interfere with machine-readable output on stdout.
See also https://bugs.freedesktop.org/show_bug.cgi?id=103756
Reviewed-by: Philip Withnall <withnall@endlessm.com>
[smcv: Added a reference to #103756] Signed-off-by: Simon McVittie <smcv@collabora.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=103601
Simon McVittie [Tue, 14 Nov 2017 13:59:12 +0000 (13:59 +0000)]
Remove commented-out printf debugging
Printing to stdout would interfere with generating TAP syntax.
Reviewed-by: Philip Withnall <withnall@endlessm.com> Signed-off-by: Simon McVittie <smcv@collabora.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=103601
Simon McVittie [Mon, 6 Nov 2017 16:16:31 +0000 (16:16 +0000)]
bus_connections_setup_connection: If we can't set it up, log why
While reviewing fd.o#101354, Philip Withnall pointed out that if we
rejected a connection in the new code there, we didn't log why. It
turns out we didn't log that in the more normal code path either.
Redo the error handling so that failure to set up a connection
is logged.
Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=103592
(cherry picked from commit 56847ae818e8c144b9c7a8102efd1c926ead2f62)
Simon McVittie [Mon, 6 Nov 2017 16:16:31 +0000 (16:16 +0000)]
bus_connections_setup_connection: If we can't set it up, log why
While reviewing fd.o#101354, Philip Withnall pointed out that if we
rejected a connection in the new code there, we didn't log why. It
turns out we didn't log that in the more normal code path either.
Redo the error handling so that failure to set up a connection
is logged.
Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=103592
Simon McVittie [Tue, 25 Jul 2017 11:43:01 +0000 (12:43 +0100)]
travis-ci: Enable/disable more features in various builds
In the debug build, enable features that are off by default. In the
reduced build, explicitly disable features, some of which are
on by default. In the legacy build, check that we can compile the
default feature-set without inotify, dnotify, systemd, etc.
Reviewed-by: Philip Withnall <withnall@endlessm.com>
[smcv: Rebase onto 1.13.x branch, fix minor conflicts] Signed-off-by: Simon McVittie <smcv@collabora.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=101354
(cherry picked from commit 3c031ef5aa1f7f53c6344781cb38b78abe44dc96)
Simon McVittie [Mon, 6 Nov 2017 19:27:48 +0000 (19:27 +0000)]
DBusNonceFile: Don't rely on caller preallocating the object
If we combine the dbus_new0, populating the DBusString members and the
actual creation of the file, RAII-style, then we never need to worry
about a partially-initialized or uninitialized DBusNonceFile becoming
visible to a caller.
Similarly, if we combine deletion of the file, freeing of the
DBusString members, freeing the structure and clearing the pointer to
the structure, then we can never be in an inconsistent situation,
except during the actual implementation of _dbus_noncefile_delete().
Note that there are two implementations each of
_dbus_noncefile_create() and _dbus_noncefile_delete(). This is because
on Unix we must use a subdirectory of _dbus_get_tmpdir() (the nonce
filename is not created atomically, so that would not be safe), while
on Windows we use the directory directly (the Windows temp directory
is private to a user, so this is OK).
Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=103597
Simon McVittie [Mon, 6 Nov 2017 19:11:32 +0000 (19:11 +0000)]
_dbus_accept_with_noncefile: Don't leak nonce
This was always leaked, both on success and on error.
Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=103597
(cherry picked from commit 37d5af203c0fc22c9ae746b2ae4781ff648a792f)
Simon McVittie [Mon, 6 Nov 2017 19:10:42 +0000 (19:10 +0000)]
do_noncefile_create: Avoid freeing uninitialized memory on error
We could free all of these without having ever successfully
initialized them.
Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=103597
(cherry picked from commit 6d08f5c04e601f16ef4ee2126a90c924b7e26df0)
Simon McVittie [Mon, 6 Nov 2017 19:09:51 +0000 (19:09 +0000)]
do_check_nonce: Don't free uninitialized memory on OOM
If _dbus_string_init() fails, it doesn't guarantee that the string
is initialized to anything in particular. Worse, if
_dbus_string_init (&buffer) fails, p would never have been initialized
at all, due to the use of the short-circuiting || operator.
Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=103597
(cherry picked from commit 0ea0e4b0fddd1109835b8b9f7a8319d59c8d9303)
Simon McVittie [Mon, 6 Nov 2017 19:11:32 +0000 (19:11 +0000)]
_dbus_accept_with_noncefile: Don't leak nonce
This was always leaked, both on success and on error.
Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=103597
Simon McVittie [Mon, 6 Nov 2017 19:10:42 +0000 (19:10 +0000)]
do_noncefile_create: Avoid freeing uninitialized memory on error
We could free all of these without having ever successfully
initialized them.
Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=103597
Simon McVittie [Mon, 6 Nov 2017 19:09:51 +0000 (19:09 +0000)]
do_check_nonce: Don't free uninitialized memory on OOM
If _dbus_string_init() fails, it doesn't guarantee that the string
is initialized to anything in particular. Worse, if
_dbus_string_init (&buffer) fails, p would never have been initialized
at all, due to the use of the short-circuiting || operator.
Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=103597
Simon McVittie [Mon, 6 Nov 2017 18:44:43 +0000 (18:44 +0000)]
tests: Assert that _DBUS_STRING_DEFINE_STATIC looks as expected
Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89104
Simon McVittie [Mon, 6 Nov 2017 18:41:40 +0000 (18:41 +0000)]
_DBUS_STRING_DEFINE_STATIC: Don't include zero termination in length
_dbus_string_init_const() doesn't include the trailing '\0' in
the DBusRealString->len, so this surely shouldn't either.
In practice none of the users of _DBUS_STRING_DEFINE_STATIC care one
way or the other, but it seems better to be consistent.
Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89104
Simon McVittie [Thu, 6 Jul 2017 14:58:48 +0000 (15:58 +0100)]
test-utils-glib: Add function to connect with GDBus as another uid
This will be used in a test for connecting to container servers
as the wrong uid.
Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=101354
Simon McVittie [Thu, 6 Jul 2017 14:57:18 +0000 (15:57 +0100)]
test-utils-glib: Factor out functions for switching uid
Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=101354
Simon McVittie [Thu, 6 Jul 2017 14:57:18 +0000 (15:57 +0100)]
test-utils-glib: Add failable functions to connect to a bus
Instead of calling g_test_skip() internally, raise a distinctive error
and let the caller handle it.
Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=101354
Simon McVittie [Fri, 9 Jun 2017 14:57:30 +0000 (15:57 +0100)]
_dbus_asv_add_object_path: Add
Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=101354
Simon McVittie [Mon, 24 Jul 2017 11:30:57 +0000 (12:30 +0100)]
Add a simplified backport of g_steal_pointer()
This will be used in tests later in the branch.
Sadly we can't use GLIB_VERSION_2_44 unless we are willing to have a
hard dependency on GLib 2.44, which would force us to do all our
Travis-CI builds in Docker containers rather than in ye olde base
system, and that adds 50% to the time taken to do builds.
Reviewed-by: Philip Withnall <withnall@endlessm.com>
[smcv: Rebase onto 1.13.x branch, fix minor conflicts] Signed-off-by: Simon McVittie <smcv@collabora.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=101354
Simon McVittie [Tue, 25 Jul 2017 12:37:52 +0000 (13:37 +0100)]
cmake: Match AC_DEFINE more precisely, respecting [] quoting
The regular expression previously used here to select the second
comma-delimited argument won't work when we introduce an argument
containing a comma, which I need to do now. We can address this by
recognising Autoconf's quoting mechanism (which uses square
brackets).
This is not 100% right (it doesn't understand nested square brackets),
but it's good enough in practice.
Signed-off-by: Simon McVittie <smcv@collabora.com> Acked-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=101354
Simon McVittie [Tue, 25 Jul 2017 11:43:01 +0000 (12:43 +0100)]
travis-ci: Enable/disable more features in various builds
In the debug build, enable features that are off by default. In the
reduced build, explicitly disable features, some of which are
on by default. In the legacy build, check that we can compile the
default feature-set without inotify, dnotify, systemd, etc.
Reviewed-by: Philip Withnall <withnall@endlessm.com>
[smcv: Rebase onto 1.13.x branch, fix minor conflicts] Signed-off-by: Simon McVittie <smcv@collabora.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=101354
Simon McVittie [Mon, 23 Oct 2017 14:07:24 +0000 (15:07 +0100)]
build: Remove various unused files from build system
These were in git but not distributed in source tarballs, and in fact
not hooked up to the Autotools build system at all.
test/data/valid-introspection-files was mentioned in the CMake build
system (copied from the source directory to the build directory), but
according to `git grep` is not used for anything.
Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=103420
Simon McVittie [Mon, 23 Oct 2017 12:59:34 +0000 (13:59 +0100)]
build: Include README.cmake in Autotools "make dist"
Our official source releases are Autotools "make dist" tarballs, but
there's no reason why CMake users can't use those too, and we already
include the CMake build files.
Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=103420
Simon McVittie [Mon, 23 Oct 2017 12:57:56 +0000 (13:57 +0100)]
build: Distribute individual files and directories from cmake/
If we distribute the entire directory in "make dist" tarballs, then
we include the generated files cmake/DBus1Config.cmake and
cmake/DBus1ConfigVersion.cmake, which we should not.
Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=103420
Simon McVittie [Mon, 23 Oct 2017 12:32:22 +0000 (13:32 +0100)]
build: Distribute more test data in source tarballs
test-bus exercises the parser by trying to parse every file in these
directories. A couple of files were accidentally left out, meaning
those parsing code paths are tested when we build from git, but not
when we build from a tarball release.
Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=103420
Simon McVittie [Mon, 23 Oct 2017 13:41:24 +0000 (14:41 +0100)]
build: Don't explicitly clean up configure-generated files
cmake/DBus1Config.cmake, cmake/DBus1ConfigVersion.cmake and dbus-1.pc
are all generated by AC_CONFIG_FILES, so they are automatically listed
in $(CONFIG_CLEAN_FILES) and cleaned in "make distclean" without further
help from us.
Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=103420
Simon McVittie [Mon, 23 Oct 2017 12:18:55 +0000 (13:18 +0100)]
build: Don't distribute versioninfo.rc in "make dist" tarballs
It's generated by configure, so we should not distribute it.
Because it's generated by configure, it is automatically cleaned up
by "make distclean" via $(CONFIG_CLEAN_FILES).
Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=103420
Ralf Habacker [Wed, 18 Oct 2017 06:23:06 +0000 (08:23 +0200)]
Do not add custom UAC related manifest to cmake builds for MSVC on Windows
MSVC compiler >= 8.0 (VS 2005) add an identical manifest (with uac level
set to 'asInvoker' specified by /MANIFEST) by default to generated binaries
(see https://msdn.microsoft.com/en-us/library/f2c0w594.aspx for details).
Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de> Reviewed-by: Simon McVittie <smcv@collabora.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=102558
Ralf Habacker [Fri, 6 Oct 2017 20:46:13 +0000 (22:46 +0200)]
Update versioninfo.rc.in
- include <windows.h> to be able to use constants
- let versioninfo be visible in explorer by adding a "Translation" value
- change FILEOS from VOS_NT_WINDOWS32, which was intended for Windows NT,
to VOS__WINDOWS32
- stop setting FILEFLAGS 0x20 (VS_FF_SPECIALBUILD), which is not
appropriate here because we build the normal version, not a special
version
- use constants
- fix strings
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=103015 Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de> Reviewed-by: Simon McVittie <smcv@collabora.com>