• Bug#875356: Wrong timeout computation in xf86WaitForInput breaks xserve

    From Thomas Richter@21:1/5 to All on Sun Sep 10 23:40:03 2017
    XPost: linux.debian.bugs.dist

    Package: xserver-xorg-core
    Version: 2:1.19.2-1+deb9u1
    Severity: important

    The current debian version of xserver-xorg-core breaks due to a protocol
    change xserver-xorg-input-wacom. In particular, the function affected is xf86WaitForInput(), which used to expect a timeout in microseconds due
    to its implementation on top of select(), though now runs into
    xserver_poll(), which expects a delay in milliseconds.
    xserver-xorg-input-wacom uses this function to initiate a delay of
    250msecs to reset the wacom serial protocol, but now receives a delay of 250seconds instead. IOWS, the xserver startup hangs for all practical
    purposes.

    The current source of xf86WaitForInput is as follows:

    int
    xf86WaitForInput(int fd, int timeout)
    {
    int r;
    struct pollfd poll_fd;

    poll_fd.fd = fd;
    poll_fd.events = POLLIN;

    if (fd >= 0) {
    SYSCALL(r = xserver_poll(&poll_fd, 1, timeout));
    }
    else {
    SYSCALL(r = xserver_poll(&poll_fd, 0, timeout));
    }
    xf86ErrorFVerb(9, "poll returned %d\n", r);
    return r;
    }

    Note that this bug has been fixed upstream which includes the necessary scaling:


    int
    xf86WaitForInput(int fd, int timeout)
    {
    int r;
    struct pollfd poll_fd;

    poll_fd.fd = fd;
    poll_fd.events = POLLIN;

    /* convert microseconds to milliseconds */
    timeout = (timeout + 999) / 1000;

    if (fd >= 0) {
    SYSCALL(r = xserver_poll(&poll_fd, 1, timeout));
    }
    else {
    SYSCALL(r = xserver_poll(&poll_fd, 0, timeout));
    }
    xf86ErrorFVerb(9, "poll returned %d\n", r);
    return r;
    }

    Please consider adding this fix to the debian version as otherwise at
    least the wacom input module will break.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)