OSX: DBus Session Lookup Always Fails when Run from Cron or a Parent Process - Direct Exec Always Works
René J.V. Bertin
rjvbertin at gmail.com
Fri Dec 18 01:57:35 PST 2015
On Thursday December 17 2015 18:07:57 Jim Mannix wrote:
>I’ve tried a great many things to get a Qt/DBus application to work under automation, but it only works when run directly.manually by a human in a terminal .. and the application is intended for cron automation or automation by a parent process.
That is with Qt5 I presume? Was it written from scratch for OS X?
Not that I can help you, but it looks a lot like an issue I have ran into myself porting KF5 (KDE5) frameworks and applications:
KF5's secure wallet feature relies on a central daemon process (kwalletd5) which handles and serves all requests to access wallets; it uses gpgme when available and thus requires communication with an appropriate pinentry tool.
This works fine when kwalletd5 is started manually from a terminal. It does not however if the daemon is started automatically when an application tries to access a wallet, even if that parent process is started manually from a terminal. The same applies when starting kwalletd5 through a launchctl script or even through LaunchServices; building it as an app bundle or not doesn't make a difference, nor does the LSUIElement setting.
It's been a while since I last checked this particular issue, but the error message about loading the DBus session plist seems familiar in this context. Coupled with the OOM error it does look like it comes from a bit of code that doesn't really know what it's reporting on (or reports an inappropriate error code).
I'd be a bit surprised if the OS X implementation of gpgme uses DBus to communicate with the pinentry utility, but the communication between kwalletd5 and its clients is definitely done using DBus.
My first thought was that the DBus session address env.variable somehow gets lost or went stale; that appears not to be the case (it still shows up correctly in `launchctl export` and thus should be available to any process started no matter how).
Do DBus and/or Qt5 use any other env. variables that might not be available to applications that are not started manually from a terminal, on OS X?
More information about the dbus