]> git.ipfire.org Git - thirdparty/dbus.git/log
thirdparty/dbus.git
7 years agodbus-spawn-unix: If a fd is not close-on-exec, look it up in /proc/self/fd
Simon McVittie [Tue, 20 Nov 2018 17:32:02 +0000 (17:32 +0000)] 
dbus-spawn-unix: If a fd is not close-on-exec, look it up in /proc/self/fd

In operating systems where /proc/self/fd works like it does on Linux
(Linux itself, and FreeBSD with Linux /proc emulation) this will give
us a clue about the fd that was leaked or opened incorrectly.

Signed-off-by: Simon McVittie <smcv@collabora.com>
7 years agoFindDocBookXSL.cmake: Add
Simon McVittie [Tue, 20 Nov 2018 18:27:47 +0000 (18:27 +0000)] 
FindDocBookXSL.cmake: Add

Taken from
<https://github.com/KDE/kdoctools/blob/master/cmake/FindDocBookXSL.cmake>

Signed-off-by: Simon McVittie <smcv@collabora.com>
Resolves: https://gitlab.freedesktop.org/dbus/dbus/issues/237

7 years agoMerge branch '233-fix-broken-meinproc4' into 'master'
Simon McVittie [Tue, 20 Nov 2018 17:13:31 +0000 (17:13 +0000)] 
Merge branch '233-fix-broken-meinproc4' into 'master'

Fix broken meinproc4-based Docbook processing by using xsltproc instead

Closes #233

See merge request dbus/dbus!48

Reviewed-by: smcv
7 years agoAdd xsltproc usage to README.cmake
Ralf Habacker [Tue, 20 Nov 2018 13:19:59 +0000 (14:19 +0100)] 
Add xsltproc usage to README.cmake

7 years agoFix incorrect links in index html page used by cmake
Ralf Habacker [Tue, 20 Nov 2018 14:09:36 +0000 (15:09 +0100)] 
Fix incorrect links in index html page used by cmake

7 years agoFix broken meinproc4 based docbook generating by already used xsltproc
Ralf Habacker [Tue, 20 Nov 2018 13:06:17 +0000 (14:06 +0100)] 
Fix broken meinproc4 based docbook generating by already used xsltproc

Using xsltproc helps to reduce manual editing of xml doc and avoids
cyclic dependency (kdelibs depends on dbus and dbus depends on kdelibs).
It is available on all platforms (in the opposite to xmlto) and supports
freedesktop CI out of the box.

This commit adds docbook-xml and docbook-xsl as new dependency for cmake
and removes obsolate xmlto support, which depends on xsltproc.

7 years agoMerge branch 'error-matches-bool' into 'master'
Simon McVittie [Tue, 20 Nov 2018 13:53:56 +0000 (13:53 +0000)] 
Merge branch 'error-matches-bool' into 'master'

Add _DBUS_ASSERT_ERROR_XOR_BOOL, and a test for assertions

See merge request dbus/dbus!49

Reviewed-by: pwithnall
7 years agoMerge branch 'desktop-file-leak-refactor' into 'master'
Simon McVittie [Tue, 20 Nov 2018 13:39:14 +0000 (13:39 +0000)] 
Merge branch 'desktop-file-leak-refactor' into 'master'

BusDesktopFile: Refactor logic to free the parser contents

See merge request dbus/dbus!43

Reviewed-by: pwithnall
7 years agoMerge branch 'test-random-ints' into 'master'
Simon McVittie [Tue, 20 Nov 2018 13:35:53 +0000 (13:35 +0000)] 
Merge branch 'test-random-ints' into 'master'

marshal-recursive test: improve clarity, avoid undefined behaviour

See merge request dbus/dbus!46

Reviewed-by: pwithnall
7 years agoAdd a test for assertions
Simon McVittie [Tue, 20 Nov 2018 12:48:51 +0000 (12:48 +0000)] 
Add a test for assertions

Signed-off-by: Simon McVittie <smcv@collabora.com>
7 years ago_dbus_disable_crash_handling: Factor out from test-segfault
Simon McVittie [Tue, 20 Nov 2018 12:48:40 +0000 (12:48 +0000)] 
_dbus_disable_crash_handling: Factor out from test-segfault

Signed-off-by: Simon McVittie <smcv@collabora.com>
7 years agoImprove diagnostics for error assertion failures
Simon McVittie [Tue, 20 Nov 2018 12:24:35 +0000 (12:24 +0000)] 
Improve diagnostics for error assertion failures

Signed-off-by: Simon McVittie <smcv@collabora.com>
7 years agoCleanup of cmake doc-related targets
Ralf Habacker [Tue, 20 Nov 2018 12:56:39 +0000 (13:56 +0100)] 
Cleanup of cmake doc-related targets

There is now a top-level target "doc" that is always built.
Depending on the detected generators it depends on optional
targets like apidoc' and 'devhelp2'.

7 years ago_DBUS_ASSERT_ERROR_XOR_BOOL: Add and use
Simon McVittie [Tue, 20 Nov 2018 12:17:20 +0000 (12:17 +0000)] 
_DBUS_ASSERT_ERROR_XOR_BOOL: Add and use

As suggested by Philip Withnall in dbus!43.

Signed-off-by: Simon McVittie <smcv@collabora.com>
7 years agoBusDesktopFile: Refactor logic to free the parser contents
Simon McVittie [Fri, 16 Nov 2018 17:30:47 +0000 (17:30 +0000)] 
BusDesktopFile: Refactor logic to free the parser contents

