From unknown Sat Aug 16 16:15:20 2025 X-Loop: help-debbugs@gnu.org Subject: bug#6800: 23.1; EOT / ^D inserted into comint input string Resent-From: David Fox Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 05 Aug 2010 15:14:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 6800 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 6800@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.128102121812095 (code B ref -1); Thu, 05 Aug 2010 15:14:02 +0000 Received: (at submit) by debbugs.gnu.org; 5 Aug 2010 15:13:38 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oh28Y-000392-9O for submit@debbugs.gnu.org; Thu, 05 Aug 2010 11:13:38 -0400 Received: from mail.gnu.org ([199.232.76.166] helo=mx10.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oh1zZ-000357-Ty for submit@debbugs.gnu.org; Thu, 05 Aug 2010 11:04:22 -0400 Received: from lists.gnu.org ([199.232.76.165]:53041) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Oh204-0001ga-Nt for submit@debbugs.gnu.org; Thu, 05 Aug 2010 11:04:52 -0400 Received: from [140.186.70.92] (port=51143 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Oh1zp-00022N-M8 for bug-gnu-emacs@gnu.org; Thu, 05 Aug 2010 11:04:52 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, HTML_MESSAGE, T_DKIM_INVALID, T_TO_NO_BRKTS_FREEMAIL autolearn=unavailable version=3.3.1 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Oh1zd-0002zx-LA for bug-gnu-emacs@gnu.org; Thu, 05 Aug 2010 11:04:37 -0400 Received: from mail-fx0-f41.google.com ([209.85.161.41]:39248) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oh1zd-0002z3-Gb for bug-gnu-emacs@gnu.org; Thu, 05 Aug 2010 11:04:25 -0400 Received: by fxm20 with SMTP id 20so3303888fxm.0 for ; Thu, 05 Aug 2010 08:04:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:content-type; bh=IssDqXJL+zfQGJHUQuAx1RySBsjRisP4ToN5OIrZIT4=; b=Q5ejkh8avdZ+Y115UwmdWO3wq3Rin3Fw+3AVkXA6MB16DI0fdFyswh3OOBkCN/CQd6 0XWMOwf4TOaFq76Bq6xTtvAQVrucd2bekckqdUZbjSQBtdut5h8trnMIzvSKQ1sXt+mG Ay0dGSnbAGwjd3tguzEWQgQyfNY58JEYtJ/S8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=Ze/K9pMYLDxFvrRFrx3qxQfNMcWdHiE27w7YWAUlpf51TShIJ0n9ewWgidORGYqAqG 740r0hUVQWnIkZtH7c3ojjxmv0b6TtDbE1bvW8BGD3LWqfyKxjcybJFgtr47TTb7WS2t s649K1Zxy+gsgNzT0zH1lS/i5mV/vm6BY5kDo= MIME-Version: 1.0 Received: by 10.204.160.146 with SMTP id n18mr7354084bkx.116.1281020293444; Thu, 05 Aug 2010 07:58:13 -0700 (PDT) Received: by 10.204.50.14 with HTTP; Thu, 5 Aug 2010 07:58:13 -0700 (PDT) Date: Thu, 5 Aug 2010 07:58:13 -0700 Message-ID: From: David Fox Content-Type: multipart/alternative; boundary=0015175cd4508a730f048d14c715 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -4.4 (----) X-Mailman-Approved-At: Thu, 05 Aug 2010 11:13:37 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.2 (-----) --0015175cd4508a730f048d14c715 Content-Type: text/plain; charset=UTF-8 When an input longer than 255 characters is typed into comint (or shell) an EOT character (ascii 4, ^D) is inserted into the string. This can cause an error depending how the sub process handles these extra characters. For example, GHC doesn't like it when an EOT appears inside of a string: ghci > Prelude> putStrLn "" works fine, but > Prelude> putStrLn "" :1:255: lexical error at character '\EOT' I inserted a function to break up the input into comint-send-string to work around the problem: (require 'comint) (defun comint-send-string (process string) "Like `process-send-string', but also does extra bookkeeping for Comint mode." (if process (with-current-buffer (if (processp process) (process-buffer process) (get-buffer process)) (comint-snapshot-last-prompt)) (comint-snapshot-last-prompt)) (my-process-send-string process string)) ;; Break up the string so that we don't get EOT characters in our input stream. (defun my-process-send-string (process string) (if (> (length string) 200) (progn (process-send-string process (substring string 0 200)) (my-process-send-string process (substring string 200))) (process-send-string process string))) --0015175cd4508a730f048d14c715 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable When an input longer than 255 characters is typed into comint (or
shell)= an EOT character (ascii 4, ^D) is inserted into the string.
This can ca= use an error depending how the sub process handles these
extra character= s.=C2=A0 For example, GHC doesn't like it when an EOT
appears inside of a string:

=C2=A0ghci
=C2=A0> Prelude> put= StrLn "<a 241 character string>"
works fine, but
=C2= =A0> Prelude> putStrLn "<a 242 character string>"
= <interactive>:1:255: lexical error at character '\EOT'

I inserted a function to break up the input into comint-send-string to = work around the problem:

