From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Adam Bliss Newsgroups: gmane.emacs.bugs Subject: bug#36591: 26.2; Term's pager seems broken Date: Wed, 10 Jul 2019 20:06:00 -0400 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000da4110058d5c8f1f" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="151657"; mail-complaints-to="usenet@blaine.gmane.org" To: 36591@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jul 11 06:28:15 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 1hlQgo-000dJm-Rb for geb-bug-gnu-emacs@m.gmane.org; Thu, 11 Jul 2019 06:28:14 +0200 Original-Received: from localhost ([::1]:38444 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hlQgn-0000n2-S9 for geb-bug-gnu-emacs@m.gmane.org; Thu, 11 Jul 2019 00:28:13 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34631) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hlQgf-0000hg-Tk for bug-gnu-emacs@gnu.org; Thu, 11 Jul 2019 00:28:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hlQge-00025P-EL for bug-gnu-emacs@gnu.org; Thu, 11 Jul 2019 00:28:05 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:56332) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hlQge-000251-AO for bug-gnu-emacs@gnu.org; Thu, 11 Jul 2019 00:28:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hlQge-0008UC-6S for bug-gnu-emacs@gnu.org; Thu, 11 Jul 2019 00:28:04 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Adam Bliss Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 11 Jul 2019 04:28:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 36591 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.156281922732521 (code B ref -1); Thu, 11 Jul 2019 04:28:04 +0000 Original-Received: (at submit) by debbugs.gnu.org; 11 Jul 2019 04:27:07 +0000 Original-Received: from localhost ([127.0.0.1]:36916 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hlQfj-0008SN-3S for submit@debbugs.gnu.org; Thu, 11 Jul 2019 00:27:07 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:55266) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hlMbN-0006Ol-TX for submit@debbugs.gnu.org; Wed, 10 Jul 2019 20:06:23 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44248) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hlMbM-0005Ds-0x for bug-gnu-emacs@gnu.org; Wed, 10 Jul 2019 20:06:21 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hlMbK-0008Qg-05 for bug-gnu-emacs@gnu.org; Wed, 10 Jul 2019 20:06:19 -0400 Original-Received: from mail-lj1-x232.google.com ([2a00:1450:4864:20::232]:34750) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hlMbI-0008N5-Pu for bug-gnu-emacs@gnu.org; Wed, 10 Jul 2019 20:06:17 -0400 Original-Received: by mail-lj1-x232.google.com with SMTP id p17so3883589ljg.1 for ; Wed, 10 Jul 2019 17:06:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=4Bmx2JrGiJtRmcJ5WazppmoqWfHhtgO/BiD+GKjcOsE=; b=dmSNweJJnT3qBZsEJdj4XkHR2UY6MwNtQVeWBpHWd/6V7jueh4mx/nZHBrB/8bL+YR iis7rc8Onj/MXOZs+M7p68CdCWS7eWpd6zVlaMSuIYfpkieuDMSpZGw6CjMXhj6GZzj0 i4X6ktzS6Np34FBoEBh7Yu8tIc7oveOSBHZuF4K7Xcu6vCOUq0KXZWCxAh5515pC2mOX Mk0L6LGDEUu1jnygz2Op1hYoNxmA49c/uQ7hfPixjuEglx3G+GAObV5/3i3H2rcg6C0Q gNmweF3f+G0nw0plwASC4dTaxCIDPtjJdqvYsS2RJLmV6NzILJSLJEodhiP+6SoqBzo9 hfyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=4Bmx2JrGiJtRmcJ5WazppmoqWfHhtgO/BiD+GKjcOsE=; b=bR7sLMgH5wtuK9MJ7CMPHsNDt+LJby25XBPK58ujmsbQWv0ak1e5HFYzE7ESO+5gi7 afaUO7LoIW5vsr6P7uDCMkvG6AUdkZU2HMEeNbmomuZtE0tZuyTxWy3k+HzOZAU6MjXC ki7uti5cKeQDuioK1+KcqSrvMGEVUSxts9Ohop+3rYPoI4KFb9nSivR6tji/cvwPgCkP URL5sjsww66NRS/niUSO6ODPExGr2Wpzd9gcVnUtkxYaesMyE82fuldqZzXddshVUKvZ Y/QFm8sii8htuKKiRdUmqmT9iDNgX1sjdMif3+sGxHtJoWsxKDOHuhQtCsS+D93mKKuM zHDg== X-Gm-Message-State: APjAAAVPe7ctWsAnWjxqfQO1rIZ+adQkOnmflI1z5DdGRqACIGl0nyD2 okV9imeFIj1YIAcbmoa5f9qMWSxY3yhqS+MeXbqXdYWb X-Google-Smtp-Source: APXvYqybBRdm68+vfDJwY35qG52h9n36w9Po9bszcDUSGw3G51/f5zd8HZro/lDjc+5JJfQcpOcEm8IQhuSeIvekqk0= X-Received: by 2002:a2e:b0d0:: with SMTP id g16mr489015ljl.161.1562803573505; Wed, 10 Jul 2019 17:06:13 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Mailman-Approved-At: Thu, 11 Jul 2019 00:27:03 -0400 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:162680 Archived-At: --000000000000da4110058d5c8f1f Content-Type: text/plain; charset="UTF-8" Hello, Recently I learned about the pager-mode built into M-x term. I tried it with some excitement, but discovered that, while it works fine in emacs 24, it seems completely broken in emacs 25-26. To reproduce, simply open a terminal (M-x term); enable the pager (C-c C-q); and run any command that outputs more than a screenful (like `seq 100`). After paging to the end (with the spacebar), try to type another command (like `echo foo`). The terminal appears to hang until killed. (Actually, the inferior process is still running and receiving your input, but the term buffer displays no further output. You can force it to dump some output with C-c M-x term-continue subjob, but it goes back to being hung after.) I hacked up this little elisp function to demonstrate the bug: ``` (defun test-bug () "demonstrate bug" (interactive) (progn (term "/bin/bash") (sit-for 2) (term-pager-enable) (term-send-raw-string "seq 50\n") (sit-for 2) (term-pager-page 50) (term-send-raw-string "echo foo\n") (sit-for 2) (term-line-mode) (move-beginning-of-line nil) (forward-line -1) (let ((code (if (= (string-to-char "f") (char-after)) 0 1))) (kill-emacs code) ;;(message "answer: %d" code) ) ) ) (test-bug) ``` Then, I wrote this little bash script for use in `git bisect`: ``` #!/bin/bash set -euxo pipefail date git clean -dxf ./autogen.sh || exit 125 ./configure --with-x=no --without-makeinfo --with-gnutls=yes || exit 125 make -j4 || exit 125 exec src/emacs -Q -l ../bisect.el ``` The bisect was a bit rougher than I expected, for three reasons: (1) my dumb elisp has some kind of race condition, and sometimes will neither pass nor fail but hang waiting for further input; (2) the repo's autogen/autotools/Makefile don't seem to agree with `git checkout` about timestamps, so I had pretty much had to do a clean build rather than an incremental build at each step; (3) several commits in the vicinity of the First Bad Commit have builds which are broken without gnutls. However, I was eventually able to get this output as the First Bad Commit: 9755b75300b7c451bc79984eed2e346ce0a4ffb5 is the first bad commit commit 9755b75300b7c451bc79984eed2e346ce0a4ffb5 Author: Lars Ingebrigtsen Date: Tue Feb 16 13:37:33 2016 +1100 Allow setting the filter masks later * src/process.c (Fset_process_filter): Don't set the socket masks here, because we may not have a socket yet. (set_process_filter_masks): New function. (connect_network_socket): Set the filter masks here. I hope that this is helpful in tracking down the bug. Please let me know if any further details are required. Thanks, --Adam --000000000000da4110058d5c8f1f Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hel=
lo,=20

