about QSP::RuntimeLocation and XDG_RUNTIME_DIR on OS X/MacPorts

David Faure faure at kde.org
Sun Dec 6 14:29:09 UTC 2015


On Monday 23 November 2015 17:32:28 René J. V. Bertin wrote:
> Hi,
> 
> Freedesktop/XDG-compliant applications may use a user-specific location for 
> runtime "stuff" like sockets. On Linux, this location usually is something like 
> /run/user/uid. It is typically defined globally through the XDG_RUNTIME_DIR env. 
> variable, with a fallback if that variable doesn't exist.
> 
> I'm not certain if MacPorts has some kind of policy for handling this particular 
> location. The only beginning of an answer I have for now is the presence of a 
> few ~/.cache/keyring-XXXXX directories, which may correspond to the similarly 
> named keyring directories in /run/user/uid on my Linux rig.
> 
> Context: Qt5's QStandardPaths::RuntimeLocation return value. It defaults to 
> ~/Library/Application Support, which I think is fine for "Apple native mode" but 
> not for an XDG-compliant mode like the one I intend to provide.
> Alternatives I see:
> - $TMPDIR/runtime-username (calculated using the QSP RuntimeLocation code used 
> on other Unix hosts)
> - ~/.cache (to align with what Gnome *may* use).
> 
> I tend to prefer the 1st alternative to stick closest to what happens on Linux, 
> but only if Qt5-based and non-Qt5-based applications and libraries need NOT 
> agree on the location.
> 
> Thoughts?

I don't think this reasoning is right. All you need is a directory matching the
requirements (owned by the user, 0700 permissions, and on a filesystem
that supports sockets). It really doesn't matter what the path to that directory is,
and it definitely doesn't matter if the app is in "XDG" or "native" mode, unless
you can find an example where a Qt-based app and a non-Qt-based app
communicate over a socket in $XDG_RUNTIME_DIR, on Linux.

Let's see.... in KDE Frameworks, RuntimeLocation is used for
- the kdeinit socket
- the kdesud socket
- the kio app/slave socket
- the socket between kio_http and kio_http_cache_cleaner.

As I suspected, none of this needs interoperability with the rest of the XDG world.

So it doesn't matter where these sockets are put on Mac OS X, as long
as the security requirements are met.
Therefore "~/Library/Application Support" seems fine to me.

-- 
David Faure, faure at kde.org, http://www.davidfaure.fr
Working on KDE Frameworks 5



More information about the Kde-frameworks-devel mailing list