(require 'comint)

(defun comint-= send-string (process string)
=C2=A0 "Like `process-send-string'= , but also does extra bookkeeping for Comint mode."
=C2=A0 (if process
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (with-current-buffer (= if (processp process)
=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0= =C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (process-buffer process)
=C2= =A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2= =A0 (get-buffer process))
=C2=A0=C2=A0=C2=A0 (comint-snapshot-last-promp= t))
=C2=A0=C2=A0=C2=A0 (comint-snapshot-last-prompt))
=C2=A0 (my-process-send-string process string))

;; Break up the stri= ng so that we don't get EOT characters in our input stream.
(defun m= y-process-send-string (process string)
=C2=A0 (if (> (length string) = 200)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (progn (process-send-string process (substri= ng string 0 200)) (my-process-send-string process (substring string 200)))<= br>=C2=A0=C2=A0=C2=A0 (process-send-string process string)))=C2=A0=C2=A0=C2= =A0 =C2=A0=C2=A0=C2=A0=C2=A0

--0015175cd4508a730f048d14c715-- From unknown Sat Aug 16 16:15:20 2025 X-Loop: help-debbugs@gnu.org Subject: bug#6800: 23.1; EOT / ^D inserted into comint input string Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 11 Sep 2010 14:00:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6800 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: David Fox Cc: 6800@debbugs.gnu.org Received: via spool by 6800-submit@debbugs.gnu.org id=B6800.128421356410193 (code B ref 6800); Sat, 11 Sep 2010 14:00:03 +0000 Received: (at 6800) by debbugs.gnu.org; 11 Sep 2010 13:59:24 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OuQbz-0002eL-Nr for submit@debbugs.gnu.org; Sat, 11 Sep 2010 09:59:24 -0400 Received: from impaqm2.telefonica.net ([213.4.138.2]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OuQbx-0002e7-9K for 6800@debbugs.gnu.org; Sat, 11 Sep 2010 09:59:21 -0400 Received: from IMPmailhost5.adm.correo ([10.20.102.126]) by IMPaqm2.telefonica.net with bizsmtp id 5R1X1f01E2jdgqJ3MS15vl; Sat, 11 Sep 2010 16:01:05 +0200 Received: from ceviche.home ([83.61.39.212]) by IMPmailhost5.adm.correo with BIZ IMP id 5S151f0054aeRwb1lS15V5; Sat, 11 Sep 2010 16:01:05 +0200 X-Brightmail-Tracker: AAAAAA== X-TE-authinfo: authemail="monnier$movistar.es" |auth_email="monnier@movistar.es" X-TE-AcuTerraCos: auth_cuTerraCos="cosuitnetc01" Received: by ceviche.home (Postfix, from userid 20848) id 109F7660D2; Sat, 11 Sep 2010 16:01:05 +0200 (CEST) From: Stefan Monnier Message-ID: References: Date: Sat, 11 Sep 2010 16:01:05 +0200 In-Reply-To: (David Fox's message of "Thu, 5 Aug 2010 07:58:13 -0700") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.0 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.0 (--) > When an input longer than 255 characters is typed into comint (or > shell) an EOT character (ascii 4, ^D) is inserted into the string. > This can cause an error depending how the sub process handles these > extra characters. For example, GHC doesn't like it when an EOT > appears inside of a string: I believe this bug is fixed on the Emacs trunk (to become Emacs-24), but the fix may introduce other problems. Apparently nobody knows how to fix it right and there is about as much as no documentation at all on this part of the behavior of ttys. Stefan From unknown Sat Aug 16 16:15:20 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: David Fox Subject: bug#6800: closed (Re: bug#6800: 23.1; EOT / ^D inserted into comint input string) Message-ID: References: X-Gnu-PR-Message: they-closed 6800 X-Gnu-PR-Package: emacs Reply-To: 6800@debbugs.gnu.org Date: Fri, 12 Aug 2016 18:38:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1471027082-23916-1" This is a multi-part message in MIME format... ------------=_1471027082-23916-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #6800: 23.1; EOT / ^D inserted into comint input string which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 6800@debbugs.gnu.org. --=20 6800: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D6800 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1471027082-23916-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 6800-done) by debbugs.gnu.org; 12 Aug 2016 18:37:03 +0000 Received: from localhost ([127.0.0.1]:55395 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bYHKI-0006CY-Qu for submit@debbugs.gnu.org; Fri, 12 Aug 2016 14:37:02 -0400 Received: from mail-wm0-f49.google.com ([74.125.82.49]:35155) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bYHKF-0006C3-2s for 6800-done@debbugs.gnu.org; Fri, 12 Aug 2016 14:37:01 -0400 Received: by mail-wm0-f49.google.com with SMTP id f65so42163218wmi.0 for <6800-done@debbugs.gnu.org>; Fri, 12 Aug 2016 11:36:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=Xmes4V3fxNS3ZT0lM0BoggFLwQ/X6JHtTbV0ssszB2g=; b=OHyjTApWI0eC/PPojZLp+SEwbkWexHiM6WLgczL8AGwzkznGB0k5EqFvI8u/UNIROh PPRBAlznHQ6pznIeDvphC4ezEexIT9G453BaiH6dadSpUYojc6v+4hvqwnLJFyzjK+RC lEAYPLWK7gR9v/nOQtp5AnZOsAGWLZSEFccStmyeaX0g+g4Czn6ZbLvcu8hnr8l8hP36 wIvcNZ/9gRHtD1U7UjZaFUd8svX6QrczsdaF77IZV9ggpT8EBHOpfDTAGl7aB2qcOuFO 8/Ctoo5gksbO61Cd/AJB2iFbjetNMefZU9roeRzRKdidov7JYNkZy0qbDVRp61M0G2jq oDvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=Xmes4V3fxNS3ZT0lM0BoggFLwQ/X6JHtTbV0ssszB2g=; b=TZmAee47FywjZrj+fMLZzUvI+IedrgHm6lcN7pHygrZLMrhWiO405Ab5Bex1bF16vN cyfxLrfsWP/tswi3JZRW65JwG2SaZWBjQwLN/DA43QEXs9r+6sGAJ8O0kxpsR1wuEJQL sOZ1pT/lDrnyuRynR1Cp47nP2Qgfag7NWoxkuxvbYAfBxVAiC4CCFkqlFt0nd2KygRMX AKv4tS+F+mQq0FdRKX7qwa+c3jW8oae6Yn+ZlnCLk2Hkv97MMu3VCQQdT2MWG9Y5xyEU MqUfjdgItgyxDAZKO3oWxx2r40ahMrKB2pLmrQ0XRk28sQwZB6JlvfZuvwIzSYPAQNj6 B8Kw== X-Gm-Message-State: AEkoouu7Ql3HvOnVxkH7pYvCNkpT5BtyOCzXKeZlpAclwlpM482OQo7kN05obBBvUi52Lg== X-Received: by 10.28.31.147 with SMTP id f141mr235068wmf.69.1471027013483; Fri, 12 Aug 2016 11:36:53 -0700 (PDT) Received: from breton.holly.idiocy.org (ip6-2001-08b0-03f8-8129-c9b0-c9dd-8aa4-da55.holly.idiocy.org. [2001:8b0:3f8:8129:c9b0:c9dd:8aa4:da55]) by smtp.gmail.com with ESMTPSA id b203sm3672839wmh.20.2016.08.12.11.36.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Aug 2016 11:36:53 -0700 (PDT) From: Alan Third To: Stefan Monnier Subject: Re: bug#6800: 23.1; EOT / ^D inserted into comint input string References: Date: Fri, 12 Aug 2016 19:36:52 +0100 In-Reply-To: (Stefan Monnier's message of "Sat, 11 Sep 2010 16:01:05 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (darwin) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 6800-done Cc: 6800-done@debbugs.gnu.org, David Fox X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) Stefan Monnier writes: >> When an input longer than 255 characters is typed into comint (or >> shell) an EOT character (ascii 4, ^D) is inserted into the string. >> This can cause an error depending how the sub process handles these >> extra characters. For example, GHC doesn't like it when an EOT >> appears inside of a string: > > I believe this bug is fixed on the Emacs trunk (to become Emacs-24), but > the fix may introduce other problems. Apparently nobody knows how to > fix it right and there is about as much as no documentation at all on > this part of the behavior of ttys. IIRC this code is no longer in Emacs. I'll close this bug. -- Alan Third ------------=_1471027082-23916-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 5 Aug 2010 15:13:38 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oh28Y-000392-9O for submit@debbugs.gnu.org; Thu, 05 Aug 2010 11:13:38 -0400 Received: from mail.gnu.org ([199.232.76.166] helo=mx10.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oh1zZ-000357-Ty for submit@debbugs.gnu.org; Thu, 05 Aug 2010 11:04:22 -0400 Received: from lists.gnu.org ([199.232.76.165]:53041) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Oh204-0001ga-Nt for submit@debbugs.gnu.org; Thu, 05 Aug 2010 11:04:52 -0400 Received: from [140.186.70.92] (port=51143 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Oh1zp-00022N-M8 for bug-gnu-emacs@gnu.org; Thu, 05 Aug 2010 11:04:52 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, HTML_MESSAGE, T_DKIM_INVALID, T_TO_NO_BRKTS_FREEMAIL autolearn=unavailable version=3.3.1 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Oh1zd-0002zx-LA for bug-gnu-emacs@gnu.org; Thu, 05 Aug 2010 11:04:37 -0400 Received: from mail-fx0-f41.google.com ([209.85.161.41]:39248) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oh1zd-0002z3-Gb for bug-gnu-emacs@gnu.org; Thu, 05 Aug 2010 11:04:25 -0400 Received: by fxm20 with SMTP id 20so3303888fxm.0 for ; Thu, 05 Aug 2010 08:04:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:content-type; bh=IssDqXJL+zfQGJHUQuAx1RySBsjRisP4ToN5OIrZIT4=; b=Q5ejkh8avdZ+Y115UwmdWO3wq3Rin3Fw+3AVkXA6MB16DI0fdFyswh3OOBkCN/CQd6 0XWMOwf4TOaFq76Bq6xTtvAQVrucd2bekckqdUZbjSQBtdut5h8trnMIzvSKQ1sXt+mG Ay0dGSnbAGwjd3tguzEWQgQyfNY58JEYtJ/S8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=Ze/K9pMYLDxFvrRFrx3qxQfNMcWdHiE27w7YWAUlpf51TShIJ0n9ewWgidORGYqAqG 740r0hUVQWnIkZtH7c3ojjxmv0b6TtDbE1bvW8BGD3LWqfyKxjcybJFgtr47TTb7WS2t s649K1Zxy+gsgNzT0zH1lS/i5mV/vm6BY5kDo= MIME-Version: 1.0 Received: by 10.204.160.146 with SMTP id n18mr7354084bkx.116.1281020293444; Thu, 05 Aug 2010 07:58:13 -0700 (PDT) Received: by 10.204.50.14 with HTTP; Thu, 5 Aug 2010 07:58:13 -0700 (PDT) Date: Thu, 5 Aug 2010 07:58:13 -0700 Message-ID: Subject: 23.1; EOT / ^D inserted into comint input string From: David Fox To: bug-gnu-emacs@gnu.org Content-Type: multipart/alternative; boundary=0015175cd4508a730f048d14c715 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -4.4 (----) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Thu, 05 Aug 2010 11:13:37 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.2 (-----) --0015175cd4508a730f048d14c715 Content-Type: text/plain; charset=UTF-8 When an input longer than 255 characters is typed into comint (or shell) an EOT character (ascii 4, ^D) is inserted into the string. This can cause an error depending how the sub process handles these extra characters. For example, GHC doesn't like it when an EOT appears inside of a string: ghci > Prelude> putStrLn "
" works fine, but > Prelude> putStrLn "" :1:255: lexical error at character '\EOT' I inserted a function to break up the input into comint-send-string to work around the problem: (require 'comint) (defun comint-send-string (process string) "Like `process-send-string', but also does extra bookkeeping for Comint mode." (if process (with-current-buffer (if (processp process) (process-buffer process) (get-buffer process)) (comint-snapshot-last-prompt)) (comint-snapshot-last-prompt)) (my-process-send-string process string)) ;; Break up the string so that we don't get EOT characters in our input stream. (defun my-process-send-string (process string) (if (> (length string) 200) (progn (process-send-string process (substring string 0 200)) (my-process-send-string process (substring string 200))) (process-send-string process string))) --0015175cd4508a730f048d14c715 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable When an input longer than 255 characters is typed into comint (or
shell)= an EOT character (ascii 4, ^D) is inserted into the string.
This can ca= use an error depending how the sub process handles these
extra character= s.=C2=A0 For example, GHC doesn't like it when an EOT
appears inside of a string:

=C2=A0ghci
=C2=A0> Prelude> put= StrLn "<a 241 character string>"
works fine, but
=C2= =A0> Prelude> putStrLn "<a 242 character string>"
= <interactive>:1:255: lexical error at character '\EOT'

I inserted a function to break up the input into comint-send-string to = work around the problem:

(require 'comint)

(defun comint-= send-string (process string)
=C2=A0 "Like `process-send-string'= , but also does extra bookkeeping for Comint mode."
=C2=A0 (if process
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (with-current-buffer (= if (processp process)
=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0= =C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (process-buffer process)
=C2= =A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2= =A0 (get-buffer process))
=C2=A0=C2=A0=C2=A0 (comint-snapshot-last-promp= t))
=C2=A0=C2=A0=C2=A0 (comint-snapshot-last-prompt))
=C2=A0 (my-process-send-string process string))