Recently I learned about the pager-mode built into M-x term. I tried
it with some excitement, but discovered that, while it works fine in
emacs 24, it seems completely broken in emacs 25-26.

To reproduce, simply open a terminal (M-x term); enable the pager (C-c
C-q); and run any command that outputs more than a screenful (like
`seq 100`). After paging to the end (with the spacebar), try to type
another command (like `echo foo`). The terminal appears to hang until
killed. (Actually, the inferior process is still running and receiving
your input, but the term buffer displays no further output. You can
force it to dump some output with C-c M-x term-continue subjob, but it
goes back to being hung after.)

I hacked up this little elisp function to demonstrate the bug:


```
(defun test-bug () "demonstrate bug" (interactive)
  (progn
    (term "/bin/bash")
    (sit-for 2)
    (term-pager-enable)
    (term-send-raw-string "seq 50\n")
    (sit-for 2)
    (term-pager-page 50)
    (term-send-raw-string "echo foo\n")
    (sit-for 2)
    (term-line-mode)
    (move-beginning-of-line nil)
    (forward-line -1)
    (let ((code  (if (=3D (string-to-char "f") (char-after)) 0 1)=
))
      (kill-emacs code)
      ;;(message "answer: %d" code)
      )
    )
  )
(test-bug)
```

Then, I wrote this little bash script for use in `git bisect`:

```
#!/bin/bash
set -euxo pipefail
date
git clean -dxf
./autogen.sh || exit 125
./configure --with-x=3Dno --without-makeinfo --with-gnutls=3Dyes || exit 12=
5
make -j4 || exit 125
exec src/emacs -Q -l ../bisect.el
```

The bisect was a bit rougher than I expected, for three reasons: (1)
my dumb elisp has some kind of race condition, and sometimes will
neither pass nor fail but hang waiting for further input; (2) the
repo's autogen/autotools/Makefile don't seem to agree with `git
checkout` about timestamps, so I had pretty much had to do a clean
build rather than an incremental build at each step; (3) several
commits in the vicinity of the First Bad Commit have builds which are
broken without gnutls.

However, I was eventually able to get this output as the First Bad
Commit:

9755b75300b7c451bc79984eed2e346ce0a4ffb5 is the first bad commit
commit 9755b75300b7c451bc79984eed2e346ce0a4ffb5
Author: Lars Ingebrigtsen <larsi@gnus.=
org>
Date:   Tue Feb 16 13:37:33 2016 +1100

    Allow setting the filter masks later
    * src/process.c (Fset_process_filter): Don't set the socket
    masks here, because we may not have a socket yet.
    (set_process_filter_masks): New function.
    (connect_network_socket): Set the filter masks here.

=20
I hope that this is helpful in tracking down the bug. 
Please let me know if any further details are required=
.
Thanks,
--Adam 
--000000000000da4110058d5c8f1f--