Bug 27659 - merge gnome windows fixes
Summary: merge gnome windows fixes
Status: RESOLVED FIXED
Alias: None
Product: dbus
Classification: Unclassified
Component: core (show other bugs)
Version: 1.3.x (devel)
Hardware: Other Windows (All)
: medium normal
Assignee: Havoc Pennington
QA Contact: John (J5) Palmieri
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-04-15 00:35 UTC by Ralf Habacker
Modified: 2010-06-12 11:36 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments
patch for de-kde-ification of window dbus (8.89 KB, patch)
2010-04-15 00:36 UTC, Ralf Habacker
Details | Splinter Review
new version of the de-kde-fication :) patch incorporating comments and applying to dbus master (7.40 KB, patch)
2010-04-21 00:59 UTC, Fridrich Strba
Details | Splinter Review
Patch incorporating the latest comments and actually building :) (7.38 KB, patch)
2010-04-21 01:43 UTC, Fridrich Strba
Details | Splinter Review
copy & paste of test result (2.94 KB, text/plain)
2010-04-21 03:24 UTC, Fridrich Strba
Details
Just a little modification so that the function is really walk-through with the DBUS_PREFIX not being defined (1.12 KB, patch)
2010-04-21 03:53 UTC, Fridrich Strba
Details | Splinter Review
result of dbus-test invocation (6.36 KB, text/plain)
2010-04-21 03:57 UTC, Fridrich Strba
Details

Description Ralf Habacker 2010-04-15 00:35:34 UTC
Fridrich Strba provided the appended patch from http://pastebin.ca/1859665 for creating http://download.opensuse.org/repositories/windows:/mingw:/win32/openSUSE_Factory/noarch/

He wrote about the patch: A very ugly and standard non-compliant patch 

This bug is intended for the required refactoring.
Comment 1 Ralf Habacker 2010-04-15 00:36:40 UTC
Created attachment 35052 [details] [review]
patch for de-kde-ification of window dbus
Comment 2 Ralf Habacker 2010-04-15 00:47:08 UTC
Relating to the fix in bus/activation.c 
 
+#ifdef DBUS_WIN
+const char *_dbus_windows_replace_prefix (const char *configure_time_path);
+#endif
+

Because bus/activation is a cross plattform file, would it not be better to define a cross plattform function 

/*
 * replaces the term DBUS_PREFIX in configure_time_path by the 
 * current dbus installation directory. On unix this function is a noop 
 *
 * @param configure_time_path
 * @return real path 
 */
const char *_dbus_replace_install_prefix (const char *configure_time_path);

in dbus-sysdeps-unix.c 

const char *_dbus_replace_install_prefix (const char *configure_time_path);
{
  return configure_time_path;
}

and to call _dbus_replace_install_prefix in bus/activation unconditional ?

+    exec = strdup (_dbus_replace_install_prefix (exec_tmp));
Comment 3 Ralf Habacker 2010-04-15 00:48:06 UTC
is this only a move in the fole or was something changed in this function ? 

+static dbus_bool_t
+_dbus_get_install_root(char *prefix, int len)
Comment 4 Fridrich Strba 2010-04-15 01:29:00 UTC
I moved it just because I needed it to be known  to the replace prefix function, but it is enough just to leave it where it was and forward declare it before the replace prefix function. Just if I recall well the _dbus_get_install_root was in an ifdef-ed block that I was also not sure whether it was actually meant to be in.
Comment 5 Ralf Habacker 2010-04-20 23:16:25 UTC
This patch does not apply on top of master branch 

G:\>git apply "de-kde-ification of window dbus.patch"
error: activation.c: No such file or directory
error: patch failed: dbus/dbus-sysdeps-win.c:2062
error: dbus/dbus-sysdeps-win.c: patch does not apply

Please update and provide as format-patch.
Comment 6 Ralf Habacker 2010-04-20 23:18:06 UTC
Also there should be some documentation about this DBUS_PREFIX features in the dbus-daemon documentation.
Comment 7 Fridrich Strba 2010-04-21 00:14:04 UTC
Ralf: I will work on it, just these weeks I was too busy even to go to toilet :)
Comment 8 Fridrich Strba 2010-04-21 00:59:10 UTC
Created attachment 35197 [details] [review]
new version of the de-kde-fication :) patch incorporating comments and applying to dbus master

A version of the patch working with recent dbus master
Comment 9 Ralf Habacker 2010-04-21 01:18:11 UTC
(In reply to comment #8)
> Created an attachment (id=35197) [details]
> new version of the de-kde-fication :) patch incorporating comments and applying
> to dbus master
> 
> A version of the patch working with recent dbus master

Thanks for this effort - patch applies. 

There are still some issues: 

in bus/activation: 

+/*
+ * replaces the term DBUS_PREFIX in configure_time_path by the
+ * current dbus installation directory. On unix this function is a noop
+ *
+ * @param configure_time_path
+ * @return real path
+ */
+const char *
+_dbus_replace_install_prefix (const char *configure_time_path);
+

this prototype should be in dbus-sysdeps.h 