;; Break up the stri= ng so that we don't get EOT characters in our input stream.
(defun m= y-process-send-string (process string)
=C2=A0 (if (> (length string) = 200)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (progn (process-send-string process (substri= ng string 0 200)) (my-process-send-string process (substring string 200)))<= br>=C2=A0=C2=A0=C2=A0 (process-send-string process string)))=C2=A0=C2=A0=C2= =A0 =C2=A0=C2=A0=C2=A0=C2=A0

--0015175cd4508a730f048d14c715-- ------------=_1471027082-23916-1-- From unknown Sat Aug 16 16:15:20 2025 X-Loop: help-debbugs@gnu.org Subject: bug#6800: 23.1; EOT / ^D inserted into comint input string Resent-From: Alan Third Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 12 Aug 2016 18:44:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6800 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: David Fox Cc: 6800@debbugs.gnu.org, Stefan Monnier Received: via spool by 6800-submit@debbugs.gnu.org id=B6800.147102741224453 (code B ref 6800); Fri, 12 Aug 2016 18:44:02 +0000 Received: (at 6800) by debbugs.gnu.org; 12 Aug 2016 18:43:32 +0000 Received: from localhost ([127.0.0.1]:55413 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bYHQZ-0006MK-TM for submit@debbugs.gnu.org; Fri, 12 Aug 2016 14:43:32 -0400 Received: from mail-wm0-f44.google.com ([74.125.82.44]:37655) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bYHQY-0006M9-Rr for 6800@debbugs.gnu.org; Fri, 12 Aug 2016 14:43:31 -0400 Received: by mail-wm0-f44.google.com with SMTP id i5so51508509wmg.0 for <6800@debbugs.gnu.org>; Fri, 12 Aug 2016 11:43:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=9zXs3MNPFec4qEqosczgOtdDBChfvGpNKYjl7VoZlXk=; b=oxXk/RrMkPz7qDLWsf1F+cfKEr3XcfoEiJSZHriWIET/WbJDt5kVS/ReNm7uB+WzZu pnff1dloA3T4FZYoMuT7dwCYckz/ppweTaxI4vtDxNjtsbHTq86AfjhXIMXLmm1/zT+L aj5cV+v+ljAaUnDz1/dGUjRZfkb+LkhAi+X4XhbGptByC9Zf8c/4n1ho8Kx6sgPF1boF 4zmgYLWYyn7GNFRxqF7cYbhM8VV6vMduc/iV9nufZ1/NThrhe9/e7eRd+LBpMNHPqLuH Kh5YKRsCHQEjqvCLmeraDWOZ40nwj5x9XlwSXqE3/UsDtE9fUFd0rTjA94yLlQJg9UeZ r9Jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=9zXs3MNPFec4qEqosczgOtdDBChfvGpNKYjl7VoZlXk=; b=YqSE78dbVJz9lC4ZLngWTf5xFGRX4+gcIuzzIhgTXafg9S/aom9MtYjSBaR3URo/8R ug8g4cR+EhHpk1/72lXFQaEihViKDWfK+jRt0FGjWsniacqbkpa1/Y4egPLdfsZuUvlZ L/gX/nwoNe/9cvO9q4+sGypxB9KTNA5FCRLyFQZdFptyDQH8LObEFh2pCISdfNYJiHr5 23ilTv9jdRaApsGMTZGTbwThL2R8jl+xNu5LgkXcFaa3LX7odVYPRozb3n3e3wlMv9QC bMsLoOPc6FocddSAMplDg36uT58RxTyBi3dMzdS/YN0lWwGME47MdnbmaAKD4eXJukgZ yylw== X-Gm-Message-State: AEkoousaIsaLegln//IS928msoQ5WCMG/0YrR9FafpiFjMLw8vCFn7fEScPtmZlGUgUuKQ== X-Received: by 10.194.184.39 with SMTP id er7mr16971770wjc.159.1471027405207; Fri, 12 Aug 2016 11:43:25 -0700 (PDT) Received: from breton.holly.idiocy.org (ip6-2001-08b0-03f8-8129-c9b0-c9dd-8aa4-da55.holly.idiocy.org. [2001:8b0:3f8:8129:c9b0:c9dd:8aa4:da55]) by smtp.gmail.com with ESMTPSA id qe2sm8663646wjc.28.2016.08.12.11.43.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Aug 2016 11:43:24 -0700 (PDT) Date: Fri, 12 Aug 2016 19:43:22 +0100 From: Alan Third Message-ID: <20160812184322.GA19366@breton.holly.idiocy.org> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) On Fri, Aug 12, 2016 at 11:40:03AM -0700, David Fox wrote: > On Fri, Aug 12, 2016 at 11:36 AM, Alan Third wrote: > > > Stefan Monnier writes: > > > > >> When an input longer than 255 characters is typed into comint (or > > >> shell) an EOT character (ascii 4, ^D) is inserted into the string. > > >> This can cause an error depending how the sub process handles these > > >> extra characters. For example, GHC doesn't like it when an EOT > > >> appears inside of a string: > > > > > > I believe this bug is fixed on the Emacs trunk (to become Emacs-24), but > > > the fix may introduce other problems. Apparently nobody knows how to > > > fix it right and there is about as much as no documentation at all on > > > this part of the behavior of ttys. > > > > IIRC this code is no longer in Emacs. I'll close this bug. > > > > > > I do know that commands longer than 4096 characters are truncated in emacs > 24.3.1 I just looked at bug#7078 which talks about that. Perhaps these two should be merged. -- Alan Third From debbugs-submit-bounces@debbugs.gnu.org Fri Aug 12 14:45:21 2016 Received: (at control) by debbugs.gnu.org; 12 Aug 2016 18:45:21 +0000 Received: from localhost ([127.0.0.1]:55423 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bYHSL-0006QK-FB for submit@debbugs.gnu.org; Fri, 12 Aug 2016 14:45:21 -0400 Received: from mail-wm0-f45.google.com ([74.125.82.45]:36036) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bYHSJ-0006Q6-U1 for control@debbugs.gnu.org; Fri, 12 Aug 2016 14:45:20 -0400 Received: by mail-wm0-f45.google.com with SMTP id q128so43078029wma.1 for ; Fri, 12 Aug 2016 11:45:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=sender:date:message-id:to:from:subject; bh=YBo+yUiRjlkdQBuDgqanTGAInhkDuDeP+WVWLlGdAyA=; b=Ylg/KloXb+nkzBbg3DVSoKoBHh4ZMs0d9O2GPpcB1lyse/KwILDBzd/VTHyFS0+R2Y DAJwwQEV2YhCMyztMcvefD4RGRdHKHBHBdu1SJiUKDt3iN4Su7795te8oOgw1UOzvP92 u5yq/x+c+dSQjiL6ua7Gs3O4Erz5+3Z+oxiL2ltv+LjjAOojGGlrg7Bx/XuwqDJu3AgD O7ypq67iiy/SyDwmm170qeR6c+eiW5Q+Ly5xYi0Rt+XOv4fH6yGfFIivIRrl2tdTjkJq +86/D4ZhOkSwmzRq1Xk2RUmzjA1Cj3xkjyphNnvRXWImxF/q9K7AqB+0cg7AVM4ezgBA gGXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:date:message-id:to:from:subject; bh=YBo+yUiRjlkdQBuDgqanTGAInhkDuDeP+WVWLlGdAyA=; b=ftnZ6mknAhr1WeYN7a0dtgTFmoix/ZG3TZ+fs2JDkI+UtiFQ9wVjzQ3KcqSEhtZBlH ILefDS8+bubmmvpFq0OvCuzuEwN3dkDxsecLPhuP6GL+uq4zXl8va68BpQaZtXYDKiRh 3ZhXekZuT9s7q7VyV+WP/tXRZVNSPAhHdHUB3IBi9AedpzGC1fWa2QaP/KveGGQklk5o hhKjQaNQ/xACVM5pbXhnFKRmkKjc+TarFv8AwMxSVmhW3EHsL1FlrcxLgy64P6omz35C BY9y+Gj5R5+NTqKpl0MfNKw66PW5aqwjJox9uTQHLnwE3CW+KcHGxVHbcyk6AmnGG1Jf pG/A== X-Gm-Message-State: AEkoouvTrKq/CKzdG13e89gwQWe8jY7TNJ9zA2VYpYIve9ZaiRYAa8XGe7wsr0+tG8ZXOw== X-Received: by 10.194.113.105 with SMTP id ix9mr16888081wjb.30.1471027514168; Fri, 12 Aug 2016 11:45:14 -0700 (PDT) Received: from breton.holly.idiocy.org (ip6-2001-08b0-03f8-8129-c9b0-c9dd-8aa4-da55.holly.idiocy.org. [2001:8b0:3f8:8129:c9b0:c9dd:8aa4:da55]) by smtp.gmail.com with ESMTPSA id w129sm3724097wmd.9.2016.08.12.11.45.13 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Aug 2016 11:45:13 -0700 (PDT) Date: Fri, 12 Aug 2016 19:45:13 +0100 Message-Id: To: control@debbugs.gnu.org From: Alan Third Subject: control message for bug #7078 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) merge 7078 6800 From unknown Sat Aug 16 16:15:20 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: David Fox Subject: bug#6800: closed (Re: bug#6800: 23.1; EOT / ^D inserted into comint input string) Message-ID: References: X-Gnu-PR-Message: they-closed 6800 X-Gnu-PR-Package: emacs Reply-To: 6800@debbugs.gnu.org Date: Fri, 12 Aug 2016 19:53:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1471031582-4689-1" This is a multi-part message in MIME format... ------------=_1471031582-4689-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #6800: 23.1; EOT / ^D inserted into comint input string which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 6800@debbugs.gnu.org. --=20 6800: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D6800 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1471031582-4689-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 6800-done) by debbugs.gnu.org; 12 Aug 2016 19:52:48 +0000 Received: from localhost ([127.0.0.1]:55437 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bYIVa-0001D7-Uh for submit@debbugs.gnu.org; Fri, 12 Aug 2016 15:52:48 -0400 Received: from mail-ua0-f170.google.com ([209.85.217.170]:36280) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bYHNJ-0006HC-Oc for 6800-done@debbugs.gnu.org; Fri, 12 Aug 2016 14:40:10 -0400 Received: by mail-ua0-f170.google.com with SMTP id 97so55094195uav.3 for <6800-done@debbugs.gnu.org>; Fri, 12 Aug 2016 11:40:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=oybh2gmC11GjbWmwq/4vGkmdQJzVC1rfj9XF2zkj9aw=; b=OAqce0LjeGBgCj/OvyMa0FU39AA4Hjg8fanhOHjNSEaPyhN3h05sDXGB4gPx3EysqG TKYjIxaepEwXCv5gnHbWpyXpDm9BbZBlxSNWqaHwMjdy2eTjtSGXZ0kdw5fb/kl9/Pf2 3NLq9FtbCu8ZgRk27kLwnSlOd2FXyD52in3SAOM5uJq8kkYhrxRb3+7dqvl9d1yQNJXr Ghobg/cYWjfXOC+OXhrRrVDM7c/FNuhSI6nYFYzOD68c5WoIHy51FB3orAAgH1XMmsIZ WA7Hw+QaXwfyGsBuVUlWlWnrtUyy5xIFJwdVoxPH5yUrM+nosQyzYsurlNcAoohwttvb pzhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=oybh2gmC11GjbWmwq/4vGkmdQJzVC1rfj9XF2zkj9aw=; b=hUD0N4U5xMi4TXiYohWvqMfmrgBIR1qNTznQfh8Cddfxa2O1VakdJ2v4/gP9aksu/6 XoGelmc3LOpq6KnD0mVaHatuMMZU8sOBynXeesjrIQcrhapfsVkwP/MkFrwytOarIlR+ GVXB+Wy+bSF3sUJyAB03CUD4tv5zSiIq2ajhCgOXpIX5xBeikynu+gn1bcODeNnFNgRv bib3IgCAZZbCvPHi4g4YfIc7TprEVzWeahMdouy7ruvYiPBEFwkpD5/4RNOohHv6dsMu SFCNdjhsMkYHNvpH02+gNLinYBgf+Kv2HLbFPaIoSs/WfdQQ0POBn6uHFAMx6tWO37Yr 4Fpw== X-Gm-Message-State: AEkoousHEz8R7j8pX/+9wyhnagntfDGg9wWIyPxq9VphTEADBhdql768HOAtbxeSAReQy8tbzrA6Fv9srbsSBQ== X-Received: by 10.176.3.1 with SMTP id 1mr4176619uat.131.1471027204093; Fri, 12 Aug 2016 11:40:04 -0700 (PDT) MIME-Version: 1.0 Received: by 10.176.65.98 with HTTP; Fri, 12 Aug 2016 11:40:03 -0700 (PDT) In-Reply-To: References: From: David Fox Date: Fri, 12 Aug 2016 11:40:03 -0700 Message-ID: Subject: Re: bug#6800: 23.1; EOT / ^D inserted into comint input string To: Alan Third Content-Type: multipart/alternative; boundary=001a11469372f47efe0539e43574 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 6800-done X-Mailman-Approved-At: Fri, 12 Aug 2016 15:52:45 -0400 Cc: 6800-done@debbugs.gnu.org, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) --001a11469372f47efe0539e43574 Content-Type: text/plain; charset=UTF-8 On Fri, Aug 12, 2016 at 11:36 AM, Alan Third wrote: > Stefan Monnier writes: > > >> When an input longer than 255 characters is typed into comint (or > >> shell) an EOT character (ascii 4, ^D) is inserted into the string. > >> This can cause an error depending how the sub process handles these > >> extra characters. For example, GHC doesn't like it when an EOT > >> appears inside of a string: > > > > I believe this bug is fixed on the Emacs trunk (to become Emacs-24), but > > the fix may introduce other problems. Apparently nobody knows how to > > fix it right and there is about as much as no documentation at all on > > this part of the behavior of ttys. > > IIRC this code is no longer in Emacs. I'll close this bug. > > -- > Alan Third > I do know that commands longer than 4096 characters are truncated in emacs 24.3.1 --001a11469372f47efe0539e43574 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
On F= ri, Aug 12, 2016 at 11:36 AM, Alan Third <alan@idiocy.org> wro= te:
Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> When an input longer than 255 characters is typed into comint (or<= br> >> shell) an EOT character (ascii 4, ^D) is inserted into the string.=
>> This can cause an error depending how the sub process handles thes= e
>> extra characters.=C2=A0 For example, GHC doesn't like it when = an EOT
>> appears inside of a string:
>
> I believe this bug is fixed on the Emacs trunk (to become Emacs-24), b= ut
> the fix may introduce other problems.=C2=A0 Apparently nobody knows ho= w to
> fix it right and there is about as much as no documentation at all on<= br> > this part of the behavior of ttys.