Now that we have _DBUS_STRING_INIT_INVALID, we can initialize
parser.data to a value that is safe for _dbus_string_free(), which
means we can put all the cleanup through a single code path that
definitely frees everything.

(This is just refactoring, not a correctness fix.)

Signed-off-by: Simon McVittie <smcv@collabora.com>
7 years agoci-build.sh: Show file size in list of files to be able to compare generated file...
Ralf Habacker [Mon, 19 Nov 2018 19:29:33 +0000 (20:29 +0100)] 
ci-build.sh: Show file size in list of files to be able to compare generated file size

7 years agoUpdate NEWS
Simon McVittie [Tue, 20 Nov 2018 11:32:54 +0000 (11:32 +0000)] 
Update NEWS

Signed-off-by: Simon McVittie <smcv@collabora.com>
7 years agoMerge branch 'va-copy' into 'master'
Simon McVittie [Tue, 20 Nov 2018 11:23:36 +0000 (11:23 +0000)] 
Merge branch 'va-copy' into 'master'

Don't check how to copy a va_list if we have va_copy; only use _DBUS_VA_COPY_ASSIGN on MSVC

See merge request dbus/dbus!35

Reviewed-by: rhabacker
7 years agoMerge branch 'containers-test-race' into 'master'
Simon McVittie [Tue, 20 Nov 2018 11:22:48 +0000 (11:22 +0000)] 
Merge branch 'containers-test-race' into 'master'

containers test: Wait a few more seconds for the socket to be deleted

See merge request dbus/dbus!47

Reviewed-by: pwithnall
7 years agoMerge branch 'keyring-undefined-shift' into 'master'
Simon McVittie [Tue, 20 Nov 2018 11:22:20 +0000 (11:22 +0000)] 
Merge branch 'keyring-undefined-shift' into 'master'

keyring: Avoid undefined out-of-range shift

See merge request dbus/dbus!45

7 years agoMerge branch 'desktop-file-leak' into 'master'
Simon McVittie [Tue, 20 Nov 2018 11:21:32 +0000 (11:21 +0000)] 
Merge branch 'desktop-file-leak' into 'master'

bus: Fix memory leaks when parsing .service files

See merge request dbus/dbus!42

Reviewed-by: pwithnall
7 years agoMerge branch 'misc-leaks' into 'master'
Simon McVittie [Tue, 20 Nov 2018 11:21:05 +0000 (11:21 +0000)] 
Merge branch 'misc-leaks' into 'master'

Fix small memory leaks

See merge request dbus/dbus!41

7 years agocontainers test: Wait a few more seconds for the socket to be deleted
Simon McVittie [Mon, 19 Nov 2018 13:53:52 +0000 (13:53 +0000)] 
containers test: Wait a few more seconds for the socket to be deleted

Previously, we were waiting a few seconds for the dbus-daemon to stop
listening, then trying to connect again and asserting that it failed,
then immediately asserting that the socket had actually been deleted.
However, there is a race here: the dbus-daemon stops listening on the
socket, and then deletes it. If the test client wins the race by
probing to see whether the socket is present after the dbus-daemon
has stopped listening but before the dbus-daemon has deleted it, then
the test will fail.

This intermittently happens on Gitlab-CI, most recently in
<https://gitlab.freedesktop.org/smcv/dbus/-/jobs/45694>.

Signed-off-by: Simon McVittie <smcv@collabora.com>
7 years agotests: Generate random values in unsigned integer space
Simon McVittie [Fri, 31 Aug 2018 18:01:03 +0000 (19:01 +0100)] 
tests: Generate random values in unsigned integer space

When we're doing bitwise operations, addition with wraparound and
large left-shifts, it seems safer to use unsigned integers, where
the effect of overflow is well-defined (it wraps around). Signed
integer overflow is undefined behaviour, so compilers are free to
optimize by assuming that it cannot happen.

Detected by the undefined behaviour sanitizer (UBSan).

Signed-off-by: Simon McVittie <smcv@collabora.com>
7 years agotests: Remove unnecessary casts
Simon McVittie [Fri, 31 Aug 2018 17:58:06 +0000 (18:58 +0100)] 
tests: Remove unnecessary casts

If we have a variable "Type value;" then casting &value to (Type *) is
not useful, because it has that type already; it can only hide errors.

Signed-off-by: Simon McVittie <smcv@collabora.com>
7 years agotests: Make it clearer that we avoid overflowing fixed-length buffers
Simon McVittie [Fri, 31 Aug 2018 17:50:37 +0000 (18:50 +0100)] 
tests: Make it clearer that we avoid overflowing fixed-length buffers

Signed-off-by: Simon McVittie <smcv@collabora.com>
7 years agokeyring: Avoid undefined out-of-range shift
Simon McVittie [Fri, 17 Aug 2018 18:38:07 +0000 (19:38 +0100)] 
keyring: Avoid undefined out-of-range shift

Detected with UndefinedBehaviourSanitizer, which will warn on
about 50% of calls to this function, when s[3] is 128 or more,
because id is signed, so 128 << 24 is undefined signed overflow.

All we want here is a random non-negative signed int (in the range 0
to 2**31-1, with 31 bits varying). The intention seemed to be to
generate a random unsigned int, cast it to signed, and then negate it
if negative, but it seems simpler and more obviously correct to just
make sure the most  significant byte fits in the non-negative range.