dbus/dbus-sysdeps-win.c: 

+const char *
+_dbus_windows_replace_prefix (const char *configure_time_path);
+

beside the wrong name this prototyp is obsolate - it is already in dbus-sysdeps.h

+const char *
+_dbus_windows_replace_prefix (const char *configure_time_path)
+{

wrong name - should be dbus_replace_install_prefix()

otherwise looks good.
Comment 10 Fridrich Strba 2010-04-21 01:43:47 UTC
Created attachment 35199 [details] [review]
Patch incorporating the latest comments and actually building :)
Comment 11 Fridrich Strba 2010-04-21 01:44:51 UTC
BTW, if this gets integrated it would be great to prod someone for a new devel release so that one can build on windows from a tarball instead from a custom git checkout (at least in my mingw repositories)
Comment 12 Ralf Habacker 2010-04-21 02:22:27 UTC
patch applies fine and did compile. 

Unfortunally the bus-test config file parser test fails:


bin\bus-test: Running config file parser test
Testing retrieving the default session service directories
    default service dir: data/dbus-1/services
    default service dir: E:\Programme\Gemeinsame Dateien/dbus-1/services
    test service dir: datadata/dbus-1/services
datadata/dbus-1/services directory does not match data/dbus-1/services in the match set

I did run (using cmake) 

cd <dbus-build-root> 
set DBUS_TEST_DATA=%CD%\test\data 
bin\bus-test
Comment 13 Ralf Habacker 2010-04-21 02:25:21 UTC
(In reply to comment #11)
> BTW, if this gets integrated it would be great to prod someone for a new devel
> release so that one can build on windows from a tarball 

we should ask Colin Walter 

> instead from a custom git checkout (at least in my mingw repositories)

you cannot clone dbus freedesktop git master branch ?
Comment 14 Fridrich Strba 2010-04-21 03:17:25 UTC
OK, I just managed to cross-compile using cmake and I get the same error as you do. Do you have any clue where to start to look?
Comment 15 Fridrich Strba 2010-04-21 03:20:20 UTC
OK, with this little change:

--- a/dbus/dbus-sysdeps-win.c
+++ b/dbus/dbus-sysdeps-win.c
@@ -2076,7 +2076,7 @@ _dbus_replace_install_prefix (const char *configure_time_path)
 {
   static char retval[1000];
 #ifndef DBUS_PREFIX
-  strcat (retval, configure_time_path);
+  strcpy (retval, configure_time_path);
 #else
   static char runtime_prefix[1000];
   int len = 1000;

I get the attached result
Comment 16 Fridrich Strba 2010-04-21 03:24:05 UTC
Created attachment 35201 [details]
copy & paste of test result
Comment 17 Ralf Habacker 2010-04-21 03:45:17 UTC
(In reply to comment #15)
> OK, with this little change:
> 
fine - works as expected. I applied the original patch and this fix to master branch. 

It would be nice if you would add an explanation of this feature to dbus-specification.xml section id="message-bus-starting-services".
Comment 18 Fridrich Strba 2010-04-21 03:53:28 UTC
Created attachment 35203 [details] [review]
Just a little modification so that the function is really walk-through with the DBUS_PREFIX not being defined
Comment 19 Fridrich Strba 2010-04-21 03:56:05 UTC
Ralf: I modified the stuff a little tiny bit so that it does not allocate the 1000 bytes on the stack if not needed. 
I came with a way how to run the tests actually, just using "subst" I create a drive that maps exactly the unix system where I built on vmware :) so things like /usr/i686-pc-mingw32 will be Y:\usr\i686-pc-mingw32.

Like that I was able to run the tests with the attached results.
Comment 20 Fridrich Strba 2010-04-21 03:57:00 UTC
Created attachment 35205 [details]
result of dbus-test invocation
Comment 21 Ralf Habacker 2010-04-21 04:08:37 UTC
(In reply to comment #20)
> Created an attachment (id=35205) [details]
> result of dbus-test invocation

nice - just one note: you need bus-test to test the implementation of this feature. 

Would it be good to have a unit test for this in the test suite ? 
Maybe by providing a litte service file, which is parsed by the related service file parse function and compared if DBUS_PRIFOX is replaced with the correct value ?
Comment 22 Fridrich Strba 2010-04-21 05:49:26 UTC
Ralf: I am just wondering, that file dbus-sysdeps-win.c has quite a number of functions there in ifdefed blocks and if I cross-compile using a normal stock configure options (only setting the host and paths). I get linking errors:
  CCLD   libdbus-1.la
Creating library file: .libs/libdbus-1.dll.a
.libs/libdbus_1_la-dbus-connection.o: In function `_dbus_message_filter_unref':
/home/fstrba/devel-cvs/dbus/dbus/dbus-connection.c:344: undefined reference to `__dbus_atomic_dec'
.libs/libdbus_1_la-dbus-connection.o: In function `_dbus_message_filter_ref':
/home/fstrba/devel-cvs/dbus/dbus/dbus-connection.c:334: undefined reference to `__dbus_atomic_inc'
.libs/libdbus_1_la-dbus-message.o: In function `dbus_message_unref':
/home/fstrba/devel-cvs/dbus/dbus/dbus-message.c:1549: undefined reference to `__dbus_atomic_dec'
.libs/libdbus_1_la-dbus-message.o: In function `dbus_message_ref':
/home/fstrba/devel-cvs/dbus/dbus/dbus-message.c:1527: undefined reference to `__dbus_atomic_inc'
.libs/libdbus_1_la-dbus-object-tree.o: In function `_dbus_object_subtree_unref':
/home/fstrba/devel-cvs/dbus/dbus/dbus-object-tree.c:1016: undefined reference to `__dbus_atomic_dec'
.libs/libdbus_1_la-dbus-object-tree.o: In function `_dbus_object_subtree_ref':
/home/fstrba/devel-cvs/dbus/dbus/dbus-object-tree.c:1006: undefined reference to `__dbus_atomic_inc'
.libs/libdbus_1_la-dbus-threads.o: In function `init_locks':
/home/fstrba/devel-cvs/dbus/dbus/dbus-threads.c:439: undefined reference to `__dbus_lock_atomic'
.libs/libdbus_1_la-dbus-transport.o: In function `_dbus_transport_new_for_autolaunch':
/home/fstrba/devel-cvs/dbus/dbus/dbus-transport.c:289: undefined reference to `__dbus_get_autolaunch_address'
.libs/libdbus_1_la-dbus-internals.o: In function `_dbus_create_uuid_file_exclusively':
/home/fstrba/devel-cvs/dbus/dbus/dbus-internals.c:742: undefined reference to `__dbus_make_file_world_readable'
.libs/libdbus_1_la-dbus-internals.o: In function `_dbus_get_local_machine_uuid_encoded':
/home/fstrba/devel-cvs/dbus/dbus/dbus-internals.c:823: undefined reference to `__dbus_read_local_machine_uuid'
.libs/libdbus_1_la-dbus-sysdeps.o: In function `_dbus_abort':
/home/fstrba/devel-cvs/dbus/dbus/dbus-sysdeps.c:84: undefined reference to `__dbus_print_backtrace'
collect2: ld returned 1 exit status

I am not really sure how to shuffle this and what is necessary in which if block.

Concerning the docs and unit-tests:
1) I will do the docs (I promis)
2) I will think through the unit-tests, since there is the chicken-egg problem: we have to check somehow the runtime prefix to be able to compare it with what dbus is relocating but dbus does also the same check and since only one dllmain can be in a dll, we will use the same handle :) But I will come with something.
Comment 23 Ralf Habacker 2010-04-21 07:13:56 UTC
(In reply to comment #22)
> Ralf: I am just wondering, that file dbus-sysdeps-win.c has quite a number of
> functions there in ifdefed blocks and if I cross-compile using a normal stock
> configure options (only setting the host and paths). I get linking errors:
>   CCLD   libdbus-1.la
> Creating library file: .libs/libdbus-1.dll.a

Thanks for pointing this out. These issue is fixed in git master branch. 


> Concerning the docs and unit-tests:
> 1) I will do the docs (I promis)
> 2) I will think through the unit-tests, since there is the chicken-egg problem:
> we have to check somehow the runtime prefix to be able to compare it with what
> dbus is relocating but dbus does also the same check and since only one dllmain
> can be in a dll, we will use the same handle :) But I will come with something.