IIRC this code is no longer in Emacs. I'll close this bug.

--
Alan Third

I do know that= commands longer than 4096 characters are truncated in emacs 24.3.1

--001a11469372f47efe0539e43574-- ------------=_1471031582-4689-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 5 Aug 2010 15:13:38 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oh28Y-000392-9O for submit@debbugs.gnu.org; Thu, 05 Aug 2010 11:13:38 -0400 Received: from mail.gnu.org ([199.232.76.166] helo=mx10.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oh1zZ-000357-Ty for submit@debbugs.gnu.org; Thu, 05 Aug 2010 11:04:22 -0400 Received: from lists.gnu.org ([199.232.76.165]:53041) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Oh204-0001ga-Nt for submit@debbugs.gnu.org; Thu, 05 Aug 2010 11:04:52 -0400 Received: from [140.186.70.92] (port=51143 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Oh1zp-00022N-M8 for bug-gnu-emacs@gnu.org; Thu, 05 Aug 2010 11:04:52 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, HTML_MESSAGE, T_DKIM_INVALID, T_TO_NO_BRKTS_FREEMAIL autolearn=unavailable version=3.3.1 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Oh1zd-0002zx-LA for bug-gnu-emacs@gnu.org; Thu, 05 Aug 2010 11:04:37 -0400 Received: from mail-fx0-f41.google.com ([209.85.161.41]:39248) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oh1zd-0002z3-Gb for bug-gnu-emacs@gnu.org; Thu, 05 Aug 2010 11:04:25 -0400 Received: by fxm20 with SMTP id 20so3303888fxm.0 for ; Thu, 05 Aug 2010 08:04:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:content-type; bh=IssDqXJL+zfQGJHUQuAx1RySBsjRisP4ToN5OIrZIT4=; b=Q5ejkh8avdZ+Y115UwmdWO3wq3Rin3Fw+3AVkXA6MB16DI0fdFyswh3OOBkCN/CQd6 0XWMOwf4TOaFq76Bq6xTtvAQVrucd2bekckqdUZbjSQBtdut5h8trnMIzvSKQ1sXt+mG Ay0dGSnbAGwjd3tguzEWQgQyfNY58JEYtJ/S8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=Ze/K9pMYLDxFvrRFrx3qxQfNMcWdHiE27w7YWAUlpf51TShIJ0n9ewWgidORGYqAqG 740r0hUVQWnIkZtH7c3ojjxmv0b6TtDbE1bvW8BGD3LWqfyKxjcybJFgtr47TTb7WS2t s649K1Zxy+gsgNzT0zH1lS/i5mV/vm6BY5kDo= MIME-Version: 1.0 Received: by 10.204.160.146 with SMTP id n18mr7354084bkx.116.1281020293444; Thu, 05 Aug 2010 07:58:13 -0700 (PDT) Received: by 10.204.50.14 with HTTP; Thu, 5 Aug 2010 07:58:13 -0700 (PDT) Date: Thu, 5 Aug 2010 07:58:13 -0700 Message-ID: Subject: 23.1; EOT / ^D inserted into comint input string From: David Fox To: bug-gnu-emacs@gnu.org Content-Type: multipart/alternative; boundary=0015175cd4508a730f048d14c715 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -4.4 (----) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Thu, 05 Aug 2010 11:13:37 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.2 (-----) --0015175cd4508a730f048d14c715 Content-Type: text/plain; charset=UTF-8 When an input longer than 255 characters is typed into comint (or shell) an EOT character (ascii 4, ^D) is inserted into the string. This can cause an error depending how the sub process handles these extra characters. For example, GHC doesn't like it when an EOT appears inside of a string: ghci > Prelude> putStrLn "" works fine, but > Prelude> putStrLn "" :1:255: lexical error at character '\EOT' I inserted a function to break up the input into comint-send-string to work around the problem: (require 'comint) (defun comint-send-string (process string) "Like `process-send-string', but also does extra bookkeeping for Comint mode." (if process (with-current-buffer (if (processp process) (process-buffer process) (get-buffer process)) (comint-snapshot-last-prompt)) (comint-snapshot-last-prompt)) (my-process-send-string process string)) ;; Break up the string so that we don't get EOT characters in our input stream. (defun my-process-send-string (process string) (if (> (length string) 200) (progn (process-send-string process (substring string 0 200)) (my-process-send-string process (substring string 200))) (process-send-string process string))) --0015175cd4508a730f048d14c715 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable When an input longer than 255 characters is typed into comint (or
shell)= an EOT character (ascii 4, ^D) is inserted into the string.
This can ca= use an error depending how the sub process handles these
extra character= s.=C2=A0 For example, GHC doesn't like it when an EOT
appears inside of a string:

