[PATCH xinit 2/2] startx: Make startx auto display select work with per user /tmp dirs

Hans de Goede hdegoede at redhat.com
Wed Mar 25 01:23:29 PDT 2015


Hi,

On 25-03-15 02:53, Peter Hutterer wrote:
> On Mon, Mar 23, 2015 at 02:16:13PM +0000, Jon TURNEY wrote:
>>
>>
>> On 20/03/2015 17:16, Ray Strode wrote:
>>> On Fri, Mar 20, 2015 at 10:02 AM, Hans de Goede <hdegoede at redhat.com> wrote:
>>>> If a separate /tmp per user is used the existing auto display select code
>>>> does not work, add an extra check for the unix socket for the display number
>>>> existing in /proc/net/unix (linux only).
>>>
>>> This patch and the previous patch make sense to me near term.  It
>>> fixes some corner
>>> cases without regressing any others.  I do think a better medium-term
>>> solution would
>>> be for xinit to start using -displayfd and startx to drop its "try to
>>> figure out a display
>>> number" heuristics.  There's just no reason programs that start an X
>>> server should be
>>> trawling around in /tmp and/or binding to sockets up front (except for
>>> hysterical raisins)
>>
>> I wrote a patch [1] a while ago to teach xinit to handle the -displayfd
>> option.
>>
>> If I understand you correctly, you are suggesting something slightly
>> different, that -displayfd should be used by default if a display number
>> isn't explicitly specified, but this might serve as a starting point...
>>
>> [1] http://cgit.freedesktop.org/~jturney/xinit/commit/?id=c6dc4db8fdcbe115867f6f4a1ab9138536f99fec
>
> The patch itself looks fine, minus a couple of coding style differences with
> the rest of the file. they should be fixed. Plus, you're leaving the pipe
> open from what I can tell.
>
> What gets interesting is using that from startx. The order of startx is
> pretty much:
> 1) dig around in the system to find a suitable $DISPLAY
> 2) add xauth entries for $DISPLAY
> 3) xinit
>
> Now, I've tried to avoid anything xauth-related, but from the little I know:
> to support displayfd in startx you'd have to communicate back to startx
> about the $DISPLAY and do the xauth dance before continuing with the xinit
> initial client connection. AFAICT, that's the tricky bit about -displayfd
> support in startx. Does that make sense or am I way off here?

You're right I had forgotten that the xauth file needs to contain the
displaynr, so there is no easy fix here I'm afraid.

I think that if we want to fix this we should add a -autodisplayconfig
config to xinit which takes care of handling both -displayfd and of
generating and passing in an xauth file. Once we've a such a
-autodisplayconfig option to xinit fixing startx becomes trivial.

Regards,

Hans


More information about the xorg-devel mailing list