xwinclip not waiting for x server startup (was xwinclip authorisation)

Matthew Donald matthew.donald@motile.net
Tue Jan 15 13:04:00 GMT 2002

Hi Harold,

Thanks for your enlightening note.  I've placed a 30 second delay in my code
which kludges around the problem.  I like your suggestion of retrying
xwinclip every, say 4 seconds, until it connects.

I'm still puzzled by the security issues.  Does XDMCP cause the localhost to
lose access to the X server?  I'm creating a /etc/X0.hosts file to ensure
that localhost retains access.  Is there a better way?

cheers Matthew

----- Original Message -----
From: "Harold Hunt" <huntharo@msu.edu>
To: <matthew.donald@motile.net>
Cc: "cygx" <cygwin-xfree@cygwin.com>
Sent: Wednesday, January 16, 2002 6:48 AM
Subject: RE: xwinclip not waiting for x server startup (was xwinclip

> > Hi Shane,
> >
> > Cygwin/Xfree and XDMCP work correctly.  I only get a problem when
> a
> > local X client at the same time as a remote X client (via XDMCP).  It
> turns
> > out a /etc/X0.hosts file containing a 'localhost' entry is needed.  Also
> > xwinclip does not wait for the X server to complete startup, while some
> > other clients (such as xterm) do.
> >
> > Any ideas why xwinclip does wait for X server startup?
> >
> > cheers Matthew
> I wrote xwinclip.  The reason that it behaves differently than 'xterm' is
> that xterm uses the XToolkit library, which xwinclip cannot use.  xwinclip
> cannot use XT because we need to have a specialized event loop that
> processes both X events and Win32 messages.  xwinclip needs the extra
> options provided by using the X11 api directly, rather than through a
> toolkit.
> Now, you ask "why xwinclip [doesn't] wait for X server startup?"  I can
> answer that question simply: because not enough is known about how we need
> to "wait".  In other words, the issue is not well enough defined for it to
> be solved.
> I just added a loop that retries opening the X display several times.
> change didn't really do anything.
> Part of the problem is that the X Server (in a part of the code that we
> not write) accepts the xwinclip connection before  xdmcp connects to the
> remote host.  xdmcp causes the server to reset when it gets a connection
> the remote host, so xwinclip is shutdown after xdmcp connects.
> Now, two ideas come to mind to solve that problem, neither of which will
> work:
> 1) Don't exit when we receive a message that the server is going to reset.
> Instead, try to reconnect for about ten seconds.
>    The problem here is that the error is generated by a libX11 function,
> which calls _XDefaultIOError to report the error.  The problem with
> _XDefaultIOError is that it then calls exit(1), so xwinclip never has a
> chance to handle the error on its own.
> 2) Delay connecting to the X server by a number of seconds, regardless of
> whether xdmcp is being used or not (as we have no way of knowing).
> even allow a parameter to specify how many seconds to delay.
>    This solution only duplicates the functionality of the 'sleep x'
> where x is the timeout in seconds.  There is no point in duplicating
> functionality.
> The only way that I know of to get xwinclip to work with XDMCP is to
> your batch file (startxwin.bat) to something like the following:
> start /B XWin -noreset -ac -query huntharo-4.user.msu.edu
> sleep 8
> start /B xwinclip
> That's it for now,
> Harold

More information about the Cygwin-xfree mailing list