Commit graph

5170 commits

Author SHA1 Message Date
Simon McVittie
fc30e312ea 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
2017-11-15 12:12:27 +00:00
Simon McVittie
39ef65d07d 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
2017-11-15 12:12:23 +00:00
Simon McVittie
13b640544d 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
2017-11-15 12:12:18 +00:00
Simon McVittie
3d2300efc3 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
2017-11-15 12:12:15 +00:00
Simon McVittie
2edee28f15 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
2017-11-15 12:12:12 +00:00
Simon McVittie
ed40af9284 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
2017-11-15 12:11:54 +00:00
Simon McVittie
5ffb709b42 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
2017-11-15 12:11:21 +00:00
Simon McVittie
fb9e8e4e0c 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
2017-11-15 12:08:21 +00:00
Simon McVittie
3f3498c9c2 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
2017-11-15 12:07:47 +00:00
Simon McVittie
789750feee 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
2017-11-15 12:07:22 +00:00
Simon McVittie
9daf727236 Update NEWS for 1.13.x
Signed-off-by: Simon McVittie <smcv@collabora.com>
2017-11-14 12:25:50 +00:00
Thomas Zajic
c9ce0a7059 Add a missing space in logging output
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=103729
2017-11-14 12:24:27 +00:00
Simon McVittie
85830f4c5b Merge branch 'dbus-1.12' 2017-11-13 17:13:27 +00:00
Simon McVittie
7f92c3cfcf Start 1.12.4
Signed-off-by: Simon McVittie <smcv@collabora.com>
2017-11-13 17:11:27 +00:00
Simon McVittie
0f0968336b 1.12.2
Signed-off-by: Simon McVittie <smcv@collabora.com>
2017-11-13 13:35:55 +00:00
Simon McVittie
06c105545f Update NEWS for 1.12.x
Signed-off-by: Simon McVittie <smcv@collabora.com>
2017-11-10 16:24:59 +00:00
Simon McVittie
3d96f366f1 Update NEWS for 1.13.x
Signed-off-by: Simon McVittie <smcv@collabora.com>
2017-11-10 16:24:47 +00:00
Simon McVittie
1a29dc8544 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 56847ae818)
2017-11-10 16:22:20 +00:00
Simon McVittie
56847ae818 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
2017-11-10 16:21:07 +00:00
Simon McVittie
293cbd03e3 Update NEWS for 1.13.x
Signed-off-by: Simon McVittie <smcv@collabora.com>
2017-11-10 16:20:25 +00:00
Simon McVittie
35238ed567 Update NEWS for 1.12.x
Signed-off-by: Simon McVittie <smcv@collabora.com>
2017-11-10 16:20:02 +00:00
Simon McVittie
b672a683be 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 3c031ef5aa)
2017-11-10 16:10:15 +00:00
Simon McVittie
010223b6d2 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
2017-11-07 12:43:52 +00:00
Simon McVittie
a208e02421 _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 37d5af203c)
2017-11-07 11:43:37 +00:00
Simon McVittie
d000891624 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 6d08f5c04e)
2017-11-07 11:43:34 +00:00
Simon McVittie
208af9a447 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 0ea0e4b0fd)
2017-11-07 11:43:31 +00:00
Simon McVittie
37d5af203c _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
2017-11-07 11:38:53 +00:00
Simon McVittie
6d08f5c04e 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
2017-11-07 11:38:43 +00:00
Simon McVittie
0ea0e4b0fd 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
2017-11-07 11:38:26 +00:00
Simon McVittie
96d878d90c 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
2017-11-07 11:38:17 +00:00
Simon McVittie
4330c213e7 _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
2017-11-07 11:37:48 +00:00
Simon McVittie
3e2463fa1f Update NEWS
Signed-off-by: Simon McVittie <smcv@collabora.com>
2017-11-06 17:22:12 +00:00
Simon McVittie
25c54a79a7 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
2017-11-06 16:41:13 +00:00
Simon McVittie
2a72903661 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
2017-11-06 16:41:08 +00:00
Simon McVittie
f5afec02f2 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
2017-11-06 16:41:05 +00:00
Simon McVittie
f58b77f968 _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
2017-11-06 14:07:21 +00:00
Simon McVittie
d5742550ca 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
2017-11-06 14:07:21 +00:00
Simon McVittie
83b439f7b4 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
2017-11-06 14:07:21 +00:00
Simon McVittie
3c031ef5aa 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
2017-11-06 14:07:21 +00:00
Simon McVittie
f7875ebff6 Use a micro version that won't break DBUS_VERSION
DBUS_VERSION assumes that major/minor/micro are numeric and less than
256 each.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2017-11-06 14:00:22 +00:00
Simon McVittie
b5d1585b0f Update NEWS
Signed-off-by: Simon McVittie <smcv@collabora.com>
2017-10-31 13:07:03 +00:00
Tony Theodore
47d2e5a345 build: Avoid using echo -e
`echo -e` is a GNU extension, and in particular not available on
Darwin.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=103493
[smcv: Added commit message]
Reviewed-by: Simon McVittie <smcv@collabora.com>

(cherry picked from commit 216ae1adfc)
2017-10-31 13:06:55 +00:00
Simon McVittie
b6fbe63039 Update NEWS
Signed-off-by: Simon McVittie <smcv@collabora.com>
2017-10-31 13:06:48 +00:00
Tony Theodore
216ae1adfc build: Avoid using echo -e
`echo -e` is a GNU extension, and in particular not available on
Darwin.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=103493
[smcv: Added commit message]
Reviewed-by: Simon McVittie <smcv@collabora.com>
2017-10-31 13:04:15 +00:00
Simon McVittie
d6eb0039c1 Update NEWS
Signed-off-by: Simon McVittie <smcv@collabora.com>
2017-10-31 11:40:56 +00:00
ilovezfs
c416bb37dd build: Use $(MKDIR_P) syntax suitable for install-sh
This fixes the build when a GNU-compatible `mkdir -p` is not available.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=103521
[smcv: Add commit message]
Reviewed-by: Simon McVittie <smcv@collabora.com>

(cherry picked from commit c7d8b723eb)
2017-10-31 11:40:52 +00:00
Simon McVittie
d2617c0353 Update NEWS
Signed-off-by: Simon McVittie <smcv@collabora.com>
2017-10-31 11:40:29 +00:00
ilovezfs
c7d8b723eb build: Use $(MKDIR_P) syntax suitable for install-sh
This fixes the build when a GNU-compatible `mkdir -p` is not available.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=103521
[smcv: Add commit message]
Reviewed-by: Simon McVittie <smcv@collabora.com>
2017-10-31 11:36:05 +00:00
Simon McVittie
b299a226b3 Bump version for 1.12.x branch
Signed-off-by: Simon McVittie <smcv@collabora.com>
2017-10-30 14:49:59 +00:00
Simon McVittie
9ebf0004d1 Bump version for 1.13.x branch
Signed-off-by: Simon McVittie <smcv@collabora.com>
2017-10-30 14:49:26 +00:00