Signed-off-by: Simon McVittie <smcv@collabora.com>
7 years agoBusDesktopFile: Don't leak content if key=value appears before [Section]
Simon McVittie [Fri, 16 Nov 2018 17:25:18 +0000 (17:25 +0000)] 
BusDesktopFile: Don't leak content if key=value appears before [Section]

BusDesktopFile has a strange convention in which the various parser
helper functions (parse_section_start(), etc.) free the parser on error.
However, this particular error case happens outside the helper functions
and so will leak.

Signed-off-by: Simon McVittie <smcv@collabora.com>
7 years agodesktop-file test: Don't leak errors
Simon McVittie [Fri, 16 Nov 2018 17:19:50 +0000 (17:19 +0000)] 
desktop-file test: Don't leak errors

Signed-off-by: Simon McVittie <smcv@collabora.com>
7 years agobus_container_instance_new: Don't leak empty DBusString object
Simon McVittie [Fri, 17 Aug 2018 14:37:36 +0000 (15:37 +0100)] 
bus_container_instance_new: Don't leak empty DBusString object

We already stole its data, but that allocated a new buffer, which we
still need to free.

Signed-off-by: Simon McVittie <smcv@collabora.com>
7 years agobus_driver_handle_become_monitor: Don't leak zero-length array of rules
Simon McVittie [Fri, 17 Aug 2018 14:33:10 +0000 (15:33 +0100)] 
bus_driver_handle_become_monitor: Don't leak zero-length array of rules

Only privileged users can trigger this leak, so it is not a denial of
service attack.

Signed-off-by: Simon McVittie <smcv@collabora.com>
7 years agobuild: Require va_copy() or __va_copy() on non-MSVC compilers
Simon McVittie [Fri, 16 Nov 2018 16:21:48 +0000 (16:21 +0000)] 
build: Require va_copy() or __va_copy() on non-MSVC compilers

va_copy() is a C99 feature, and should be widely supported by now.
gcc in strict C89 mode implements an equivalent __va_copy() instead.

MSVC 2013 implements va_copy(), but at the moment we still aim to support
MSVC 2010 and 2012, which don't have it. However, we know that in
Windows ABIs, va_list is a pointer, so we can use
_DBUS_VA_COPY_ASSIGN. We do not support MSVC for Autotools builds, only
CMake, due to its non-Unixish command-line interface.

Signed-off-by: Simon McVittie <smcv@collabora.com>
7 years agoCI: Do one build with mingw + CMake by default
Simon McVittie [Thu, 15 Nov 2018 18:32:06 +0000 (18:32 +0000)] 
CI: Do one build with mingw + CMake by default

Signed-off-by: Simon McVittie <smcv@collabora.com>
7 years agoOnly use _DBUS_VA_COPY_ASSIGN to implement va_copy() on MSVC
Simon McVittie [Thu, 15 Nov 2018 17:42:13 +0000 (17:42 +0000)] 
Only use _DBUS_VA_COPY_ASSIGN to implement va_copy() on MSVC

We don't know that _DBUS_VA_COPY_ASSIGN is always the right choice.
However, we do know that it's OK on MSVC versions too old to support
va_copy().

Signed-off-by: Simon McVittie <smcv@collabora.com>
7 years agoDon't check how to copy a va_list if we already have va_copy()
Simon McVittie [Thu, 15 Nov 2018 17:40:33 +0000 (17:40 +0000)] 
Don't check how to copy a va_list if we already have va_copy()

If we already have ISO C va_copy() or its non-standard counterpart
__va_copy(), then there's no need to do an AC_RUN_IFELSE or its
CMake equivalent to detect whether "args2 = args1" or "*args2 = *args1"
works. AC_RUN_IFELSE is problematic during cross-compilation, where the
program cannot be run (you have to know in advance that the test program
will be run and what its result will be), so we want to avoid it whenever
possible.

Signed-off-by: Simon McVittie <smcv@collabora.com>
7 years agoMerge branch 'cmake-generate-dbus.devhelp2' into 'master'
Simon McVittie [Mon, 19 Nov 2018 11:06:36 +0000 (11:06 +0000)] 
Merge branch 'cmake-generate-dbus.devhelp2' into 'master'

Add generating dbus.devhelp2 to cmake build system

See merge request dbus/dbus!39

7 years agoAdd generating dbus.devhelp2 to cmake build system
Ralf Habacker [Fri, 16 Nov 2018 22:01:03 +0000 (23:01 +0100)] 
Add generating dbus.devhelp2 to cmake build system

7 years agoembedded tests: Make it easier to run a single test-case
Simon McVittie [Thu, 12 Jul 2018 16:38:04 +0000 (17:38 +0100)] 
embedded tests: Make it easier to run a single test-case

When running tests under "make check" or similar to take advantage
of facilities like AM_TESTS_ENVIRONMENT and AX_VALGRIND_CHECK, it's
more straightforward to set an environment variable than to pass a
command-line option.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://gitlab.freedesktop.org/dbus/dbus/issues/218

7 years agoUpdate NEWS
Simon McVittie [Fri, 16 Nov 2018 15:04:52 +0000 (15:04 +0000)] 
Update NEWS

Signed-off-by: Simon McVittie <smcv@collabora.com>
7 years agoMerge branch 'iso-varargs' into 'master'
Simon McVittie [Fri, 16 Nov 2018 11:41:32 +0000 (11:41 +0000)] 
Merge branch 'iso-varargs' into 'master'

