From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Po Lu via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#36362: New feature-x-check-server Date: Sat, 12 Feb 2022 17:56:45 +0800 Message-ID: <87leygs90i.fsf@yahoo.com> References: <8736ju7dju.fsf@gmail.com> <8735ko4hwn.fsf@gnus.org> Reply-To: Po Lu Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37096"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.91 (gnu/linux) Cc: 36362@debbugs.gnu.org, Lars Ingebrigtsen , Noam Postavsky To: otadmor Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Feb 12 10:59:45 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nIpBw-0009Wl-W4 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 12 Feb 2022 10:59:45 +0100 Original-Received: from localhost ([::1]:59982 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nIpBv-0001eK-PO for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 12 Feb 2022 04:59:43 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:45376) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nIpAI-0008HS-HI for bug-gnu-emacs@gnu.org; Sat, 12 Feb 2022 04:58:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:39624) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nIpAI-0006vY-7z for bug-gnu-emacs@gnu.org; Sat, 12 Feb 2022 04:58:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nIpAI-0007QT-8Q for bug-gnu-emacs@gnu.org; Sat, 12 Feb 2022 04:58:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Po Lu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 12 Feb 2022 09:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 36362 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: wontfix Original-Received: via spool by 36362-submit@debbugs.gnu.org id=B36362.164465982328467 (code B ref 36362); Sat, 12 Feb 2022 09:58:02 +0000 Original-Received: (at 36362) by debbugs.gnu.org; 12 Feb 2022 09:57:03 +0000 Original-Received: from localhost ([127.0.0.1]:33521 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nIp9K-0007P5-Ky for submit@debbugs.gnu.org; Sat, 12 Feb 2022 04:57:02 -0500 Original-Received: from sonic315-22.consmr.mail.ne1.yahoo.com ([66.163.190.148]:38837) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nIp9I-0007OZ-4L for 36362@debbugs.gnu.org; Sat, 12 Feb 2022 04:57:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1644659813; bh=uSDxJaNbHWAvD06miLpwgBohP1hpEYbN7fr6KUipVxc=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From:Subject:Reply-To; b=bcxO9zPZI8sgk1Nzbxwctf6Met8vnkejjZCbjPRiJpHKKKcJL064coi5z5qY0VmnjLJ/XdYirGWt7FFA19DIC7z7hAebwMVWoQ9ei07cArJuRwWk/26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CQCzhsXy.QYT0iXpz1YfpddVhxdR8NHlCR HtHnXn6b.svIzZHSIu887wWB8xbSNDoixTt7lhAf8g9DX8bUSl2XYGtKR.h9Wh9kPzVuM4lacpH6 xHSg33YzMDqKaQMi6zusKhvGXAuZu1l7HClob.GQwLRqSqe_j2GobvaCPU1Cv0kKv3Y_f3ebtG0j rNBKqYckZDBhIYyuDQGwB6bhjujptSpcRiksowN921vHFteo4o4k3uyG196NcDZa99BRi4OPPvya rd_bNioDSvS0eL6NVp0R914zMkLq8L54JYPtKcgMTjkC.siCPYmdQCT6GC86J44jgaWJ1Z1xl.ei CyaRtSOMkZ52rBzAIfkLejqPxO2yQuQticqL0QUw538bh3tqEstybTWT8uuwbUgYuI8ObGNJ59md UV_fO3leY5xzY_InEhqpONcjIHL723hMeg2P1a22QkUMzJYJ1nQnjdLUpu930wpKv9QiU6vdr43B htms8eHQWtXL8AqRml52ctNy9pRse2n7OqHW4GD4qc X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic315.consmr.mail.ne1.yahoo.com with HTTP; Sat, 12 Feb 2022 09:56:53 +0000 Original-Received: by kubenode517.mail-prod1.omega.sg3.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID f237ece28eaa96112d20d3fdbf54475a; Sat, 12 Feb 2022 09:56:49 +0000 (UTC) In-Reply-To: (otadmor@gmail.com's message of "Sat, 12 Feb 2022 10:13:28 +0100") X-Mailer: WebService/1.1.19724 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:226716 Archived-At: otadmor writes: > When running xlb function the code gets stuck in a native endless > loop. The patch I have added closes the fd of the xserver, which as a > side effect ends the endless loop. Some would say this patch is > fixing a bug of a dependency of emacs and not emacs itself (it is just > that emacs uses it in a certain way...). This solution uses native > timer (using signals) to detect the timeout. Upon reaching a timeout > it closes an the fd on the same thread as the xlb code (this is > because of how signals works). I am not happy with your change. Firstly, it is not portable and makes very specific assumptions about the internals of Xlib, while we support any Xlib from X11R6 in the past to the foreseeable future, along with some alternative implementations. We do not use any part of Xlib that forms part of the interface for protocol extensions, since Emacs is not an X11 protocol extension. Secondly, Emacs supports connecting multiple X displays at the same time. Your code does not try to support that at all. Thirdly, I cannot understand what is returning EINTR: that error occurs only when the read from the X connection was interrupted by a signal. If the X server goes down (such as when your laptop goes to sleep), the connection eventually times out and closes, which then triggers an IO error that Emacs does handle correctly. If it does not, then that is a bug in xcb and should be reported to their developers. I suggest to add an entry to etc/PROBLEMS describing your specific use case instead. > To do this is lisp we need to answer the following: > 1. How to find the fd of the current xserver using lisp? That is not possible, and I wouldn't agree to such a function. > 4. Is it even allowed to run lisp code while the main thread is in xlb > native code (stack frame is deep inside other library and this other > library was called from lisp). Yes, but not inside a signal handler (unless it is an IO signal, see block_input and friends.)