From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#63865: 29.0.90; call-process while owning the X selection hangs other processes Date: Sat, 03 Jun 2023 15:55:07 +0300 Message-ID: <83mt1g9044.fsf@gnu.org> References: <83edmt9j8i.fsf@gnu.org> <87bkhxnhpk.fsf@yahoo.com> <87wn0kn3zu.fsf@yahoo.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5204"; mail-complaints-to="usenet@ciao.gmane.io" Cc: luangruo@yahoo.com, 63865@debbugs.gnu.org To: Spencer Baugh Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jun 03 14:55:28 2023 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 1q5Qmx-00011h-KL for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 03 Jun 2023 14:55:28 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q5Qmd-0000QC-7u; Sat, 03 Jun 2023 08:55:03 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q5Qmc-0000Px-Fr for bug-gnu-emacs@gnu.org; Sat, 03 Jun 2023 08:55:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q5Qmc-0006kh-7F for bug-gnu-emacs@gnu.org; Sat, 03 Jun 2023 08:55:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1q5Qmc-0001Qe-3S for bug-gnu-emacs@gnu.org; Sat, 03 Jun 2023 08:55:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 03 Jun 2023 12:55:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63865 X-GNU-PR-Package: emacs Original-Received: via spool by 63865-submit@debbugs.gnu.org id=B63865.16857968655427 (code B ref 63865); Sat, 03 Jun 2023 12:55:02 +0000 Original-Received: (at 63865) by debbugs.gnu.org; 3 Jun 2023 12:54:25 +0000 Original-Received: from localhost ([127.0.0.1]:41783 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q5Qm0-0001PS-G8 for submit@debbugs.gnu.org; Sat, 03 Jun 2023 08:54:24 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:37638) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q5Qly-0001P1-E3 for 63865@debbugs.gnu.org; Sat, 03 Jun 2023 08:54:23 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q5Qlt-0006EN-5z; Sat, 03 Jun 2023 08:54:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=DpvFwaXO9KSKL2QhvExkt40Z/PNQbEMbwgdL1gqRm5M=; b=TQf615/LgGjS 8QhkeMneGZRgRaWv3toqlML1+uHTZdDGfOWK+J2Wc5fbkSuGeonhkpZDZd+2Bw1oUkoXFw0J/nDih eiwBTmPwbqR2JE1Fqm7Adpwym6w+KU/q3WPIXHN25br3vOUwZVoxUX/PW0Dsv6P8xr4/gH/ttM/7z gbNACxqke65UuBjwYY1Eu6H1WuwAKQPAapPzUEWDRcWbJcbAaARXPV3zF1eBTt2SFeHptBDlt0uTX nIRsshp2gdotOhUfXcryE0wyqfWGjMnqISHyFIOMYtiAWXQFcKwdfMWG6TJbb70FcEVGwUUXlRmKo TiRD7/fVxRDgx0bZQVTmFA==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q5Qls-0004fg-In; Sat, 03 Jun 2023 08:54:16 -0400 In-Reply-To: (message from Spencer Baugh on Sat, 03 Jun 2023 08:30:57 -0400) 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:262830 Archived-At: > From: Spencer Baugh > Cc: Eli Zaretskii , 63865@debbugs.gnu.org > Date: Sat, 03 Jun 2023 08:30:57 -0400 > > Po Lu writes: > > > Spencer Baugh writes: > > > >> Po Lu writes: > >> > >>> Eli Zaretskii writes: > >>> > >>>>> From: Spencer Baugh > >>>>> Date: Fri, 02 Jun 2023 21:55:09 -0400 > >>>>> > >>>>> > >>>>> 1. Under X11, with the GTK or Lucid toolkits: > >>>>> emacs -Q > >>>>> 2. Become owner of the clipboard selection by killing some text; the > >>>>> starting comments in the scratch buffer are a good candidate. > >>>>> 3. Immediately afterwards (i.e. without copy and pasting text in another > >>>>> window), run: > >>>>> (call-process "sleep" nil nil nil "inf") > >>>>> 4. Now other applications will hang when they attempt to paste text. > >>>>> Google Chrome and Slack are two examples. (GTK-based applications > >>>>> seem to be fine. So much for proprietary software...) > >>>> > >>>> Thanks. > >>>> > >>>> Does this happen also with the latest pretest, v29.0.91? > >>> > >>> I can't reproduce this, but the closest thing to Google Chrome on the > >>> computer I am currently using is Firefox 10.0.7. > >> > >> BTW, this can also be reproduced using just Emacs. If I try to paste in > >> another Emacs instead of in Google Chrome, I get a hang, followed by: > >> > >> gui-get-selection: (error "Timed out waiting for reply from selection owner") > > > > Emacs doesn't hang... > > Well, it hangs for 10 seconds, then times out, because Emacs is > correctly implemented. The value of the timeout can be customized, if you don't like the default. > > OK, but then this is not a bug: Emacs can not respond to selection > > requests when it is not reading keyboard input. > > "Emacs can not respond to selection requests when it is not reading > keyboard input." sounds like a bug to me! Even if it's hard to fix, > it's still a bug. We run Lisp to generate selection response, so there's no way we can do that when the main Lisp thread is busy. It isn't a bug, it's a restriction of how Emacs is designed. > If I'm implementing some package and I decide to use call-process for > some long operation, then some user uses my package and it runs > call-process, and they get bored while waiting and switch away from > Emacs, they'll experience a hang in some other application. That hang > seems clearly undesirable! Then don't design the package such that call-process blocks Emacs for prolonged periods of time. Because this will annoy the users of Emacs even before it will be seen by other applications that request X selections. > I'm personally working around this by replacing call-process with > start-process and accept-process-output. Because otherwise my packages > (and any other package using call-process ever) will cause random hangs > in other applications, which is obviously bad and not something anyone > would want. > > So perhaps call-process on Unix should be reimplemented in terms of > those functions? Or if that would change behavior too much, perhaps > call-process should be deprecated in favor of some new helper built on > those? call-process has its use cases, which are important, and we will not deprecate it. You can easily emulate call-process with start-process if you need to do so, so Emacs gives you both possibilities (and expects you to use whatever is right in each case).