internals: Assume compiler supports a subset of ISO varargs syntax

See merge request dbus/dbus!36

Reviewed-by: rhabacker
Reviewed-by: pwithnall
7 years agointernals: Assume compiler supports a subset of ISO varargs syntax
Simon McVittie [Thu, 15 Nov 2018 18:55:57 +0000 (18:55 +0000)] 
internals: Assume compiler supports a subset of ISO varargs syntax

We have considerable anecdotal evidence that every relevant compiler
supports at least the small part of ISO varargs syntax that we need
here, because tools/tool-common.h has contained

    #define VERBOSE(...) do {} while (0)

since dbus 1.9.2 (2014) and nobody has complained yet. With that in
mind, let's simplify.

Signed-off-by: Simon McVittie <smcv@collabora.com>
7 years agoMerge branch 'dbus-va-copy-fixup' into 'master'
Simon McVittie [Thu, 15 Nov 2018 15:40:32 +0000 (15:40 +0000)] 
Merge branch 'dbus-va-copy-fixup' into 'master'

Refactor cmake checks for DBUS_VA_COPY and DBUS_VA_COPY_ARRAY

See merge request dbus/dbus!29

7 years agoRefactor cmake checks for DBUS_VA_COPY and DBUS_VA_COPY_ARRAY
Ralf Habacker [Thu, 25 Oct 2018 18:14:24 +0000 (20:14 +0200)] 
Refactor cmake checks for DBUS_VA_COPY and DBUS_VA_COPY_ARRAY

For test case execution, CheckCSourceCompiles is now used instead
of try_compile and the determination of DBUS_VA_AS_ARRAY is
performed with a separate test instead of evaluating the result
of HAVE_VA_COPY and HAVE___VA_COPY.

The tests are performed for all supported compilers. Since older
MSVC compilers (< 2013) do not support va_copy(), the macro
_DBUS_VA_ASSIGN(a1,a2) with the implementation { a1 = a2; } is used
as a fallback.

7 years agoMerge branch 'avc_open' into 'master'
Simon McVittie [Thu, 15 Nov 2018 15:17:47 +0000 (15:17 +0000)] 
Merge branch 'avc_open' into 'master'

Stop using avc_init() which is deprecated and use avc_open() instead. Also, use SELINUX_CB_POLICYLOAD instead of AVC_CALLBACK_RESET callback.

See merge request dbus/dbus!31

Reviewed-by: smcv
7 years agoUse SELINUX_CB_POLICYLOAD instead of AVC_CALLBACK_RESET callback
Laurent Bigonville [Wed, 30 May 2018 16:18:15 +0000 (18:18 +0200)] 
Use SELINUX_CB_POLICYLOAD instead of AVC_CALLBACK_RESET callback

Use SELINUX_CB_POLICYLOAD instead of AVC_CALLBACK_RESET callback as this
only seems necessary on policy reload and not if the enforcing mode is
changing.

See discussion at https://marc.info/?l=selinux&m=152173501930182&w=2

https://gitlab.freedesktop.org/dbus/dbus/issues/134

7 years agoStop using avc_init() which is deprecated
Laurent Bigonville [Sat, 3 Mar 2018 12:15:17 +0000 (13:15 +0100)] 
Stop using avc_init() which is deprecated

Stop using avc_init() and use avc_open() instead. With this commit
dbus-daemon will stop using a thread to monitor the avc netlink and will
poll it instead.

https://gitlab.freedesktop.org/dbus/dbus/issues/134

7 years agoMerge branch 'pc-file-trailing-slash-issue' into 'master'
Simon McVittie [Thu, 15 Nov 2018 13:39:31 +0000 (13:39 +0000)] 
Merge branch 'pc-file-trailing-slash-issue' into 'master'

Avoid double slashes in paths created by pkg-config

See merge request dbus/dbus!30

7 years agoAvoid double slashes in paths created by pkg-config
Ralf Habacker [Fri, 26 Oct 2018 13:12:29 +0000 (15:12 +0200)] 
Avoid double slashes in paths created by pkg-config

If in a .pc variable a path is created from another
variable, such as exec_prefix=${prefix}/lib, prefix
must not contain a trailing slash to avoid double
slashes in the generated path.

7 years agoMerge branch 'msvc-compile-fix' into 'master'
Simon McVittie [Thu, 15 Nov 2018 13:09:54 +0000 (13:09 +0000)] 
Merge branch 'msvc-compile-fix' into 'master'

Msvc compile fix

See merge request dbus/dbus!33

Reviewed-by: smcv
Reviewed-by: pwithnall
7 years agoWindows MSVC compile fix
Ralf Habacker [Thu, 8 Nov 2018 12:39:03 +0000 (13:39 +0100)] 
Windows MSVC compile fix

Do not use unistd.h with MSVC because this header file does not
exist for this compiler.

Fixup of commit b0c0652005ce6892dd359f1b098dbdec9fb7455f

7 years agoMerge branch '222-comm-whitespace' into 'master'
Simon McVittie [Thu, 1 Nov 2018 12:07:22 +0000 (12:07 +0000)] 
Merge branch '222-comm-whitespace' into 'master'

Fix whitespace and error behaviour for _dbus_command_from_pid()

Closes #222

See merge request dbus/dbus!28

Reviewed-by: pwithnall
7 years agotests: Assert that _dbus_command_for_pid() has correct error behaviour
Simon McVittie [Thu, 25 Oct 2018 15:58:15 +0000 (16:58 +0100)] 
tests: Assert that _dbus_command_for_pid() has correct error behaviour

