[KDE/Mac] Review Request 126161: OS X housekeeping
René J.V. Bertin
rjvbertin at gmail.com
Thu Nov 26 16:20:26 UTC 2015
This is an automatically generated e-mail. To reply, visit:
(Updated Nov. 26, 2015, 5:20 p.m.)
Review request for KDE Software on Mac OS X and KDE Frameworks.
This revision moves introduces `kinit_mac.mm` in order to cut down on the number of #ifdefs, and merges in David's suggestion:
After looking more closely at the underlying issue, it turns out that the off-limits behaviour that results in a crash (possibly an abort) is the fact of calling non-POSIX APIs (which are non-reentrant) after a `fork()`. In `kdeinit` this happens during the `dlopen` call (`QLibrary::load`), when KDE and/or Qt ctors are called. Calling `dlopen` becomes safe again after starting a new process through `exec`.
Thus, my new proposition does:
- fork + exec when `launch()` is told to start executable. This is in fact the same code-path also used on other Unix variants
- fork + exec(helper) when `launch()` is told to start a shared library containing `kdeinitmain` or `kdemain`; the helper then calls `dlopen` and finally the resolved `kde*main` function.
The code is now prepared to be slimmed down if the helper tool turns out to be redundant (`kdeinit` or `klauncher` are never used to "launch" a shared library). I'd really prefer to let this become apparent in time, rather than having to figure out at an unknown time in the future why some features fail to work (or rather, slap a big fat warning into the user's face).
This patch addresses several issues with the OS X adaptations:
-1 replaces the obsolete Q_OS_MAC with Q_OS_OSX
-2 builds the relevant applications `nongui` instead of as app bundles
-3 turns klauncher into an "agent" by setting `LSUIElement` to true programmatically
-4 ports a patch that has been in MacPorts' `port:kdelibs4` since October 14th 2009, which prevents a kdeinit crash that is caused by calling exec after `fork()` in an application that has used non-POSIX APIs and/or calling those APIs in the exec'ed application. This patch (originally by MacPorts developers Jeremy Lainé and Jeremy Lavergne) rearranges call order and uses a proxy application to do the actual exec.
On OS X 10.9.5 with Qt 5.5.1 and KF5rameworks 5.16.0 . With this patch, starting `kded5` will launch kdeinit5 and klauncher5 as expected, but `kdeinit5 --kded` does not yet launch `kded5`. This is probably acceptable for typical KF5 use on OS X (kded5 can be launched as a login item or as a LaunchAgent) but I will have another look at why the kded isn't started.
I am not yet able to perform further testing; practice will for instance have to show whether point 2 above needs revision (apps that need to be installed as app bundles).
Similarly it will have to be seen whether point 3 above has any drawbacks. Applications running as agents do not show up in the Dock or App Switcher. Thus, klauncher will not be able to "turn itself into" an application that does have a full GUI presence with my current modification. I don't know if that's supposed to be possible though.
NB: I have been building the KDE4 klauncher in a way that makes it impossible to construct a GUI at all, so I'm not expecting issues in KF5 as long as klauncher's role hasn't evolved too much.
René J.V. Bertin
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the kde-mac