Bug 92028 - Autolaunch support broken on windows
Summary: Autolaunch support broken on windows
Status: RESOLVED FIXED
Alias: None
Product: dbus
Classification: Unclassified
Component: core (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: D-Bus Maintainers
QA Contact: D-Bus Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-09-17 00:14 UTC by Ralf Habacker
Modified: 2015-11-06 14:58 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Make Windows dbus-daemon look for the config file we install (4.27 KB, patch)
2015-09-17 14:44 UTC, Simon McVittie
Details | Splinter Review
Add a DBusString-based version of _dbus_replace_install_prefix (4.43 KB, patch)
2015-09-18 15:36 UTC, Simon McVittie
Details | Splinter Review
Replace build-time prefix with installation prefix to include config files (1.12 KB, patch)
2015-09-18 15:37 UTC, Simon McVittie
Details | Splinter Review
On Windows, load local configuration relative to bus setup (6.89 KB, patch)
2015-09-30 16:06 UTC, Simon McVittie
Details | Splinter Review
Replace build-time prefix with installation prefix when including config files (1.19 KB, patch)
2015-10-01 12:14 UTC, Simon McVittie
Details | Splinter Review
On Windows, load local configuration relative to bus setup (8.13 KB, patch)
2015-10-01 18:19 UTC, Simon McVittie
Details | Splinter Review

Description Ralf Habacker 2015-09-17 00:14:24 UTC
I recently tried to build dbus from the dbus-1.10 branch with cmake and run dbus-daemon.exe --session, which fails with the message

Failed to start message bus: Address 'autolaunch' already used

After a switch to dbus-1.8 branch, followed by a recompile, a run with the same command line does not fail.

dbus verbose prints out the lines below, which may give a hint about the root cause. What I can see is that:

First the daemon checks if the bus address is published [1]. After publishing the bus address [2], the daemon asks if the bus address is published [3], which is true and is interpreted as error condition.

It looks that something in the daemon initialization logic has been changed.
  
8: [dbus/dbus-memory.c(262):_dbus_decrement_fail_alloc_counter] TODO: memory allocation testing errors disabled for now
8: [dbus/dbus-dataslot.c(135):_dbus_data_slot_allocator_alloc] Allocated slot 0 on allocator 6DBE4338 total 1 slots allocated 1 used
8: [dbus/dbus-socket-set-poll.c(98):_dbus_socket_set_poll_new] new socket set at 00241590
8: [dbus/dbus-file-win.c(134):_dbus_file_get_contents] file S:\xxxx\src\dbus-1-cmake-cross-x86-build\bus\session.conf hnd 00000088 opened
8: [bus/config-parser.c(2647):bus_config_parser_content] Loaded value 1000000000 for limit max_incoming_bytes
8: [bus/config-parser.c(2647):bus_config_parser_content] Loaded value 250000000 for limit max_incoming_unix_fds
8: [bus/config-parser.c(2647):bus_config_parser_content] Loaded value 1000000000 for limit max_outgoing_bytes
8: [bus/config-parser.c(2647):bus_config_parser_content] Loaded value 250000000 for limit max_outgoing_unix_fds
8: [bus/config-parser.c(2647):bus_config_parser_content] Loaded value 1000000000 for limit max_message_size
8: [bus/config-parser.c(2647):bus_config_parser_content] Loaded value 120000 for limit service_start_timeout
8: [bus/config-parser.c(2647):bus_config_parser_content] Loaded value 240000 for limit auth_timeout
8: [bus/config-parser.c(2647):bus_config_parser_content] Loaded value 150000 for limit pending_fd_timeout
8: [bus/config-parser.c(2647):bus_config_parser_content] Loaded value 100000 for limit max_completed_connections
8: [bus/config-parser.c(2647):bus_config_parser_content] Loaded value 10000 for limit max_incomplete_connections
8: [bus/config-parser.c(2647):bus_config_parser_content] Loaded value 100000 for limit max_connections_per_user
8: [bus/config-parser.c(2647):bus_config_parser_content] Loaded value 10000 for limit max_pending_service_starts
8: [bus/config-parser.c(2647):bus_config_parser_content] Loaded value 50000 for limit max_names_per_connection
8: [bus/config-parser.c(2647):bus_config_parser_content] Loaded value 50000 for limit max_match_rules_per_connectio
8: [bus/config-parser.c(2647):bus_config_parser_content] Loaded value 50000 for limit max_replies_per_connection
8: [bus/config-parser.c(2647):bus_config_parser_content] Loaded value 1000000000 for limit max_incoming_bytes
8: [bus/config-parser.c(2647):bus_config_parser_content] Loaded value 250000000 for limit max_incoming_unix_fds
8: [bus/config-parser.c(2647):bus_config_parser_content] Loaded value 1000000000 for limit max_outgoing_bytes
8: [bus/config-parser.c(2647):bus_config_parser_content] Loaded value 250000000 for limit max_outgoing_unix_fds
8: [bus/config-parser.c(2647):bus_config_parser_content] Loaded value 1000000000 for limit max_message_size
8: [bus/config-parser.c(2647):bus_config_parser_content] Loaded value 120000 for limit service_start_timeout
8: [bus/config-parser.c(2647):bus_config_parser_content] Loaded value 240000 for limit auth_timeout
8: [bus/config-parser.c(2647):bus_config_parser_content] Loaded value 150000 for limit pending_fd_timeout
8: [bus/config-parser.c(2647):bus_config_parser_content] Loaded value 100000 for limit max_completed_connections
8: [bus/config-parser.c(2647):bus_config_parser_content] Loaded value 10000 for limit max_incomplete_connections
8: [bus/config-parser.c(2647):bus_config_parser_content] Loaded value 100000 for limit max_connections_per_user
8: [bus/config-parser.c(2647):bus_config_parser_content] Loaded value 10000 for limit max_pending_service_starts
8: [bus/config-parser.c(2647):bus_config_parser_content] Loaded value 50000 for limit max_names_per_connection
8: [bus/config-parser.c(2647):bus_config_parser_content] Loaded value 50000 for limit max_match_rules_per_connection
8: [bus/config-parser.c(2647):bus_config_parser_content] Loaded value 50000 for limit max_replies_per_connection
8: [dbus/dbus-sysdeps-win.c(1029):_dbus_getsid] _dbus_getsid() got 'S-1-5-21-0-0-0-1000' and returns 1
[1] 8: [dbus/dbus-sysdeps-win.c(2893):_dbus_daemon_is_session_bus_address_published] scope 
8: [dbus/dbus-server.c(165):_dbus_server_init_base] Initialized server on address tcp:host=localhost,port=51841,family=ipv4,guid=9c02e5e919e9b2c38a69520755fa030c
[2] 8: [dbus/dbus-sysdeps-win.c(2990):_dbus_daemon_publish_session_bus_address] published session bus address at DBusDaemonAddressInfo
8: [dbus/dbus-watch.c(318):_dbus_watch_list_set_functions] Adding a read watch on fd 136 using newly-set add watch function
8: [dbus/dbus-socket-set-poll.c(146):socket_set_poll_add] before adding fd 136 to 00241590, 0 en/0 res/1 alloc
[3]8: [dbus/dbus-sysdeps-win.c(2893):_dbus_daemon_is_session_bus_address_published] scope 
8: [bus/bus.c(1099):bus_context_unref] Finalizing bus context 00241400
8: [dbus/dbus-watch.c(354):_dbus_watch_list_set_functions] Removing all pre-existing watches
8: [dbus/dbus-socket-set-poll.c(221):socket_set_poll_remove] after removing fd 136 from 00241590, 0 en/0 res/1 alloc
8: [dbus/dbus-watch.c(686):dbus_watch_set_data] Setting watch fd 4294967295 data to data = 00000000 function = 00000000 from data = 00000000 function = 00000000
8: [dbus/dbus-sysdeps-win.c(510):_dbus_close_socket] _dbus_close_socket: socket=136, 
8: [dbus/dbus-socket-set-poll.c(68):socket_set_poll_free] freed socket set 00241590
8: [dbus/dbus-dataslot.c(175):_dbus_data_slot_allocator_free] Freeing slot 0 on allocator 6DBE4338 total 1 allocated 1 used
Failed to start message bus: Address 'autolaunch' already used
Comment 1 Simon McVittie 2015-09-17 13:53:40 UTC
> 8: [dbus/dbus-file-win.c(134):_dbus_file_get_contents] file S:\xxxx\src\dbus-1-cmake-cross-x86-build\bus\session.conf hnd 00000088 opened

dbus-daemon.exe --session should not be reading a file from the build directory. On Unix, dbus-daemon --session *always* uses its installation directory (${datadir}/dbus-1), and we use environment variables or --config-file if we want to substitute files in the build directory (for example see installcheck_environment in test/Makefile.am).

It's fine for dbus-daemon.exe --session to autodetect its ${prefix} using _dbus_get_install_root() if that makes your life easier on Windows, but it shouldn't really autodetect "I am in the build directory" and change its configuration for that, because being in the build directory is a significant semantic change.

The reason you're getting this error is that dbus-daemon is seeing two instances of <listen>autolaunch:</code>: one from bus/session.conf, and one from the old ${sysconfdir}/dbus-1/session.conf from a version < 1.9.18 (which is <include>'d by bus/session.conf). ${sysconfdir}/dbus-1/session.conf would be overwritten with one that does not include <listen> when you do "make install", but it looks as though you haven't actually installed dbus-daemon and are running it uninstalled, with configuration that refers to a previously installed ${sysconfdir}.