Signed-off-by: Simon McVittie <smcv@collabora.com>
7 years agosysdeps: Return an error for _dbus_command_for_pid on Windows
Simon McVittie [Thu, 25 Oct 2018 15:47:18 +0000 (16:47 +0100)] 
sysdeps: Return an error for _dbus_command_for_pid on Windows

If a function returns boolean for success/error, and returns a
DBusError, then it should set the DBusError if and only if it
returns FALSE.

Signed-off-by: Simon McVittie <smcv@collabora.com>
7 years agotests: Assert that dbus#222 has been fixed
Simon McVittie [Wed, 31 Oct 2018 15:22:30 +0000 (15:22 +0000)] 
tests: Assert that dbus#222 has been fixed

7 years agosysdeps: Remove trailing NUL from command lines from /proc
Simon McVittie [Thu, 25 Oct 2018 15:43:36 +0000 (16:43 +0100)] 
sysdeps: Remove trailing NUL from command lines from /proc

Resolves: https://gitlab.freedesktop.org/dbus/dbus/issues/222
Signed-off-by: Simon McVittie <smcv@collabora.com>
7 years agotests: Add a unit test for _dbus_command_for_pid()
Simon McVittie [Wed, 31 Oct 2018 15:21:12 +0000 (15:21 +0000)] 
tests: Add a unit test for _dbus_command_for_pid()

In particular this demonstrates that dbus#222 has been solved.

Signed-off-by: Simon McVittie <smcv@collabora.com>
7 years agotest_get_helper_executable: Add function
Simon McVittie [Wed, 31 Oct 2018 15:22:26 +0000 (15:22 +0000)] 
test_get_helper_executable: Add function

This is basically the same as get_test_exec() in dbus-spawn-test.c,
but GLib-flavoured.

Signed-off-by: Simon McVittie <smcv@collabora.com>
7 years agotest_incomplete: Add function
Simon McVittie [Wed, 31 Oct 2018 15:19:19 +0000 (15:19 +0000)] 
test_incomplete: Add function

This is a wrapper for g_test_incomplete(), which works around bugs in
that function prior to GLib 2.57.3. I originally wrote it for librsvg.

Signed-off-by: Simon McVittie <smcv@collabora.com>
7 years agotests: Build test-sleep-forever even if embedded tests are disabled
Simon McVittie [Thu, 25 Oct 2018 15:42:21 +0000 (16:42 +0100)] 
tests: Build test-sleep-forever even if embedded tests are disabled

It will be used as a long-running subprocess to test
_dbus_command_for_pid().

Signed-off-by: Simon McVittie <smcv@collabora.com>
7 years agotests: Build installable helpers whenever any tests are enabled
Simon McVittie [Wed, 31 Oct 2018 15:09:24 +0000 (15:09 +0000)] 
tests: Build installable helpers whenever any tests are enabled

We might need these to run tests at build-time, so we should build them
whenever either modular or embedded tests are enabled, even if
installed-tests aren't.

We haven't noticed this bug until now because $(installable_helpers)
only contained test-apparmor-activation, which isn't normally needed at
build-time because the AppArmor test can only work when run as root.

Signed-off-by: Simon McVittie <smcv@collabora.com>
7 years agoMerge branch '135-dbus-run-session-windows' into 'master'
Ralf Habacker [Thu, 25 Oct 2018 19:50:06 +0000 (19:50 +0000)] 
Merge branch '135-dbus-run-session-windows' into 'master'

Add windows implementation of dbus-run-session helper tool for cmake

See merge request dbus/dbus!22

7 years agoAdd Windows implementation of dbus-run-session tool
Ralf Habacker [Wed, 18 Nov 2015 22:35:46 +0000 (23:35 +0100)] 
Add Windows implementation of dbus-run-session tool

Bug: https://gitlab.freedesktop.org/dbus/dbus/issues/135
Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
Reviewed-by: Simon McVittie <smcv@collabora.com>
7 years agoRevert "Refactor cmake checks for DBUS_VA_COPY and DBUS_VA_COPY_ARRAY"
Ralf Habacker [Thu, 25 Oct 2018 18:13:17 +0000 (20:13 +0200)] 
Revert "Refactor cmake checks for DBUS_VA_COPY and DBUS_VA_COPY_ARRAY"

This reverts commit bd6ece893a45e8103a696ee64adc1baa2096c422,
which was added without a final review.

7 years agoMerge branch 'cmake-ddlh' into 'master'
Simon McVittie [Thu, 25 Oct 2018 16:56:04 +0000 (16:56 +0000)] 
Merge branch 'cmake-ddlh' into 'master'

cmake: Install dbus-daemon-launch-helper even if tests are disabled

See merge request dbus/dbus!9
Reviewed-by: rhabacker
7 years agocmake: Install d-d-launch-helper to ${CMAKE_INSTALL_LIBEXECDIR}
Simon McVittie [Mon, 22 Oct 2018 09:20:37 +0000 (10:20 +0100)] 
cmake: Install d-d-launch-helper to ${CMAKE_INSTALL_LIBEXECDIR}

Instead of hard-coding the lib subdirectory of the installation prefix,
use the ${CMAKE_INSTALL_LIBEXECDIR} provided by the GNUInstallDirs
module, which defaults to the libexec subdirectory of the installation
prefix. This is consistent with the Autotools build system, which
installs to ${exec_prefix}/libexec unless modified with --libexecdir.

