From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: "Jose A. Ortega Ruiz" Newsgroups: gmane.lisp.guile.bugs Subject: bug#33403: [Geiser-users] bug#33403: Data length limit in Guile/Geiser/Scheme evaluation Date: Sat, 17 Nov 2018 14:59:24 +0000 Message-ID: <87ftvzwy0j.fsf__15616.2301464521$1542466742$gmane$org@imladris> References: <87sh021kw2.fsf@ossau.homelinux.net> <878t1ugyf9.fsf@nicolasgoaziou.fr> <87h8gi1g5g.fsf@ossau.homelinux.net> <871s7mz357.fsf@imladris> <87bm6q1c33.fsf@ossau.homelinux.net> <87o9aq55tl.fsf@ossau.homelinux.net> <87d0r5349t.fsf@netris.org> <87y39t1olc.fsf@netris.org> <878t1t1ety.fsf@ossau.homelinux.net> <875zwx1dcn.fsf@ossau.homelinux.net> <87va4wwra7.fsf@imladris> <87zhu8w55u.fsf@netris.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1542466742 19535 195.159.176.226 (17 Nov 2018 14:59:02 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 17 Nov 2018 14:59:02 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1.90 (gnu/linux) Cc: geiser-users@nongnu.org, Neil Jerram , emacs-orgmode@gnu.org, 33403@debbugs.gnu.org To: Mark H Weaver Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Sat Nov 17 15:58:57 2018 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gO23k-0004yS-Oj for guile-bugs@m.gmane.org; Sat, 17 Nov 2018 15:58:56 +0100 Original-Received: from localhost ([::1]:49579 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gO25r-0007Li-5w for guile-bugs@m.gmane.org; Sat, 17 Nov 2018 10:01:07 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34849) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gO24s-0006t2-Hr for bug-guile@gnu.org; Sat, 17 Nov 2018 10:00:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gO24o-00018q-F9 for bug-guile@gnu.org; Sat, 17 Nov 2018 10:00:06 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:53827) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gO24o-00017j-Bi for bug-guile@gnu.org; Sat, 17 Nov 2018 10:00:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gO24o-0003WG-5f for bug-guile@gnu.org; Sat, 17 Nov 2018 10:00:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: "Jose A. Ortega Ruiz" Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Sat, 17 Nov 2018 15:00:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 33403 X-GNU-PR-Package: guile X-GNU-PR-Keywords: notabug Original-Received: via spool by 33403-submit@debbugs.gnu.org id=B33403.154246677513465 (code B ref 33403); Sat, 17 Nov 2018 15:00:02 +0000 Original-Received: (at 33403) by debbugs.gnu.org; 17 Nov 2018 14:59:35 +0000 Original-Received: from localhost ([127.0.0.1]:58085 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gO24N-0003V7-9Y for submit@debbugs.gnu.org; Sat, 17 Nov 2018 09:59:35 -0500 Original-Received: from mail-wm1-f49.google.com ([209.85.128.49]:51729) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gO24L-0003Ur-HR for 33403@debbugs.gnu.org; Sat, 17 Nov 2018 09:59:34 -0500 Original-Received: by mail-wm1-f49.google.com with SMTP id w7-v6so1266762wmc.1 for <33403@debbugs.gnu.org>; Sat, 17 Nov 2018 06:59:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version; bh=CtPwul6quOSYChVRyZkwcHNveNu3jk5xCxgkdctUWW0=; b=ara6E8ceXNXtCRI/fCmIHGKdOsS1pgeL2inlO3pkGhP5tmu3DR1A1IRyUy7mNPiL7v 1+TgLKFvIqLYxvdL1Ml7NIBDcK/CxuLcUMwc3cOEmwiMN126YDKJoXoBA+nZLXF6GfKi uPwtmoAHWWHvmTzDDheDESD+ArAwL14OWj759ZQ8x+nxrwbj5A7QwuGaUTZBgm6A8xJz k641vl9vLRvN2RaLb6tE1aTT8Z+Pugpj89VMNDLamonWaip5ZHRdcIuSQmPQ+IMyHlxf snsOZxoF1WV5C3T5xUv+ic46rDEUWRMNZ5au/YlhColmf9G1d1fTGqzS/g0emKlsgVRN qzPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:in-reply-to:references :user-agent:date:message-id:mime-version; bh=CtPwul6quOSYChVRyZkwcHNveNu3jk5xCxgkdctUWW0=; b=VfS6EJIuqpwvL12Rsz65TVqw4SCuZ2AZjudlbG8Nk/kbsm3RPI1RkDptgCp0lmtsUV n2D5WetvLjqte0oEWGRJnsgVS865MlRtRh3Rov2oLmI9BIOm8Tcko+V+yxhNOVFWgRQo S8MiDO4+02HXk/S8mJHUFSaCHGWGsONlMywQCqdoP7d9QVipqQIi4OC1eMNoRGshCjap VzMwewRC62i7HGzYmnG6Tlo/DBJQg2snbWNbZZvvCkhjLXiwjZYqdIIFM09bpdcY7dX4 KlMa6uPzo+V2ZAZGHEUEaY3iqk9A6Nr6Ag2UEstulOXAfYz2ThbR9d3UoINp5Ql4dCMp NGDw== X-Gm-Message-State: AGRZ1gKgxKRmTMU14eqaaMAbFiu8iNqe84k7yydw7ZWKImkKuLMPVGmh ALcFMLanl9i4RX5duYccuRIBcFY9fCU= X-Google-Smtp-Source: AJdET5e6GNvs9hksEdqHQVUC7GKSn+JYQNC3f4LBncmWdfwBnlrqBJpATs8omjSdfndSaplZ4zgDOA== X-Received: by 2002:a1c:bc82:: with SMTP id m124-v6mr1729197wmf.47.1542466767008; Sat, 17 Nov 2018 06:59:27 -0800 (PST) Original-Received: from imladris.local (cpc103058-sgyl39-2-0-cust254.18-2.cable.virginm.net. [94.173.216.255]) by smtp.gmail.com with ESMTPSA id e66-v6sm52833715wmf.40.2018.11.17.06.59.25 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 17 Nov 2018 06:59:26 -0800 (PST) Original-Received: from imladris (localhost [127.0.0.1]) by imladris.local (Postfix) with ESMTPS id C9D9E321BC9; Sat, 17 Nov 2018 15:59:24 +0100 (CET) In-Reply-To: <87zhu8w55u.fsf@netris.org> (Mark H. Weaver's message of "Sat, 17 Nov 2018 02:09:54 -0500") X-Attribution: jao X-Clacks-Overhead: GNU Terry Pratchett X-URL: 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: 208.118.235.43 X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Original-Sender: "bug-guile" Xref: news.gmane.org gmane.lisp.guile.bugs:9277 Archived-At: On Sat, Nov 17 2018, Mark H Weaver wrote: [...] >> Ah, system* is a scheme call! So yeah, maybe we could add that call to >> Geiser's guile initialization... i don't really see how that would cause >> any problem elsewhere. > > I think something like this should be done, not only in the Guile > initialization, but ideally in the generic Geiser code that connects to > inferior processes via pseudo-tty. After the pseudo-tty is allocated > but before launching the inferior Scheme process, something like "stty > --file=/dev/pts/N -icanon" should be run. > > However, before doing this, some warnings are in order: > > When in noncanonical mode, the normal processing of ERASE (usually DEL > or Ctrl-H) and KILL (usually Ctrl-U) characters are disabled, and input > characters are delivered to the subprocess immediately as they are > typed, rather than waiting for the newline as normally happens in > canonical mode. > > At least in the case of the Guile REPL, one notable side effect of > running in noncanonical mode is that when a list is entered at the REPL, > the 'read' returns as soon as the final close parenthesis is entered. > Nothing after that is read, not even the usual newline. The final > newline is only read if the reader is not yet sure that it has finished > reading the token, e.g. if a number or symbol is entered. In those > cases, typically any delimiter may be typed to terminate the read, > e.g. space. > > To see this, you can try running Guile from a traditional terminal > program (e.g. xterm or GNOME Terminal), and type: > > (system* "stty" "-icanon") > > and then: > > (display "hello") > > You will see that as soon as you type that close paren, "hello" is > immediately printed, followed by another REPL prompt, all on the same > line. I think this is not an actual problem in Geiser. In comint mode, the stdin of the Guile process doesn't receive any input bytes until higher level elisp functions send them, and that's totally under our control. Repeating that experiment in a Geiser REPL, nothing is printed before a RET (and, in fact, we might not even send the RET to Guile). > > You might also try (use-modules (ice-9 rdelim)) and then: > > (read-line) > > and you'll see that the newline you type at the end of that line is read > by 'read-line', which then immediately returns the empty string. The > input that you wish for 'read-line' to see must be typed on the same > line, immediately after the close parenthesis. Again, a comint/geiser REPL doesn't have this problem. > So, it might be that Geiser needs to be adjusted somewhat to deal with > these differences. Seems we're lucky enough to be already adjusted :) > Finally, you might consider the possibility that 'stty' might not be > available in PATH, or fails for some reason, and ideally this case > should be handled as well. Yes, that's a real concern. We should at least provide some kind of warning. > It might be simpler to always use REPL servers over a socket, than to > deal with these headaches, although I don't know if that will be an > option for the other Scheme implementations. Not for all of them. For Guile it's doable, but definitely not "simpler", it requires some work and solving some unrelated corner cases; but it might be worth the effort, because it's a cleaner interaction mode (for instance, behaves much better in the presence of multiple threads). Cheers, jao -- Beware of the stories you read or tell; subtly, at night, beneath the waters of consciousness, they are altering your world. -Ben Okri, poet and novelist