On closer inspection, _dbus_get_config_file_name() also needs updating for 1.10, because it hard-codes "etc\\". This was in fact always wrong if someone used a non-default ${sysconfdir}; but in 1.10 it will fail all the time, because the bus setup is installed to ${datadir} (Autotools) or share/dbus-1 (CMake).
Comment 2 Simon McVittie 2015-09-17 14:44:09 UTC
Created attachment 118326 [details] [review]
Make Windows dbus-daemon look for the config file we install

The canonical location for bus setup changed from
${sysconfdir}/dbus-1 to ${datadir}/dbus-1 (or their CMake
equivalents) in version 1.9.18.

Also stop trying to use bus/session.conf from the build tree,
which will not work if our ${prefix} contains an older
${sysconfdir}/dbus-1/session.conf.

---

Please try this patch (cross-compiles successfully; untested).

You will need to "make install" into some suitable prefix.

I think this would be OK for 1.10.
Comment 3 Ralf Habacker 2015-09-17 15:54:32 UTC
(In reply to Simon McVittie from comment #1)
> > 8: [dbus/dbus-file-win.c(134):_dbus_file_get_contents] file S:\xxxx\src\dbus-1-cmake-cross-x86-build\bus\session.conf hnd 00000088 opened
> 
> dbus-daemon.exe --session should not be reading a file from the build
> directory. On Unix, dbus-daemon --session *always* uses its installation
> directory (${datadir}/dbus-1), and we use environment variables or
> --config-file if we want to substitute files in the build directory (for
> example see installcheck_environment in test/Makefile.am).

dbus-launch.exe always uses --session to run the daemon, which means there will be no way to run it with a session.conf from a build dir :-(
 
> It's fine for dbus-daemon.exe --session to autodetect its ${prefix} using
> _dbus_get_install_root() if that makes your life easier on Windows, but it
> shouldn't really autodetect "I am in the build directory" and change its
> configuration for that, because being in the build directory is a
> significant semantic change.

dbus_get_install_root() running from a build root on windows will return the directory where libdbus-1.3.dll lives, which is <build-root>/dbus with autotools and <build-root> with cmake. For the latter creating the *.conf file and related dir into <build-dir>/share/dbus-1 will let --session mode work again.
Comment 4 Simon McVittie 2015-09-17 16:47:52 UTC
(In reply to Ralf Habacker from comment #3)
> dbus-launch.exe always uses --session to run the daemon, which means there
> will be no way to run it with a session.conf from a build dir :-(

Don't use dbus-launch.exe to run uninstalled binaries, then?

dbus-launch on Unix uses --session too, unless you specifically pass a --config-file argument to it. To debug an uninstalled dbus-daemon on Unix, we'd normally run that uninstalled dbus-daemon directly, with either --session or --config-file, and without using dbus-launch.

> dbus_get_install_root() running from a build root on windows will return the
> directory where libdbus-1.3.dll lives, which is <build-root>/dbus with
> autotools and <build-root> with cmake. For the latter creating the *.conf
> file and related dir into <build-dir>/share/dbus-1 will let --session mode
> work again.

D-Bus is not (primarily) designed to be run from a build directory; it is designed to be run after installation. If it happens to work from a build directory some of the time, that isn't actively harmful, but I don't think we should introduce more complexity to support it either.

If you do copy session.conf into ${builddir}/share/dbus-1, then it will still say "<include ignore_missing="yes">/myprefix/etc/dbus-1/session.conf</include>"; and if /myprefix still includes the session.conf from an older version of D-Bus, then it will still see two <listen>autolaunch:</listen> directives, and it will still fail in this way.

The solution is to not mix the configuration of a newly built dbus with the configuration of an older dbus. Move the old one out of the way (if you want to keep it), "make install" (overwriting the old session.conf if you didn't already move it out of the way), *then* test the new one.
Comment 5 Ralf Habacker 2015-09-18 08:37:56 UTC
(In reply to Simon McVittie from comment #4)

> If you do copy session.conf into ${builddir}/share/dbus-1, then it will
> still say "<include
> ignore_missing="yes">/myprefix/etc/dbus-1/session.conf</include>"; 

This and similar absolute pathes does not work on windows, because the installation prefix is not known on configure/build time.

It should be 

> ignore_missing="yes">etc/dbus-1/session.conf</include>"; 

and relative to the path returned by dbus_get_install_root().
Comment 6 Simon McVittie 2015-09-18 11:49:22 UTC
(In reply to Ralf Habacker from comment #5)
> This and similar absolute pathes does not work on windows, because the
> installation prefix is not known on configure/build time.

If necessary we can make it

<include ignore_missing="yes">@configinclude@/session.conf</include>

and subst different values of @configinclude@ for Unix and Windows? Would that solve this for you?
Comment 7 Simon McVittie 2015-09-18 14:17:22 UTC
(In reply to Ralf Habacker from comment #5)
> It should be 
> 
> > ignore_missing="yes">etc/dbus-1/session.conf</include>"; 
> 
> and relative to the path returned by dbus_get_install_root().

That can't work, because relative paths already mean something (they are relative to the directory in which the config file was found).

Relocating absolute paths through _dbus_replace_install_prefix() would be OK.
Comment 8 Ralf Habacker 2015-09-18 14:34:05 UTC
(In reply to Simon McVittie from comment #7)
> (In reply to Ralf Habacker from comment #5)
> > It should be 
> > 
> > > ignore_missing="yes">etc/dbus-1/session.conf</include>"; 
> > 
> > and relative to the path returned by dbus_get_install_root().
> 
> That can't work, because relative paths already mean something (they are
> relative to the directory in which the config file was found).

Indeed, a reference to relative path session.d from share/dbus-1/session.conf relates to share/dbus-1/session.d, which is used in all dbus versions.

The above mentioned line in share/dbus-1/session.conf should be 
<include ignore_missing="yes">../../etc/dbus-1/session.conf</include>"; 

Thanks for clarification. :-)
Comment 9 Ralf Habacker 2015-09-18 14:34:55 UTC
(In reply to Simon McVittie from comment #6)
> (In reply to Ralf Habacker from comment #5)
> > This and similar absolute pathes does not work on windows, because the
> > installation prefix is not known on configure/build time.
> 
> If necessary we can make it
> 
> <include ignore_missing="yes">@configinclude@/session.conf</include>
> 
> and subst different values of @configinclude@ for Unix and Windows? Would
> that solve this for you?

yes
Comment 10 Simon McVittie 2015-09-18 15:16:30 UTC
(In reply to Ralf Habacker from comment #8)
> The above mentioned line in share/dbus-1/session.conf should be 
> <include ignore_missing="yes">../../etc/dbus-1/session.conf</include>"; 

I would really rather not write ../.. sequences into the configuration files.

I think using _dbus_replace_install_prefix() should work, assuming <https://bugs.freedesktop.org/show_bug.cgi?id=83539#c32> can be fixed up and applied.
Comment 11 Simon McVittie 2015-09-18 15:36:15 UTC
Created attachment 118347 [details] [review]
Add a DBusString-based version of  _dbus_replace_install_prefix

For the moment, this is just a wrapper around the version that uses
static string buffers, but in the development branch it should be
rewritten to use DBusString throughout.

---

Compiles; untested. Please review and test.

The intended result is that if you configure for prefix /CONF, install to C:/RUN and run, then the config file will say <include>/CONF/etc/dbus-1/session.conf</include>, but we will actually load C:/RUN/etc/dbus-1/session.conf instead.

If you insist on supporting running-from-built-tree, you might also need some CMake build-system changes to copy configuration files where the dbus-daemon will expect them.

<https://bugs.freedesktop.org/show_bug.cgi?id=83539#c33> is probably also necessary to make this actually useful.
Comment 12 Simon McVittie 2015-09-18 15:37:01 UTC
Created attachment 118348 [details] [review]
Replace build-time prefix with installation prefix to  include config files

---

See previous comment for test instructions. All three patches from this bug will be needed, and probably the one from Bug #83539 as well.
Comment 13 Ralf Habacker 2015-09-18 16:13:52 UTC
(In reply to Simon McVittie from comment #10)
> (In reply to Ralf Habacker from comment #8)
> > The above mentioned line in share/dbus-1/session.conf should be 
> > <include ignore_missing="yes">../../etc/dbus-1/session.conf</include>"; 
> 
> I would really rather not write ../.. sequences into the configuration files.
> 
> I think using _dbus_replace_install_prefix() should work, assuming
> <https://bugs.freedesktop.org/show_bug.cgi?id=83539#c32> can be fixed up and
> applied.

I do not agree. Consider the following example from a cross compile dbus installation bundled with a KDE application on Windows as done for umbrello https://build.opensuse.org/package/show?project=windows%3Amingw%3Awin32&package=mingw32-umbrello-installer

There is c:\Program Files (x86)\umbrello\share\dbus-1/session.conf

 <include ignore_missing="yes">/usr/i686-w64-mingw32/sys-root/mingw/etc/dbus-1/session.conf</include>"; 

Having a full installation path coming from the build system in a configuration file which has nothing to do with the real installation path and is somehow magically converted to a real path looks ugly and would increase people complaining about invalid pathes in configuration files. 

Instead 

 <include ignore_missing="yes">../../etc/dbus-1/session.conf</include>"; 

this is full transparant and easily to follow: "from this directory go two dirs up and down to etc/dbus-1" 

Also using relative pathes in such use cases is a common pattern used several linux and mingw32 packages like docbook https://build.opensuse.org/package/show/windows:mingw:win32/mingw32-docbook_4 (see for variable rel_xml_docbook_dtd_dir)
Comment 14 Simon McVittie 2015-09-18 17:27:44 UTC
(In reply to Ralf Habacker from comment #13)
>  <include ignore_missing="yes">../../etc/dbus-1/session.conf</include>"; 
> 
> this is full transparant and easily to follow: "from this directory go two
> dirs up and down to etc/dbus-1"

If you insist.

I'm really not keen on playing "count the ../.." on Unix (and replacing directories with symbolic links can break the expected ../.. resolution in some circumstances), so if you implement a build-system patch to do this, I would strongly prefer it to be Windows-specific. Both our build systems can do OS conditionals, though, so that should be straightforward.

It looks as though redefining DBUS_SYSCONFDIR should be sufficient, either on Windows with both build systems, or just on Windows with CMake (depending which one you care about). That variable isn't currently used for anything else.

It would probably be good to rename it to RELATIVE_SYSCONFDIR with a comment about "on Windows this is relative to the bus setup in /usr/share/dbus-1 to allow relocation", so that its purpose is clear.
Comment 15 Simon McVittie 2015-09-18 17:30:39 UTC
(In reply to Simon McVittie from comment #11)
> Add a DBusString-based version of  _dbus_replace_install_prefix

Even if you don't want Attachment #118348 [details] for config files, this change is also relevant to the existing support for relocatable service files, and getting rid of buffer-overflow-prone strcat() from the Windows support code (see Bug #83539 for more on that).
Comment 16 Ralf Habacker 2015-09-20 11:50:00 UTC
Comment on attachment 118326 [details] [review]
Make Windows dbus-daemon look for the config file we install

looks good

Applied to dbus-1.10
Comment 17 Ralf Habacker 2015-09-20 15:43:30 UTC
I did run manual-paths with remaining patches applied and got:

cmake: 
dbus_get_install_root() returned 'S:\xxx\src\dbus-cmake-cross-x86-build\'
default service dir: S:\xxx\src\dbus-cmake-cross-x86-build\shareshare/dbus-1/services
default service dir: C:\Program Files\Common Files/dbus-1/services
replaced 'bin/dbus-daemon' by 'sharesharebin/dbus-daemonbin/dbus-daemon'
replaced 'c:\Windows\System32\testfile' by 'sharesharebin/dbus-daemonbin/dbus-daemonc:\Windows\System32\testfilec:\Windows\System32\testfile'

autotools
dbus_get_install_root() returned 'S:\xxx\src\dbus-autotools-cross-build\dbus\.libs\'
default service dir: S:/x/src/dbus-autotools-cross-build/dbus/.libs/share/dbus-1/services
default service dir: C:\Program Files\Common Files/dbus-1/services
replaced '/bin/dbus-daemon' by 'S:/xxx/src/dbus-autotools-cross-build/dbus/.libs/bin/dbus-daemon'
replaced 'c:\Windows\System32\testfile' by 'S:/xxx/src/dbus-autotools-cross-build/dbus/.libs/bin/dbus-daemonc:\Windows\System32\testfilec:\Windows\System32\testfile'
Comment 18 Simon McVittie 2015-09-21 10:11:35 UTC
Please test this sort of thing from an installed tree, instead of or as well as from within the build tree; I think that's the more important thing to have working.

I'd suggest something like this:

* build in S:\xxx\src\dbus-cmake-cross-x86-build
* configure with --prefix=/prefix or the CMake equivalent
* install in C:\dbus-install or something

so that you can easily distinguish between configure-time paths (which will start with /prefix) and runtime-discovered paths (C:/dbus-install).

(In reply to Ralf Habacker from comment #17)
> S:\xxx\src\dbus-cmake-cross-x86-build\shareshare/dbus-1/services

What were you expecting? S:\xxx\src\dbus-cmake-cross-x86-build\share/dbus-1/services?

> default service dir: C:\Program Files\Common Files/dbus-1/services

Looks valid, apart from possibly some / <-> \ confusion?

> replaced 'bin/dbus-daemon' by 'sharesharebin/dbus-daemonbin/dbus-daemon'

What is the expected result here?

> replaced 'c:\Windows\System32\testfile' by
> 'sharesharebin/dbus-daemonbin/dbus-daemonc:\Windows\System32\testfilec:
> \Windows\System32\testfile'

This looks like incorrect use of strcat() where we intended strcpy() (Bug #83539). Did you apply Attachment #118346 [details]?

> replaced 'c:\Windows\System32\testfile' by
> 'S:/xxx/src/dbus-autotools-cross-build/dbus/.libs/bin/dbus-daemonc:
> \Windows\System32\testfilec:\Windows\System32\testfile'

This also looks like it needs Attachment #118346 [details].
Comment 19 Ralf Habacker 2015-09-21 11:11:47 UTC
(In reply to Simon McVittie from comment #18)
> Please test this sort of thing from an installed tree, instead of or as well
> as from within the build tree; I think that's the more important thing to
> have working.
> 
> I'd suggest something like this:
> 
> * build in S:\xxx\src\dbus-cmake-cross-x86-build
> * configure with --prefix=/prefix or the CMake equivalent
> * install in C:\dbus-install or something
see below
 
> This also looks like it needs Attachment #118346 [details].

applied additional this patch and got: 


running manual-paths cmake build on native host -> looks okay
bus_get_install_root() returned 'S:\dbus-install-cmake\usr\i686-w64-mingw32\sys-root\mingw\'looks
default service dir: S:/dbus-install-cmake/usr/i686-w64-mingw32/sys-root/mingw/share/dbus-1/services
default service dir: C:\Program Files\Common Files/dbus-1/services
replaced '/usr/i686-w64-mingw32/sys-root/mingw/bin/dbus-daemon' by 'S:/dbus-install-cmake/usr/i686-w64-mingw32/sys-root/mingw/bin/dbus-daemon'
replaced 'c:\Windows\System32\testfile' by 'c:/Windows/System32/testfile'

running manual-paths cmake build running with wine -> looks okay
bus_get_install_root() returned 's:\dbus-install-cmake\usr\i686-w64-mingw32\sys-root\mingw\'
default service dir: s:/dbus-install-cmake/usr/i686-w64-mingw32/sys-root/mingw/share/dbus-1/services
default service dir: C:\Program Files\Common Files/dbus-1/services
replaced '/usr/i686-w64-mingw32/sys-root/mingw/bin/dbus-daemon' by 's:/dbus-install-cmake/usr/i686-w64-mingw32/sys-root/mingw/bin/dbus-daemon'
replaced 'c:\Windows\System32\testfile' by 'c:/Windows/System32/testfile'

running manual-paths cmake build running with wine into build root -> looks okay
dbus_get_install_root() returned 'Z:\home\xxxx\src\dbus-master-cmake-cross-build\'
default service dir: Z:/home/xxxx/src/dbus-master-cmake-cross-build/share/dbus-1/services
default service dir: C:\Program Files\Common Files/dbus-1/services
replaced '/usr/i686-w64-mingw32/sys-root/mingw/bin/dbus-daemon' by 'Z:/home/xxxx/src/dbus-master-cmake-cross-build/bin/dbus-daemon'
replaced 'c:\Windows\System32\testfile' by 'c:/Windows/System32/testfile'


compiling tests with autotools seems to be broken:
./dbus/configure --cache-file=mingw32-config.cache --host=i686-w64-mingw32 --build=x86_64-suse-linux-gnu --target=i686-w64-mingw32 --prefix=/usr/i686-w64-mingw32/sys-root/mingw --exec-prefix=/usr/i686-w64-mingw32/sys-root/mingw --bindir=/usr/i686-w64-mingw32/sys-root/mingw/bin --sbindir=/usr/i686-w64-mingw32/sys-root/mingw/sbin --sysconfdir=/usr/i686-w64-mingw32/sys-root/mingw/etc --datadir=/usr/i686-w64-mingw32/sys-root/mingw/share --includedir=/usr/i686-w64-mingw32/sys-root/mingw/include --libdir=/usr/i686-w64-mingw32/sys-root/mingw/lib --libexecdir=/usr/i686-w64-mingw32/sys-root/mingw/libexec --localstatedir=/usr/i686-w64-mingw32/sys-root/mingw/var --sharedstatedir=/usr/i686-w64-mingw32/sys-root/mingw/com --mandir=/usr/i686-w64-mingw32/sys-root/mingw/share/man --infodir=/usr/i686-w64-mingw32/sys-root/mingw/share/info --enable-maintainer-mode --disable-static --enable-verbose-mode --enable-tests --enable-embedded-tests --enable-checks --enable-asserts --disable-xml-docs --disable-doxygen-docs
...
make 
CC       test-utils-glib.lo
../../dbus-master/test/test-utils-glib.c: In function 'test_kill_pid':
../../dbus-master/test/test-utils-glib.c:396:11: warning: comparison between pointer and integer
   if (pid != NULL)
           ^
../../dbus-master/test/test-utils-glib.c:397:23: warning: passing argument 1 of 'TerminateProcess' makes pointer from integer without a cast [-Wint-conversion]
     TerminateProcess (pid, 1);
                       ^
In file included from /home/sysroot-mingw/include/winbase.h:29:0,
                 from /home/sysroot-mingw/include/windows.h:70,
                 from /home/sysroot-mingw/include/winsock2.h:23,
                 from /home/sysroot-mingw/include/ws2tcpip.h:17,
                 from ../../dbus-master/dbus/dbus-sysdeps.h:66,
                 from ../../dbus-master/dbus/dbus-internals.h:33,
                 from ../../dbus-master/test/test-utils.h:10,
                 from ../../dbus-master/test/test-utils-glib.h:34,
                 from ../../dbus-master/test/test-utils-glib.c:28:
/home/sysroot-mingw/include/processthreadsapi.h:81:29: note: expected 'HANDLE {aka void *}' but argument is of type 'GPid {aka int}'
   WINBASEAPI WINBOOL WINAPI TerminateProcess (HANDLE hProcess, UINT uExitCode);
                             ^
../../dbus-master/test/test-utils-glib.c: In function 'test_init':
../../dbus-master/test/test-utils-glib.c:434:3: warning: implicit declaration of function 'alarm' [-Wimplicit-function-declaration]
   alarm (TIMEOUT + 10);
   ^
../../dbus-master/test/test-utils-glib.c:434:3: warning: nested extern declaration of 'alarm' [-Wnested-externs]
../../dbus-master/test/test-utils-glib.c:438:14: error: variable 'act' has initializer but incomplete type
       struct sigaction act = { };
              ^
../../dbus-master/test/test-utils-glib.c:438:24: error: storage size of 'act' isn't known
       struct sigaction act = { };
                        ^
../../dbus-master/test/test-utils-glib.c:442:7: warning: implicit declaration of function 'sigaction' [-Wimplicit-function-declaration]
       sigaction (SIGALRM, &act, NULL);
       ^
../../dbus-master/test/test-utils-glib.c:442:7: warning: nested extern declaration of 'sigaction' [-Wnested-externs]
../../dbus-master/test/test-utils-glib.c:442:18: error: 'SIGALRM' undeclared (first use in this function)
       sigaction (SIGALRM, &act, NULL);
                  ^
../../dbus-master/test/test-utils-glib.c:442:18: note: each undeclared identifier is reported only once for each function it appears in
../../dbus-master/test/test-utils-glib.c:438:24: warning: unused variable 'act' [-Wunused-variable]
       struct sigaction act = { };
                        ^
Comment 20 Simon McVittie 2015-09-21 13:07:55 UTC
(In reply to Ralf Habacker from comment #19)
> ../../dbus-master/test/test-utils-glib.c:434:3: warning: implicit
> declaration of function 'alarm' [-Wimplicit-function-declaration]
>    alarm (TIMEOUT + 10);

Opening a separate bug for this stuff, it seems unrelated. The short version is that you're probably building against the wrong GLib.
Comment 21 Simon McVittie 2015-09-21 13:14:42 UTC
(In reply to Simon McVittie from comment #20)
> Opening a separate bug for this stuff, it seems unrelated.

Bug #92065
Comment 22 Simon McVittie 2015-09-21 13:17:07 UTC
(In reply to Ralf Habacker from comment #17)
> I did run manual-paths with remaining patches applied and got...

If you are pasting results from a manual test, please say what you expected to see - I don't always know what a Windows developer would expect.
Comment 23 Simon McVittie 2015-09-30 15:39:22 UTC
Comment on attachment 118347 [details] [review]
Add a DBusString-based version of  _dbus_replace_install_prefix

Obsoleted by Attachment #118540 [details] on Bug #83539
Comment 24 Simon McVittie 2015-09-30 15:40:05 UTC
Comment on attachment 118348 [details] [review]
Replace build-time prefix with installation prefix to  include config files

This now depends on Attachment #118540 [details] from Bug #83539.
Comment 25 Simon McVittie 2015-09-30 16:06:43 UTC
Created attachment 118543 [details] [review]
On Windows, load local configuration relative to bus setup

This makes an installed tree with

    /some-prefix/
        etc/
            dbus-1/
                session-local.conf
        share/
            dbus-1/
                session.conf

relocatable to any location.

---

Alternative to Attachment #118348 [details]; or we could have both.

I don't intend to write code to count the right number of ../ to support arbitrary combinations of ${datadir} and ${sysconfdir}.
Comment 26 Ralf Habacker 2015-10-01 09:58:23 UTC
I applied all 3 patches to dbus-1.10 branch and got 

[  418s] /home/abuild/rpmbuild/BUILD/dbus-1.10.2e599ffd/bus/config-parser.c:2137: undefined reference to `_dbus_replace_install_prefix_str'

see https://build.opensuse.org/package/live_build_log/home:rhabacker:branches:windows:mingw:win32:personal/mingw32-dbus-1/openSUSE_13.2/x86_64 for a full log.
Comment 27 Simon McVittie 2015-10-01 12:14:24 UTC
Created attachment 118558 [details] [review]
Replace build-time prefix with installation prefix when  including config files

This was already done for the contents of .service files, but not
config files.

---

(In reply to Ralf Habacker from comment #26)
> /home/abuild/rpmbuild/BUILD/dbus-1.10.2e599ffd/bus/config-parser.c:2137:
> undefined reference to `_dbus_replace_install_prefix_str'

Sorry, I forgot I'd renamed that function as an API simplification in Attachment #118540 [details]. Here's the necessary update to make this change build.
Comment 28 Ralf Habacker 2015-10-01 13:31:30 UTC
Comment on attachment 118558 [details] [review]
Replace build-time prefix with installation prefix when  including config files

Review of attachment 118558 [details] [review]:
-----------------------------------------------------------------

look good
Comment 29 Ralf Habacker 2015-10-01 13:40:19 UTC
Comment on attachment 118543 [details] [review]
On Windows, load local configuration relative to bus setup

Review of attachment 118543 [details] [review]:
-----------------------------------------------------------------

looks good, except the wrong expanded pathes in bus/legacy-config/session.conf.in

::: bus/legacy-config/session.conf.in
@@ +6,1 @@
>  @DBUS_DATADIR@/dbus-1/session.conf, which should not be edited.

DBUS_DATADIR is still expanded to /usr/i686-w64-mingw32/sys-root/mingw/share. Instead on windows it should be expanded to ../../share/dbus-1

@@ +12,3 @@
>  
>  For upstream or distribution-wide defaults that can be overridden
>  by a local sysadmin, create files matching

after this string the expanded path

/usr/i686-w64-mingw32/sys-root/mingw/share/dbus-1/session.d/*.conf 

is placed in the generated config file. Instead it should be on windows

../../share/dbus-1/session.d/*.conf

::: bus/legacy-config/system.conf.in
@@ +6,1 @@
>  @DBUS_DATADIR@/dbus-1/system.conf, which should not be edited.

see similar issue in bus/legacy-config/session.conf.in

@@ +12,3 @@
>  
>  For upstream or distribution-wide defaults that can be overridden
>  by a local sysadmin, create files matching

dito
Comment 30 Ralf Habacker 2015-10-01 13:46:36 UTC
(In reply to Ralf Habacker from comment #29)
> @@ +6,1 @@
> >  @DBUS_DATADIR@/dbus-1/session.conf, which should not be edited.
> 
> DBUS_DATADIR is still expanded to
> /usr/i686-w64-mingw32/sys-root/mingw/share. Instead on windows it should be
> expanded to

../../share
Comment 31 Simon McVittie 2015-10-01 18:19:11 UTC
Created attachment 118574 [details] [review]
On Windows, load local configuration relative to bus setup

---

Now with DATADIR_FROM_PKGSYSCONFDIR as well as SYSCONFDIR_FROM_PKGDATADIR.
Comment 32 Ralf Habacker 2015-10-01 19:24:29 UTC
Comment on attachment 118574 [details] [review]
On Windows, load local configuration relative to bus setup

Review of attachment 118574 [details] [review]:
-----------------------------------------------------------------

looks good, tested with autotools and cmake.
Comment 33 Simon McVittie 2015-10-02 10:51:26 UTC
(In reply to Ralf Habacker from comment #32)
> On Windows, load local configuration relative to bus setup
> 
> looks good, tested with autotools and cmake.

Thanks. I'm going to apply this one to 1.10...

(In reply to Ralf Habacker from comment #28)
> Replace build-time prefix with installation prefix when  including config
> files

... but this one is too intrusive for a stable branch IMO, so it can go in master.
Comment 34 Simon McVittie 2015-10-02 10:55:07 UTC
(In reply to Simon McVittie from comment #33)
> (In reply to Ralf Habacker from comment #28)
> > Attachment #118558 [details]
> > Replace build-time prefix with installation prefix when  including config
> > files
> 
> ... but this one is too intrusive for a stable branch IMO, so it can go in
> master.

118558 depends on Attachment #118540 [details], which you seem to have tested but not reviewed. Is 118540 OK for merge to master?
Comment 35 Simon McVittie 2015-10-02 15:05:35 UTC
Comment on attachment 118574 [details] [review]
On Windows, load local configuration relative to bus setup

Applied for 1.10.1 and 1.11.0, thanks. Leaving the bug open for the other one.
Comment 36 Simon McVittie 2015-11-06 14:58:43 UTC
Comment on attachment 118558 [details] [review]
Replace build-time prefix with installation prefix when  including config files

I applied this. It will be in 1.11.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.