Signed-off-by: Simon McVittie <smcv@collabora.com>
7 years agocmake: Use non-deprecated install mechanism for d-d-launch-helper
Simon McVittie [Mon, 22 Oct 2018 09:15:44 +0000 (10:15 +0100)] 
cmake: Use non-deprecated install mechanism for d-d-launch-helper

As suggested by Ralf Habacker on !9.

Signed-off-by: Simon McVittie <smcv@collabora.com>
7 years agocmake: Install dbus-daemon-launch-helper even if tests are disabled
Simon McVittie [Wed, 3 Oct 2018 17:34:13 +0000 (18:34 +0100)] 
cmake: Install dbus-daemon-launch-helper even if tests are disabled

This is a long-standing bug, spotted while moving test code into
the test directory.

Signed-off-by: Simon McVittie <smcv@collabora.com>
7 years agoMerge branch 'cleanup-cmake-source-dir-definitions' into 'master'
Simon McVittie [Thu, 25 Oct 2018 13:51:38 +0000 (13:51 +0000)] 
Merge branch 'cleanup-cmake-source-dir-definitions' into 'master'

Cleanup of the cmake definitions of source directories

See merge request dbus/dbus!27

Reviewed-by: smcv
7 years agoCleanup of the cmake definitions of source directories
Ralf Habacker [Tue, 23 Oct 2018 19:56:25 +0000 (21:56 +0200)] 
Cleanup of the cmake definitions of source directories

Since the cmake build system is located below the cmake/
subdirectory, references to the source files used such as
../../bus or ${CMAKE_SOURCE_DIR}/../dbus etc. are required.
To standardize and simplify this, a cmake variable is now
defined in each of the listed directories, which contains
the corresponding path.

7 years agoMerge branch '117-checks-from-configure-ac' into 'master'
Ralf Habacker [Wed, 24 Oct 2018 17:01:52 +0000 (17:01 +0000)] 
Merge branch '117-checks-from-configure-ac' into 'master'

Take cmake checks from configure.ac

See merge request dbus/dbus!18

7 years agoRemove todo(s) for cmake build system
Ralf Habacker [Sun, 21 Oct 2018 08:40:28 +0000 (10:40 +0200)] 
Remove todo(s) for cmake build system

Bug: https://gitlab.freedesktop.org/dbus/dbus/merge_requests/18

7 years agoAdd cmake support for HAVE_GNUC_VARARGS and HAVE_ISO_VARARGS
Ralf Habacker [Mon, 22 Oct 2018 15:03:52 +0000 (17:03 +0200)] 
Add cmake support for HAVE_GNUC_VARARGS and HAVE_ISO_VARARGS

Reviewed-by: Simon McVittie <smcv@collabora.com>
Bug: https://gitlab.freedesktop.org/dbus/dbus/merge_requests/18

7 years agoAdd cmake check for HAVE_DDFD
Ralf Habacker [Sun, 21 Oct 2018 09:36:16 +0000 (11:36 +0200)] 
Add cmake check for HAVE_DDFD

Reviewed-by: Simon McVittie <smcv@collabora.com>
Bug: https://gitlab.freedesktop.org/dbus/dbus/merge_requests/18

7 years agoAdd cmake check for HAVE_DIRFD
Ralf Habacker [Mon, 22 Oct 2018 11:27:46 +0000 (13:27 +0200)] 
Add cmake check for HAVE_DIRFD

Reviewed-by: Simon McVittie <smcv@collabora.com>
Bug: https://gitlab.freedesktop.org/dbus/dbus/merge_requests/18

7 years agoAdd cmake check for DBUS_USE_SYNC
Ralf Habacker [Sun, 21 Oct 2018 09:34:13 +0000 (11:34 +0200)] 
Add cmake check for DBUS_USE_SYNC

Reviewed-by: Simon McVittie <smcv@collabora.com>
Bug: https://gitlab.freedesktop.org/dbus/dbus/merge_requests/18

7 years agoRefactor cmake checks for DBUS_VA_COPY and DBUS_VA_COPY_ARRAY
Ralf Habacker [Sat, 20 Oct 2018 20:34:33 +0000 (22:34 +0200)] 
Refactor cmake checks for DBUS_VA_COPY and DBUS_VA_COPY_ARRAY

For test case execution, CheckCSourceCompiles is now used instead
of try_compile and the determination of DBUS_VA_AS_ARRAY is
performed with a separate test instead of evaluating the result
of HAVE_VA_COPY and HAVE___VA_COPY.

The tests are performed for all supported compilers. Since older
MSVC compilers (< 2013) do not support va_copy(), the macro
_DBUS_VA_ASSIGN(a1,a2) with the implementation { a1 = a2; } is used
as a fallback.

Reviewed-by: Simon McVittie <smcv@collabora.com>
Bug: https://gitlab.freedesktop.org/dbus/dbus/merge_requests/18

7 years agoAdd cmake support for DBUS_HAVE_LINUX_EPOLL
Ralf Habacker [Sat, 20 Oct 2018 20:22:20 +0000 (22:22 +0200)] 
Add cmake support for DBUS_HAVE_LINUX_EPOLL

Reviewed-by: Simon McVittie <smcv@collabora.com>
Bug: https://gitlab.freedesktop.org/dbus/dbus/merge_requests/18

