From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Shawn Presser Newsgroups: gmane.emacs.bugs Subject: bug#34123: A patch to fix reading EOF characters in non-interactive mode Date: Sat, 19 Jan 2019 19:22:06 -0600 Message-ID: References: <8336pqcd3l.fsf@gnu.org> <831s5ac5qy.fsf@gnu.org> <83zhryaq09.fsf@gnu.org> NNTP-Posting-Host: ciao.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="00000000000077f71b057fd98f8d" X-Trace: ciao.gmane.org 1547947332 226147 195.159.176.228 (20 Jan 2019 01:22:12 GMT) X-Complaints-To: usenet@ciao.gmane.org NNTP-Posting-Date: Sun, 20 Jan 2019 01:22:12 +0000 (UTC) Cc: 34123@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jan 20 02:22:10 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1gl1oM-000woi-1f for geb-bug-gnu-emacs@m.gmane.org; Sun, 20 Jan 2019 02:22:06 +0100 Original-Received: from localhost ([127.0.0.1]:33797 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gl1oV-0000N3-4G for geb-bug-gnu-emacs@m.gmane.org; Sat, 19 Jan 2019 20:22:15 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:44205) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gl1oM-0000M3-Jx for bug-gnu-emacs@gnu.org; Sat, 19 Jan 2019 20:22:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gl1oK-0002OJ-PZ for bug-gnu-emacs@gnu.org; Sat, 19 Jan 2019 20:22:06 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:38903) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gl1oH-0002N0-S7 for bug-gnu-emacs@gnu.org; Sat, 19 Jan 2019 20:22:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gl1oH-0001hw-Jg for bug-gnu-emacs@gnu.org; Sat, 19 Jan 2019 20:22:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Shawn Presser Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 20 Jan 2019 01:22:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 34123 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 34123-submit@debbugs.gnu.org id=B34123.15479472856520 (code B ref 34123); Sun, 20 Jan 2019 01:22:01 +0000 Original-Received: (at 34123) by debbugs.gnu.org; 20 Jan 2019 01:21:25 +0000 Original-Received: from localhost ([127.0.0.1]:38184 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gl1ng-0001h6-MU for submit@debbugs.gnu.org; Sat, 19 Jan 2019 20:21:24 -0500 Original-Received: from mail-lj1-f181.google.com ([209.85.208.181]:41036) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gl1nd-0001gr-Ps for 34123@debbugs.gnu.org; Sat, 19 Jan 2019 20:21:22 -0500 Original-Received: by mail-lj1-f181.google.com with SMTP id k15-v6so14659059ljc.8 for <34123@debbugs.gnu.org>; Sat, 19 Jan 2019 17:21:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=t1H6NNJeN6tcxPn7ZG98Sqkl6sTAQyWfOwJT8Dj/84k=; b=F6duZRYz1KlKTU7qdyyqOjIk+XOGgeq7QBV3UfhTWOglHVp8Dz/9xeXM6KzePl2LSy eHKtVWs8UvjO741bBG8UCT1vDyc08AcR9eD1xMsMKDhmsjXtUzXt7r3GqMGEtYPdAyWQ yfx3+cq/3P7Mvv6SjVvOJM/IBD3PDgbF8yKwJoDptYOKlS84cpPNcXRcEtD2z9B9lonT zA5Bq6Af0Y56NztiQ1Ox1wyIQEl/KoJorh78fclpb8iCA2peYTeZ3Zu9Vo3Nb3hBWTmK Y4Fsot8GS4PcFheLGtqnxYEZU0WNnuZhxzNWVRCn/r2SGuvibRMtQ1RvdbqcVDEYXifS 8avg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=t1H6NNJeN6tcxPn7ZG98Sqkl6sTAQyWfOwJT8Dj/84k=; b=MQRLZjsbBr31481anSmbRpUl2bQEvOnUd6C0WrvZmgeD6ZaTVwQyxCA4SPNyYaomQA p1CfXqaFHALus+Dlx7CC4d5/vXbBv8h277mVL6CCM6GBczAUu+Txv9AY+ygaQfgaP+5K iWmV6nV6gNQSo65x8amSTOLu8Ks9qWh0tEgDQV1WR7Ondvwi8cpEfi3hgeYEgh888tro 6OFmuH9YwfOhgAoeBUW4r/BaWG9i3IGVz+8bE9ZfTd2ipFmMLSveHK0FweWmt3q07HQb TgGV2bhJxq6+JJo48PF9g19mPENI68ZwrUGdqCiAehbDPQRz2vN+czUNv3ceL88GwE+h 0v+w== X-Gm-Message-State: AJcUukf91+UNKoxMMKKv8j395R/HVArjxYhC/VenJj+/7cz9fs+1NQnJ RNM6J3xsf5/OmqOwh3EaM6srzj+sE+p9DGL7CmM= X-Google-Smtp-Source: ALg8bN7Qoh6SI6QTj1dEkm8Ebdfh3GFqvPiew/7lurdMhci3CPBJ9YtDpooJ5VfHtLZh/znVlViFAxJavMsIFiLSV6k= X-Received: by 2002:a2e:8596:: with SMTP id b22-v6mr15106982lji.122.1547947275186; Sat, 19 Jan 2019 17:21:15 -0800 (PST) In-Reply-To: <83zhryaq09.fsf@gnu.org> 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:154600 Archived-At: --00000000000077f71b057fd98f8d Content-Type: text/plain; charset="UTF-8" Is there another way I can address the concern here? I'm willing to put in the work to get this in. To put it more simply, it seems like an error that emacs doesn't call clearerr(stdin) after reading EOF. Without that, it's impossible to ever read from stdin after the first EOF. Should that be changed? On Fri, Jan 18, 2019 at 10:29 AM Eli Zaretskii wrote: > > From: Shawn Presser > > Date: Fri, 18 Jan 2019 10:20:54 -0600 > > Cc: 34123@debbugs.gnu.org > > > > It's non-interactive: > > > > arc> |noninteractive| > > t > > > > (The expression |noninteractive| in arcmacs is equivalent to evaluating > 'noninteractive in emacs lisp.) > > > > The runtimes start by invoking emacs using `emacs -Q --script ...`, so > it's always noninteractive. And in > > general for writing shell scripts rather than repls, it's important to > be in noninteractive mode. But it's equally > > important to have the ability to prompt the user from a shell script, > and for the user to be able to cancel by > > using ^D without causing stdin errors on all subsequent prompts. > > I think we are miscommunicating, since your usage involves Emacs > reading from the terminal. That is not noninteractive in my book. > What I mean by noninteractive is when stdin is not connected to a > terminal. Your proposed patch affects that case as well, doesn't it? > --00000000000077f71b057fd98f8d Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Is there another way I can address the concern here? I'= ;m willing to put in the work to get this in.

