[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#63865: 29.0.90; call-process while owning the X selection hangs othe
From: |
Eli Zaretskii |
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 |
> From: Spencer Baugh <sbaugh@janestreet.com>
> Cc: Eli Zaretskii <eliz@gnu.org>, 63865@debbugs.gnu.org
> Date: Sat, 03 Jun 2023 08:30:57 -0400
>
> Po Lu <luangruo@yahoo.com> writes:
>
> > Spencer Baugh <sbaugh@janestreet.com> writes:
> >
> >> Po Lu <luangruo@yahoo.com> writes:
> >>
> >>> Eli Zaretskii <eliz@gnu.org> writes:
> >>>
> >>>>> From: Spencer Baugh <sbaugh@janestreet.com>
> >>>>> 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).
- bug#63865: 29.0.90; call-process while owning the X selection hangs other processes, Spencer Baugh, 2023/06/02
- bug#63865: 29.0.90; call-process while owning the X selection hangs other processes, Eli Zaretskii, 2023/06/03
- bug#63865: 29.0.90; call-process while owning the X selection hangs other processes, Po Lu, 2023/06/03
- bug#63865: 29.0.90; call-process while owning the X selection hangs other processes, Spencer Baugh, 2023/06/03
- bug#63865: 29.0.90; call-process while owning the X selection hangs other processes, Eli Zaretskii, 2023/06/03
- bug#63865: 29.0.90; call-process while owning the X selection hangs other processes, Po Lu, 2023/06/03
- bug#63865: 29.0.90; call-process while owning the X selection hangs other processes, Spencer Baugh, 2023/06/03
- bug#63865: 29.0.90; call-process while owning the X selection hangs other processes,
Eli Zaretskii <=
- bug#63865: 29.0.90; call-process while owning the X selection hangs other processes, Spencer Baugh, 2023/06/03
- bug#63865: 29.0.90; call-process while owning the X selection hangs other processes, Eli Zaretskii, 2023/06/03
- bug#63865: 29.0.90; call-process while owning the X selection hangs other processes, Spencer Baugh, 2023/06/03
- bug#63865: 29.0.90; call-process while owning the X selection hangs other processes, Eli Zaretskii, 2023/06/03
- bug#63865: 29.0.90; call-process while owning the X selection hangs other processes, Spencer Baugh, 2023/06/03
- bug#63865: 29.0.90; call-process while owning the X selection hangs other processes, Eli Zaretskii, 2023/06/03
- bug#63865: 29.0.90; call-process while owning the X selection hangs other processes, Spencer Baugh, 2023/06/03
- bug#63865: 29.0.90; call-process while owning the X selection hangs other processes, Eli Zaretskii, 2023/06/03
- bug#63865: 29.0.90; call-process while owning the X selection hangs other processes, Po Lu, 2023/06/03
- bug#63865: 29.0.90; call-process while owning the X selection hangs other processes, Andreas Schwab, 2023/06/03