From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Noam Postavsky Newsgroups: gmane.emacs.bugs Subject: bug#36591: 26.2; Term's pager seems broken Date: Wed, 24 Jul 2019 20:55:38 -0400 Message-ID: <87ftmvvsol.fsf@gmail.com> References: <87lfwox3fi.fsf@gmail.com> <838ssops2u.fsf@gnu.org> <87imrsw5gj.fsf@gmail.com> <83y30no4hi.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="176805"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2.90 (gnu/linux) Cc: Lars Ingebrigtsen , abliss@gmail.com, 36591@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jul 25 02:56:09 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hqS3E-000jsI-If for geb-bug-gnu-emacs@m.gmane.org; Thu, 25 Jul 2019 02:56:08 +0200 Original-Received: from localhost ([::1]:55148 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hqS3C-0002zK-O2 for geb-bug-gnu-emacs@m.gmane.org; Wed, 24 Jul 2019 20:56:06 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45064) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hqS39-0002z1-5s for bug-gnu-emacs@gnu.org; Wed, 24 Jul 2019 20:56:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hqS37-0003e8-Ta for bug-gnu-emacs@gnu.org; Wed, 24 Jul 2019 20:56:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:57607) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hqS37-0003dn-NA for bug-gnu-emacs@gnu.org; Wed, 24 Jul 2019 20:56:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hqS37-0004vJ-Kn for bug-gnu-emacs@gnu.org; Wed, 24 Jul 2019 20:56:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Noam Postavsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 25 Jul 2019 00:56:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 36591 X-GNU-PR-Package: emacs Original-Received: via spool by 36591-submit@debbugs.gnu.org id=B36591.156401614718906 (code B ref 36591); Thu, 25 Jul 2019 00:56:01 +0000 Original-Received: (at 36591) by debbugs.gnu.org; 25 Jul 2019 00:55:47 +0000 Original-Received: from localhost ([127.0.0.1]:38195 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hqS2t-0004ur-DR for submit@debbugs.gnu.org; Wed, 24 Jul 2019 20:55:47 -0400 Original-Received: from mail-io1-f41.google.com ([209.85.166.41]:40364) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hqS2r-0004ue-Vk for 36591@debbugs.gnu.org; Wed, 24 Jul 2019 20:55:46 -0400 Original-Received: by mail-io1-f41.google.com with SMTP id h6so7037317iom.7 for <36591@debbugs.gnu.org>; Wed, 24 Jul 2019 17:55:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=XliK3vqoTNw4wGdMu4zfBlV12h3j5GLQFbi5f9DceyQ=; b=c19W7YFxVE0b2jHmUG7nqHjRfNlgTXQg1c5FdUqXargfDS6kKLkkUqoZIMAcGIV/q6 lQjHjLiABBHs4OWkcM0z6lW9Dhn0224O5Wv5AN+dwePDr2H/Ct+xLkT7s4ea8udybTpk 8afu6B2YCBBuuSqrzgP4Kvc1XXEHyrBLud7C1gfju9FbGwP3LYMUcZS31g9+rK54CZHE Uwki0x2c+FSh4vpFNpDnEJKeORBSb0sMq5/OAlGpxMsZbjNO/nATiYs5G5jPpmI1t24c Z82VgrV2zIZNh8kiOFGZAa6yj8ANH+D1t/x+GHM7T9zQRpmLXYNB/KSz5I562lO5lScQ R4nA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=XliK3vqoTNw4wGdMu4zfBlV12h3j5GLQFbi5f9DceyQ=; b=f3bCRRURMyO6b5fFeI793nTUr/jOo9XGTLtSXnSIDVj7N3GRaD5wkgyqhVNdBo2IGb B4Jbntr6OAunfsQRglkj07Nov+GaMDvcqb63j4DsEKDFOtTzvsvwJhRUOvqRulYqQnUf YyU2DZzknfXH61uwBIF1URCHNcOcBWXlaDnR9EIVoKOw6RmCFf7Nm6c3JaMyt2sO3zBd HrbSE9x5CapPz0YEZ/pkMD13It+m8PMUiouwxUbwC1RSBBt4zNBp3J2dzDuUF0JFZMWQ RxJzrzcfnekpitClfIj3Q2+ONfJ89wUhSt0FaOlMRhxQkNvLzsTPjlTVWQ64nFvrTpJY /9gQ== X-Gm-Message-State: APjAAAVg5CamUgF30yBS2LHZfxlcoRVx3YQxX2+lzVyNAhdNxrjHp835 imqk/LQvbUwgx+2fgEKjNSeI5Vpm X-Google-Smtp-Source: APXvYqzwMWOcfMA/R+lXOeUzKmaJDiqocDFbesL9UgTbuSW5bOQSFt9W0O7dO4x2vhzmk89seo+bwg== X-Received: by 2002:a02:b68f:: with SMTP id i15mr58674051jam.107.1564016140071; Wed, 24 Jul 2019 17:55:40 -0700 (PDT) Original-Received: from minid (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34]) by smtp.gmail.com with ESMTPSA id j1sm45331809iop.14.2019.07.24.17.55.38 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Jul 2019 17:55:39 -0700 (PDT) In-Reply-To: <83y30no4hi.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 24 Jul 2019 18:07:53 +0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:163685 Archived-At: --=-=-= Content-Type: text/plain Eli Zaretskii writes: > I see that it's a small mess, but I don't think I understand your > reasoning about setting the filter to t twice: it looks to me that > both calls will clear the bit of p->infd, because they both will > trigger this clause: > > if (EQ (p->filter, Qt) && !EQ (p->status, Qlisten)) > Am I missing something? Argh, no, I was confused. The code in Emacs 25 is correct, although (IMO) somewhat misleading. > . if the filter is not t, we will now call add_process_read_fd every > time, for no good reason (This is a moot point due to the second problem, but) add_process_read_fd just sets some bits, which is harmless even if repeated. > . the patch changes how connect_network_socket works in ways that we > don't sufficiently understand Yes, I agree this is a serious problem. > I would like to leave connect_network_socket alone on the release > branch, and just fix the problem with set-process-filter. I think the > easiest way is simply not to call set_process_filter_masks in > set-process-filter, and instead restore the way that code worked > before 9755b753, i.e. let it test the argument FILTER _before_ that > filter is installed. Do you see any problems with this fix? I think that makes sense, patch attached. --=-=-= Content-Type: text/plain Content-Disposition: attachment; filename=0001-Fix-subproc-listening-when-setting-filter-to-non-t-B.patch Content-Description: patch >From ee13774efa2ac4b288f339c668b6002e27fbbe8f Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Wed, 24 Jul 2019 20:33:18 -0400 Subject: [PATCH] Fix subproc listening when setting filter to non-t (Bug#36591) * src/process.c (Fset_process_filter): Call add_process_read_fd according to the state of process filter before it's updated. This restores the correct functioning as it was before 2016-02-16 "Allow setting the filter masks later". Inline the set_process_filter_masks call instead of fixing it that function, because it is also called from connect_network_socket, and we don't want to change the behavior of that function so close to release. --- src/process.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/process.c b/src/process.c index 2df51cfd99..b602507765 100644 --- a/src/process.c +++ b/src/process.c @@ -1268,10 +1268,19 @@ DEFUN ("set-process-filter", Fset_process_filter, Sset_process_filter, if (NILP (filter)) filter = Qinternal_default_process_filter; - pset_filter (p, filter); - if (p->infd >= 0) - set_process_filter_masks (p); + { + /* If filter WILL be t, stop reading output. */ + if (EQ (filter, Qt) && !EQ (p->status, Qlisten)) + delete_read_fd (p->infd); + else if (/* If filter WAS t, then resume reading output. */ + EQ (p->filter, Qt) + /* Network or serial process not stopped: */ + && !EQ (p->command, Qt)) + add_process_read_fd (p->infd); + } + + pset_filter (p, filter); if (NETCONN1_P (p) || SERIALCONN1_P (p) || PIPECONN1_P (p)) pset_childp (p, Fplist_put (p->childp, QCfilter, filter)); -- 2.11.0 --=-=-= Content-Type: text/plain > On the master branch we should clean up the confusing set of if > clauses, both in set-process-filter and in connect_network_socket. > Perhaps Lars could describe his reasoning for making the change which > introduced set_process_filter_masks and what problem it tried to > solve. (Btw, the log message for that change seems to imply that > set-process-filter should not have called set_process_filter_masks, > something that the change itself disagrees with. An omission?) Hmm, true, I didn't pay that close attention to the log message. Maybe "we may not have a socket yet" refers to the already existing 'if (p->infd >= 0)' check? --=-=-=--