Could this not be checked by 

char install_root_with_something_appended[1000]

if (!_dbus_get_install_root(install_root_with_something_appended,1000))
Comment 24 Ralf Habacker 2010-04-21 07:20:28 UTC
(In reply to comment #23)
> (In reply to comment #22)
> > Ralf: I am just wondering, that file dbus-sysdeps-win.c has quite a number of
> > functions there in ifdefed blocks and if I cross-compile using a normal stock
> > configure options (only setting the host and paths). I get linking errors:
> >   CCLD   libdbus-1.la
> > Creating library file: .libs/libdbus-1.dll.a
> 
> Thanks for pointing this out. These issue is fixed in git master branch. 
> 
> 
> > Concerning the docs and unit-tests:
> > 1) I will do the docs (I promis)
> > 2) I will think through the unit-tests, since there is the chicken-egg problem:
> > we have to check somehow the runtime prefix to be able to compare it with what
> > dbus is relocating but dbus does also the same check and since only one dllmain
> > can be in a dll, we will use the same handle :) But I will come with something.
> 
> Could this not be checked by 

sorry posted uncomplete by accident. 

... comparing the install root retrieved from _dbus_get_install_root() and appended "something" with the return value from _dbus_replace_install_prefix("DBUS_PREFIX" "something"), which should be equal ?
Comment 25 Ralf Habacker 2010-06-09 01:23:32 UTC
(In reply to comment #23)
> 
> > Concerning the docs and unit-tests:
> > 1) I will do the docs (I promis)

Do you have any news in this area ?
Comment 26 Ralf Habacker 2010-06-12 11:36:49 UTC
doc could be provided in a separate bug


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.