7 years agoUse same name for DBUS_HAVE_LINUX_EPOLL cpp macro and Automake conditional
Ralf Habacker [Sat, 20 Oct 2018 20:25:06 +0000 (22:25 +0200)] 
Use same name for DBUS_HAVE_LINUX_EPOLL cpp macro and Automake conditional

Reviewed-by: Simon McVittie <smcv@collabora.com>
Bug: https://gitlab.freedesktop.org/dbus/dbus/merge_requests/18

7 years agoMerge branch 'pending-fd-timeout' into 'master'
Simon McVittie [Tue, 23 Oct 2018 19:21:58 +0000 (19:21 +0000)] 
Merge branch 'pending-fd-timeout' into 'master'

dbus-daemon test: Allow much longer for pending fd timeout

Reviewed-by: rhabacker
See merge request dbus/dbus!26

7 years agodbus-daemon test: Allow much longer for pending fd timeout
Simon McVittie [Tue, 23 Oct 2018 10:43:23 +0000 (11:43 +0100)] 
dbus-daemon test: Allow much longer for pending fd timeout

The timeout we're using here is 0.5s (500ms), but the actual time taken
is unbounded, because the OS scheduler might not schedule our process
for an arbitrary length of time after we become runnable.

We previously allowed up to 1 second, but in the CI jobs for dbus!9
and dbus!18 we've seen this take up to 3.4 seconds (presumably
because other tests, or other jobs running on the same shared
infrastructure, starved this process). Allow up to 10 seconds to guard
against spurious failures.

The timeout used in the production system.conf is 150 seconds (2½
minutes), and we're only using the shorter 500ms timeout here to make
the test complete more quickly, so ±10 seconds is relatively
insignificant: the main thing is that it's finite.

Signed-off-by: Simon McVittie <smcv@collabora.com>
7 years agoMerge branch 'broken-poll' into 'master'
Simon McVittie [Mon, 22 Oct 2018 21:32:48 +0000 (21:32 +0000)] 
Merge branch 'broken-poll' into 'master'

build: Never use poll() on Darwin family (macOS, etc.) or Interix

Closes: #232
Reviewed-by: @rhabacker
See merge request dbus/dbus!19

7 years agobuild: Never use poll() on Darwin family (macOS, etc.) or Interix
Simon McVittie [Mon, 22 Oct 2018 10:45:45 +0000 (11:45 +0100)] 
build: Never use poll() on Darwin family (macOS, etc.) or Interix

Doing a runtime check in configure.ac (AC_RUN_IFELSE) has several
disadvantages:

* It doesn't work when cross-compiling. For example, if we build macOS
  binaries on a Linux system, we'd assume that poll() works, but in
  fact it won't.

* It checks the build system capabilities, but that is not necessarily
  appropriate if (for example) a macOS 10.10 user builds binaries that
  could be used by macOS 10.12 or macOS 10.9 users.

* It checks for one specific failure mode, but macOS seems to have a
  history of various implementation issues in poll().

* If we want it to work in CMake, we have to duplicate it in the CMake
  build system.

None of these is a showstopper on its own, but the combination of all
of them makes the current approach to avoiding the broken poll() on
macOS look unreliable. libcurl, a widely-portable library making
extensive use of sockets, specifically doesn't use poll() on Darwin
(macOS, iOS, etc.) or on Interix; let's follow their example here.

See also https://bugzilla.gnome.org/show_bug.cgi?id=302672 and
https://daniel.haxx.se/blog/2016/10/11/poll-on-mac-10-12-is-broken/
for some relevant history.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Resolves: https://gitlab.freedesktop.org/dbus/dbus/issues/232

7 years agoNEWS: Note cmake fixes that might be cherry-picked to dbus-1.12
Simon McVittie [Mon, 22 Oct 2018 14:17:15 +0000 (15:17 +0100)] 
NEWS: Note cmake fixes that might be cherry-picked to dbus-1.12

Signed-off-by: Simon McVittie <smcv@collabora.com>
7 years agocmake: Fix incorrect header list separator in configure checks
Ralf Habacker [Mon, 22 Oct 2018 07:27:30 +0000 (09:27 +0200)] 
cmake: Fix incorrect header list separator in configure checks

CMake expects a semicolon-separated list of headers, not a
space-separated list. In particular, this meant we failed to detect
getpwnam_r() on Linux, and fell back to getpwnam().

Reviewed-by: Simon McVittie <smcv@collabora.com>
7 years agoUpdate NEWS
Simon McVittie [Mon, 22 Oct 2018 11:59:05 +0000 (12:59 +0100)] 
Update NEWS

Signed-off-by: Simon McVittie <smcv@collabora.com>
7 years agoUpdate bug reporting URLs to use freedesktop.org Gitlab
Simon McVittie [Mon, 22 Oct 2018 11:47:53 +0000 (12:47 +0100)] 
Update bug reporting URLs to use freedesktop.org Gitlab

The README change reuses text from CONTRIBUTING.md.

Signed-off-by: Simon McVittie <smcv@collabora.com>
7 years agoci: Clarify why we are running autogen.sh even for CMake builds
Simon McVittie [Mon, 22 Oct 2018 11:43:49 +0000 (12:43 +0100)] 
ci: Clarify why we are running autogen.sh even for CMake builds

Signed-off-by: Simon McVittie <smcv@collabora.com>
7 years agocmake: Add comment to configure checks explaining why we are not specifying HAVE_SOCK...
Ralf Habacker [Tue, 16 Oct 2018 11:59:04 +0000 (13:59 +0200)] 
cmake: Add comment to configure checks explaining why we are not specifying HAVE_SOCKLEN_T