To put it = more simply, it seems like an error that emacs doesn't call clearerr(st= din) after reading EOF. Without that, it's impossible to ever read from= stdin after the first EOF. Should that be changed?

On Fri, Jan 18, 20= 19 at 10:29 AM Eli Zaretskii <eliz@gnu.o= rg> wrote:
shawnpresser@gmail.com>
> Date: Fri, 18 Jan 2019 10:20:54 -0600
> Cc: 34123@d= ebbugs.gnu.org
>
> It's non-interactive:
>
> arc> |noninteractive|
> t
>
> (The expression |noninteractive| in arcmacs is equivalent to evaluatin= g 'noninteractive in emacs lisp.)
>
> The runtimes start by invoking emacs using `emacs -Q --script ...`, so= it's always noninteractive. And in
> general for writing shell scripts rather than repls, it's importan= t to be in noninteractive mode. But it's equally
> important to have the ability to prompt the user from a shell script, = and for the user to be able to cancel by
> using ^D without causing stdin errors on all subsequent prompts.

I think we are miscommunicating, since your usage involves Emacs
reading from the terminal.=C2=A0 That is not noninteractive in my book.
What I mean by noninteractive is when stdin is not connected to a
terminal.=C2=A0 Your proposed patch affects that case as well, doesn't = it?
--00000000000077f71b057fd98f8d--