=C2=A0ghci
=C2=A0> Prelude> put= StrLn "<a 241 character string>"
works fine, but
=C2= =A0> Prelude> putStrLn "<a 242 character string>"
= <interactive>:1:255: lexical error at character '\EOT'

I inserted a function to break up the input into comint-send-string to = work around the problem:

(require 'comint)

(defun comint-= send-string (process string)
=C2=A0 "Like `process-send-string'= , but also does extra bookkeeping for Comint mode."
=C2=A0 (if process
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (with-current-buffer (= if (processp process)
=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0= =C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (process-buffer process)
=C2= =A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2= =A0 (get-buffer process))
=C2=A0=C2=A0=C2=A0 (comint-snapshot-last-promp= t))
=C2=A0=C2=A0=C2=A0 (comint-snapshot-last-prompt))
=C2=A0 (my-process-send-string process string))

;; Break up the stri= ng so that we don't get EOT characters in our input stream.
(defun m= y-process-send-string (process string)
=C2=A0 (if (> (length string) = 200)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (progn (process-send-string process (substri= ng string 0 200)) (my-process-send-string process (substring string 200)))<= br>=C2=A0=C2=A0=C2=A0 (process-send-string process string)))=C2=A0=C2=A0=C2= =A0 =C2=A0=C2=A0=C2=A0=C2=A0

--0015175cd4508a730f048d14c715-- ------------=_1471031582-4689-1-- From unknown Sat Aug 16 16:15:20 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Knut Anders Hatlen Subject: bug#7078: closed (Re: bug#6800: 23.1; EOT / ^D inserted into comint input string) Message-ID: References: X-Gnu-PR-Message: they-closed 7078 X-Gnu-PR-Package: emacs Reply-To: 7078@debbugs.gnu.org Date: Fri, 12 Aug 2016 19:53:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1471031582-4689-3" This is a multi-part message in MIME format... ------------=_1471031582-4689-3 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #6800: 24.0.50; process-send-string doesn't work with long lines on Solaris which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 7078@debbugs.gnu.org. --=20 6800: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D6800 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1471031582-4689-3 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 6800-done) by debbugs.gnu.org; 12 Aug 2016 19:52:48 +0000 Received: from localhost ([127.0.0.1]:55437 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bYIVa-0001D7-Uh for submit@debbugs.gnu.org; Fri, 12 Aug 2016 15:52:48 -0400 Received: from mail-ua0-f170.google.com ([209.85.217.170]:36280) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bYHNJ-0006HC-Oc for 6800-done@debbugs.gnu.org; Fri, 12 Aug 2016 14:40:10 -0400 Received: by mail-ua0-f170.google.com with SMTP id 97so55094195uav.3 for <6800-done@debbugs.gnu.org>; Fri, 12 Aug 2016 11:40:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=oybh2gmC11GjbWmwq/4vGkmdQJzVC1rfj9XF2zkj9aw=; b=OAqce0LjeGBgCj/OvyMa0FU39AA4Hjg8fanhOHjNSEaPyhN3h05sDXGB4gPx3EysqG TKYjIxaepEwXCv5gnHbWpyXpDm9BbZBlxSNWqaHwMjdy2eTjtSGXZ0kdw5fb/kl9/Pf2 3NLq9FtbCu8ZgRk27kLwnSlOd2FXyD52in3SAOM5uJq8kkYhrxRb3+7dqvl9d1yQNJXr Ghobg/cYWjfXOC+OXhrRrVDM7c/FNuhSI6nYFYzOD68c5WoIHy51FB3orAAgH1XMmsIZ WA7Hw+QaXwfyGsBuVUlWlWnrtUyy5xIFJwdVoxPH5yUrM+nosQyzYsurlNcAoohwttvb pzhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=oybh2gmC11GjbWmwq/4vGkmdQJzVC1rfj9XF2zkj9aw=; b=hUD0N4U5xMi4TXiYohWvqMfmrgBIR1qNTznQfh8Cddfxa2O1VakdJ2v4/gP9aksu/6 XoGelmc3LOpq6KnD0mVaHatuMMZU8sOBynXeesjrIQcrhapfsVkwP/MkFrwytOarIlR+ GVXB+Wy+bSF3sUJyAB03CUD4tv5zSiIq2ajhCgOXpIX5xBeikynu+gn1bcODeNnFNgRv bib3IgCAZZbCvPHi4g4YfIc7TprEVzWeahMdouy7ruvYiPBEFwkpD5/4RNOohHv6dsMu SFCNdjhsMkYHNvpH02+gNLinYBgf+Kv2HLbFPaIoSs/WfdQQ0POBn6uHFAMx6tWO37Yr 4Fpw== X-Gm-Message-State: AEkoousHEz8R7j8pX/+9wyhnagntfDGg9wWIyPxq9VphTEADBhdql768HOAtbxeSAReQy8tbzrA6Fv9srbsSBQ== X-Received: by 10.176.3.1 with SMTP id 1mr4176619uat.131.1471027204093; Fri, 12 Aug 2016 11:40:04 -0700 (PDT) MIME-Version: 1.0 Received: by 10.176.65.98 with HTTP; Fri, 12 Aug 2016 11:40:03 -0700 (PDT) In-Reply-To: References: From: David Fox Date: Fri, 12 Aug 2016 11:40:03 -0700 Message-ID: Subject: Re: bug#6800: 23.1; EOT / ^D inserted into comint input string To: Alan Third Content-Type: multipart/alternative; boundary=001a11469372f47efe0539e43574 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 6800-done X-Mailman-Approved-At: Fri, 12 Aug 2016 15:52:45 -0400 Cc: 6800-done@debbugs.gnu.org, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) --001a11469372f47efe0539e43574 Content-Type: text/plain; charset=UTF-8 On Fri, Aug 12, 2016 at 11:36 AM, Alan Third wrote: > Stefan Monnier writes: > > >> When an input longer than 255 characters is typed into comint (or > >> shell) an EOT character (ascii 4, ^D) is inserted into the string. > >> This can cause an error depending how the sub process handles these > >> extra characters. For example, GHC doesn't like it when an EOT > >> appears inside of a string: > > > > I believe this bug is fixed on the Emacs trunk (to become Emacs-24), but > > the fix may introduce other problems. Apparently nobody knows how to > > fix it right and there is about as much as no documentation at all on > > this part of the behavior of ttys. > > IIRC this code is no longer in Emacs. I'll close this bug. > > -- > Alan Third > I do know that commands longer than 4096 characters are truncated in emacs 24.3.1 --001a11469372f47efe0539e43574 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
On F= ri, Aug 12, 2016 at 11:36 AM, Alan Third <alan@idiocy.org> wro= te:
Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> When an input longer than 255 characters is typed into comint (or<= br> >> shell) an EOT character (ascii 4, ^D) is inserted into the string.=
>> This can cause an error depending how the sub process handles thes= e
>> extra characters.=C2=A0 For example, GHC doesn't like it when = an EOT
>> appears inside of a string:
>
> I believe this bug is fixed on the Emacs trunk (to become Emacs-24), b= ut
> the fix may introduce other problems.=C2=A0 Apparently nobody knows ho= w to
> fix it right and there is about as much as no documentation at all on<= br> > this part of the behavior of ttys.

IIRC this code is no longer in Emacs. I'll close this bug.

--
Alan Third

I do know that= commands longer than 4096 characters are truncated in emacs 24.3.1

--001a11469372f47efe0539e43574-- ------------=_1471031582-4689-3 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 20 Sep 2010 22:16:53 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OxofN-0000kz-D1 for submit@debbugs.gnu.org; Mon, 20 Sep 2010 18:16:53 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oxoen-0000kY-Bf for submit@debbugs.gnu.org; Mon, 20 Sep 2010 18:16:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OxohC-00014C-Vg for submit@debbugs.gnu.org; Mon, 20 Sep 2010 18:18:47 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,T_DKIM_INVALID,T_TO_NO_BRKTS_FREEMAIL autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([199.232.76.165]:38544) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OxohC-000148-Te for submit@debbugs.gnu.org; Mon, 20 Sep 2010 18:18:46 -0400 Received: from [140.186.70.92] (port=39636 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OxohB-0006TX-K8 for bug-gnu-emacs@gnu.org; Mon, 20 Sep 2010 18:18:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OxohA-00013W-Ih for bug-gnu-emacs@gnu.org; Mon, 20 Sep 2010 18:18:45 -0400 Received: from mail-wy0-f169.google.com ([74.125.82.169]:57788) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OxohA-00013N-DU for bug-gnu-emacs@gnu.org; Mon, 20 Sep 2010 18:18:44 -0400 Received: by wyb36 with SMTP id 36so6245561wyb.0 for ; Mon, 20 Sep 2010 15:18:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:subject:date :message-id:mime-version:content-type; bh=0G6DPnvosIaOkRZhAGpTapApib03F0+E4OgvUEy3bG4=; b=EWaSpCrgheCB/vUPW41lMXUkl4IKLVOQFPNkLclPHk9tn6cKF+rdjrxOd2OgtfXiMH egtFy802419RW+WYnqgWYvL1FWdJOH7/HYP+a4BQHSPsExxdlP8HPcjn7ZLaUzhV3ma2 V3oUHZ/0EAmX5eI96S5l9X54DIcEAxPVzwdpE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:subject:date:message-id:mime-version:content-type; b=VAZ37bZxdKzb5ci8pzxo6sDolxnhLhE8FIBBqLDwAqJF3mqdD4ASIzq7ZLn6j6mGSY jdZ+1x5OF0vm5E33+0XWSz8hfINOrbkWRCr1ZW4fRoGDiu5m6UeJxoqDOn9eKeysGhnk STLmDcsmES2mCBfe/KKaKUtMZRaCRCt1/nBWo= Received: by 10.227.135.211 with SMTP id o19mr2501262wbt.73.1285021122266; Mon, 20 Sep 2010 15:18:42 -0700 (PDT) Received: from localhost (gmp-ea-fw-1b.sun.com [192.18.8.1]) by mx.google.com with ESMTPS id fz1sm2260006wbb.6.2010.09.20.15.18.39 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 20 Sep 2010 15:18:39 -0700 (PDT) From: Knut Anders Hatlen To: bug-gnu-emacs@gnu.org Subject: 24.0.50; process-send-string doesn't work with long lines on Solaris Date: Tue, 21 Sep 2010 00:18:30 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -5.9 (-----) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Mon, 20 Sep 2010 18:16:52 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.9 (-----) With Emacs 24 on Solaris, the code below will insert ^G into the current buffer. With Emacs 23.2, and with Emacs 24 on Linux, it will insert 257 a's into the current buffer, which is the expected behaviour. The problem is only seen if the string passed to process-send-string contains lines that exceed 256 characters. (let ((process (start-process "cat" (current-buffer) "cat"))) (process-send-string process (format "%s\n" (make-string 257 ?a)))) The bug was introduced with this change: revno: 99890 committer: Stefan Monnier branch nick: trunk timestamp: Mon 2010-04-12 22:07:48 -0400 message: Try to solve the problem of spurious EOF chars in long lines of text sent to interactive subprocesses. * sysdep.c (child_setup_tty): Do not enable ICANON any more. (system_process_attributes): Remove unused var `ttotal'. * process.c (send_process): Don't bother breaking long line with EOF chars when talking to ttys any more. (wait_reading_process_output): Output a warning when called in such a way that it could block without being interruptible. -- Knut Anders ------------=_1471031582-4689-3--