Bug: https://gitlab.freedesktop.org/dbus/dbus/issues/117
Reviewed-by: Simon McVittie <smcv@collabora.com>
7 years agoMove DBUS_USE_OUTPUT_DEBUG_STRING to config.h.cmake
Ralf Habacker [Tue, 16 Oct 2018 11:58:27 +0000 (13:58 +0200)] 
Move DBUS_USE_OUTPUT_DEBUG_STRING to config.h.cmake

Bug: https://gitlab.freedesktop.org/dbus/dbus/issues/117
Reviewed-by: Simon McVittie <smcv@collabora.com>
7 years agotools/ci-build.sh: Add a note why we are running autogen.sh also on cmake builds
Ralf Habacker [Wed, 17 Oct 2018 12:52:49 +0000 (14:52 +0200)] 
tools/ci-build.sh: Add a note why we are running autogen.sh also on cmake builds

Bug: https://gitlab.freedesktop.org/dbus/dbus/issues/117
Reviewed-by: Simon McVittie <smcv@collabora.com>
7 years agoRemove duplicated HAVE_CONFIG_H definition in cmake build system
Ralf Habacker [Mon, 15 Oct 2018 18:05:36 +0000 (20:05 +0200)] 
Remove duplicated HAVE_CONFIG_H definition in cmake build system

Bug: https://gitlab.freedesktop.org/dbus/dbus/issues/117
Reviewed-by: Simon McVittie <smcv@collabora.com>
7 years agoAdd missing setup of DBUS_BUS_ENABLE_INOTIFY
Ralf Habacker [Tue, 16 Oct 2018 12:00:17 +0000 (14:00 +0200)] 
Add missing setup of DBUS_BUS_ENABLE_INOTIFY

Bug: https://gitlab.freedesktop.org/dbus/dbus/issues/117
Reviewed-by: Simon McVittie <smcv@collabora.com>
7 years agoMove DBUS_ENABLE_EMBEDDED_TESTS and BUS_ENABLE_MODULAR_TESTS to config.h.cmake
Ralf Habacker [Tue, 16 Oct 2018 10:43:16 +0000 (12:43 +0200)] 
Move DBUS_ENABLE_EMBEDDED_TESTS and BUS_ENABLE_MODULAR_TESTS  to config.h.cmake

Bug: https://gitlab.freedesktop.org/dbus/dbus/issues/117
Reviewed-by: Simon McVittie <smcv@collabora.com>
7 years agoKeep macro values in config.h.cmake synchronized with Autotools
Ralf Habacker [Tue, 16 Oct 2018 10:21:55 +0000 (12:21 +0200)] 
Keep macro values in config.h.cmake synchronized with Autotools

Autotools sets the value of HAVE_xxx macros in config.h to 1 if
the corresponding value exists. This has not been used consistently
in config.h.cmake so far.

Bug: https://gitlab.freedesktop.org/dbus/dbus/issues/117
Reviewed-by: Simon McVittie <smcv@collabora.com>
7 years agoconfigure.ac: Remove unused HAVE_V*PRINTF macros
Ralf Habacker [Tue, 16 Oct 2018 10:42:45 +0000 (12:42 +0200)] 
configure.ac: Remove unused HAVE_V*PRINTF macros

The corresponding functions are used unconditionally.

Reviewed-by: Simon McVittie <smcv@collabora.com>
7 years agoMerge branch 'desktop-sections' into 'master'
Simon McVittie [Fri, 19 Oct 2018 11:26:31 +0000 (11:26 +0000)] 
Merge branch 'desktop-sections' into 'master'

Parse desktop file section names more like the Desktop Entry specification

Closes #208

See merge request dbus/dbus!17

Reviewed-by: David King (@amigadave)
7 years agodesktop-file: Treat backslashes in section names as literal
Simon McVittie [Thu, 18 Oct 2018 16:36:37 +0000 (17:36 +0100)] 
desktop-file: Treat backslashes in section names as literal

The Desktop Entry Specification doesn't give any special meaning to
backslashes in section names: a line "[\n]" starts a section whose
name is the two characters (backslash, n), not a section whose name
is a newline. GKeyFile in GLib matches this interpretation.

In practice, the only section used by dbus-daemon is "D-BUS Service",
only way this could make a difference is if someone had written it
as "D-BUS\sService". According to
https://codesearch.debian.net/search?q=%5C%5BD-BUS%5C%5CsService%5C%5D
there is no instance of that pattern in Debian.

Signed-off-by: Simon McVittie <smcv@collabora.com>
7 years agodesktop-file: Justify implementation of is_valid_section_name()
Simon McVittie [Thu, 18 Oct 2018 14:34:09 +0000 (15:34 +0100)] 
desktop-file: Justify implementation of is_valid_section_name()

Signed-off-by: Simon McVittie <smcv@collabora.com>
7 years agodesktop-file test: Add to CMake build
Simon McVittie [Thu, 18 Oct 2018 13:00:06 +0000 (14:00 +0100)] 
desktop-file test: Add to CMake build

Signed-off-by: Simon McVittie <smcv@collabora.com>
7 years agodesktop-file test: Expand coverage to include more corner-cases
Simon McVittie [Thu, 18 Oct 2018 12:57:13 +0000 (13:57 +0100)] 
desktop-file test: Expand coverage to include more corner-cases

Signed-off-by: Simon McVittie <smcv@collabora.com>