Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 300929 - dbus fixes for Interix
Summary: dbus fixes for Interix
Status: RESOLVED FIXED
Alias: None
Product: Gentoo/Alt
Classification: Unclassified
Component: Prefix Support (show other bugs)
Hardware: x86 Interix
: High critical (vote)
Assignee: Markus Duft (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-01-14 02:46 UTC by Greg Turner
Modified: 2010-02-05 15:34 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
Don't coredump for sigpipe writing "credentials" byte (dbus-1.3.0-interix-ignore-sigpipe.patch,1.08 KB, patch)
2010-01-14 03:28 UTC, Greg Turner
Details | Diff
Don't do UNIX FD passing on Interix (dbus-1.3.0-interix-just-say-no-to-fd-passing.patch,356 bytes, patch)
2010-01-14 03:30 UTC, Greg Turner
Details | Diff
Support the absurd interix pseudo-root uid 197108 (dbus-1.3.0-interix-quirks.patch,6.26 KB, patch)
2010-01-14 03:34 UTC, Greg Turner
Details | Diff
Patches to the dbus ebuild which merge the above patches and so some other work (dbus-1.3.0-r1.ebuild-interix-fixes.patch,1.96 KB, patch)
2010-01-14 03:38 UTC, Greg Turner
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Greg Turner 2010-01-14 02:46:30 UTC
Dbus is severely broken on Interix.  Fixes enclosed.

Reproducible: Always

Steps to Reproduce:
1. run 'dbus-launch'
Actual Results:  
dbus wigs out in random ways or segfaults due to stack corruption

Expected Results:  
dbus doesn't wig out or segfault

I've identified several places dbus needs interix-specific hand-holding and kludgery.  Using the enclosed patches, dbus runs like a champ on my 32bit interix6 system.  If committed these changes should allow gconf to be unmasked on interix prefix systems (unmasking works OK for me so far).
Comment 1 Greg Turner 2010-01-14 03:28:00 UTC
Created attachment 216441 [details, diff]
Don't coredump for sigpipe writing "credentials" byte

Kinda superfluous, since the same problem is redundantly worked around by another patch -- but nevertheless, theoretically speaking, this patch is required because Interix is apparently less forgiving of writes to recently closed pipes than "real" UNICES.
Comment 2 Greg Turner 2010-01-14 03:30:49 UTC
Created attachment 216442 [details, diff]
Don't do UNIX FD passing on Interix

Interix has the #defines for passing FD's over AF_UNIX sockets -- but it doesn't work (at least, I can't make it work).  So these patches prevent these code-paths from being activated on Interix.
Comment 3 Greg Turner 2010-01-14 03:34:29 UTC
Created attachment 216443 [details, diff]
Support the absurd interix pseudo-root uid 197108

Support the brilliant innovation of Interix that the root uid is 197108 instead of zero.
Comment 4 Greg Turner 2010-01-14 03:38:30 UTC
Created attachment 216444 [details, diff]
Patches to the dbus ebuild which merge the above patches and so some other work

Aside from applying the above patches, this patch to the dbus-1.3.0-r1 ebuild also defines _REENTRANT (which provides some API's dbus expects), hacks the config.h files generated by configure, and changes --with-dbus-user=messagebus to --with-dbus-user=Administrator on Interix.
Comment 5 Greg Turner 2010-01-14 03:42:59 UTC
Comment on attachment 216443 [details, diff]
Support the absurd interix pseudo-root uid 197108

This also fakes the credentials passing (I stole the code from dbus-win32) and uses an enormous buffer for filenames, fixing some nasty stack corruption problems.
Comment 6 Markus Duft (RETIRED) gentoo-dev 2010-01-14 08:42:43 UTC
Hey, this is really good news :) i'll look bringing this into the tree(s). just one thing: is it possible to keep root _and_ Administrator in that config files, so that i don't have to make the patch conditional? the rest of the patches seems like they could be applied on all platforms...
Comment 7 Greg Turner 2010-01-15 05:38:00 UTC
(In reply to comment #6)
> Hey, this is really good news :) i'll look bringing this into the tree(s). just
> one thing: is it possible to keep root _and_ Administrator in that config
> files, so that i don't have to make the patch conditional?

I don't know enough about the dbus script language to answer.  So... perhaps.

> the rest of the
> patches seems like they could be applied on all platforms...

I think the big filename buffer is clearly interix-specific.  Although I think I read that OSX users suffer from this too.  Also the SIGPIPE patch is of sufficiently dubious merit that it should not go in on all arches -- perhaps it should be dropped entirely.
Comment 8 Greg Turner 2010-01-15 20:58:08 UTC
(In reply to comment #7)
> (In reply to comment #6)
> > Hey, this is really good news :) i'll look bringing this into the tree(s). just
> > one thing: is it possible to keep root _and_ Administrator in that config
> > files, so that i don't have to make the patch conditional?

It is worth noting that not everybody has "Administrator" here -- some will have "Domain Admin," I think (?), and others may have renamed the Administrator account to something else.   To get a really reliable answer, I guess we should be doing "whoami" and some "sed" magic?  Is it ever valid for someone to be emerging as non-root on Interix?  
Comment 9 Markus Duft (RETIRED) gentoo-dev 2010-01-18 08:09:12 UTC
(In reply to comment #8)
[snip]
> It is worth noting that not everybody has "Administrator" here -- some will
> have "Domain Admin," I think (?), and others may have renamed the Administrator
> account to something else.   To get a really reliable answer, I guess we should
> be doing "whoami" and some "sed" magic?  Is it ever valid for someone to be
> emerging as non-root on Interix?  
> 

mhm, right - i guess i'll be ending asking portage, which user is the "portage-root-user", and be using that as dbus root too... i know it's not perfect, as even a normale user can install prefix/dbus, but isn't this required just for the system busses?
Comment 10 Greg Turner 2010-01-18 23:23:53 UTC
(In reply to comment #9)
> (In reply to comment #8)
> [snip]
> > It is worth noting that not everybody has "Administrator" here -- some will
> > have "Domain Admin," I think (?), and others may have renamed the Administrator
> > account to something else.   To get a really reliable answer, I guess we should
> > be doing "whoami" and some "sed" magic?  Is it ever valid for someone to be
> > emerging as non-root on Interix?  
> > 
> mhm, right - i guess i'll be ending asking portage, which user is the
> "portage-root-user", and be using that as dbus root too... i know it's not
> perfect, as even a normale user can install prefix/dbus, but isn't this
> required just for the system busses?

I dunno.  I think so, but I only ever use the session bus in real life.  I probably patched it in order to make the test suite get further.   
Comment 11 Markus Duft (RETIRED) gentoo-dev 2010-02-02 14:53:49 UTC
i just committed this. i refactored a little, as you might see in the ebuild. it now at least compiles (here on interix 5.2). could you give it a try?
Comment 12 Greg Turner 2010-02-05 15:34:12 UTC
(In reply to comment #11)
> i just committed this. i refactored a little, as you might see in the ebuild.
> it now at least compiles (here on interix 5.2). could you give it a try?

Seems to work  :)