:: Re: [DNG] libpam-xdg-support / libp…
Top Page
Delete this message
Reply to this message
Author: Roger Leigh
Date:  
To: dng
Subject: Re: [DNG] libpam-xdg-support / libpam-systemd
On 10/09/2015 20:33, tilt! wrote:
> Hi,
>
>> in Ubuntu defaults are in X11/Xsession.d/60x11-common_xdg_path
>> which is shipped by x11-common and sourced by XSession
> >
>> BTW there is some XDG_* env setting also in X11/Xsession.d/00upstart
>
> Ok, now if only we knew what to actually use as a default for
> XDG_RUNTIME_DIR; it is a per-user setting, and defining the
> prefix to be /tmp/run is not enough.
>
> Come to think of it, my choice of
>
>     ${XDG_RUNTIME_DIR:-/tmp/run/$USER}

>
> is no good, because, just as an example, if $USER comes from
> an AD domain or LDAP it might contain '\'; in the least,
> $USER had to undergo some transformation (escaping?) to ensure
> that it's filesystem-safe.
>
> No wonder XDG issues no default value, and it all disappears
> into implementation code, it's a potato of above-average warmth
> - makes me feel sorry i brought it up in the first place :-D


You can always use the uid instead of the name? One saving grace of
this facility is that since it's entirely defined by XDG_RUNTIME_DIR,
you can construct the path however you see fit. The name is purely an
internal implementation detail. You could even do it by some other
means such as the login number since startup e.g. /tmp/session/1. Or a
timestamp and PID: /tmp/session/201509102055-9230. Or a random
mkdtemp(3) direcory. My point is simply that the path doesn't need to
contain the username, so you can use whatever makes most sense to make
it unique. Depending upon your chosen level of conformance with the XDG
spec, you might also want to make provision for sharing it between
sessions, so a basic uid would give you that, but in combination with a
random part would allow you to have separate sessions (which isn't
covered by the spec).


Regards,
Roger