Subject: bug#36591: 26.2; Term's pager seems broken

From: Noam Postavsky <[email-masked]>
Date: Thu, 25 Jul 2019 13:57:52 -0400

Lars Ingebrigtsen <[email-masked]> writes:

> Hm...  the problem was really when you call `set-process-filter' more
> than once?

The problem is when you call (set-process-filter PROC t) and then
(set-process-filter PROC FILTER), where FILTER is not t.  The first time
we correctly do delete_read_fd, but on the second time, we don't call
add_process_read_fd on PROC's fd, so we never hear from it again.

For a minimal example with subprocesses (not sockets), see
https://debbugs.gnu.org/cgi/bugreport.cgi?msg=17;att=1;bug=36591;filename=bug-36591-proc-filter-t.el

> I do not think connect_network_socket is called more than once per
> process...  so I don't think it should be a problem?  But the logic is
> rather difficult to follow.

Yeah, quite difficult.  I guess the question is whether
connect_network_socket will call add_process_read_fd even the first time
though.  I think not.  But there are other calls to add_process_read_fd,
so it's possible that we end up listening to the socket anyway.