unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#6800: 23.1; EOT / ^D inserted into comint input string
@ 2010-08-05 14:58 David Fox
  2010-09-11 14:01 ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: David Fox @ 2010-08-05 14:58 UTC (permalink / raw)
  To: 6800

[-- Attachment #1: Type: text/plain, Size: 1294 bytes --]

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 "<a 241 character string>"
works fine, but
 > 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)
  "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)))

[-- Attachment #2: Type: text/html, Size: 1561 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#6800: 23.1; EOT / ^D inserted into comint input string
  2010-08-05 14:58 bug#6800: 23.1; EOT / ^D inserted into comint input string David Fox
@ 2010-09-11 14:01 ` Stefan Monnier
  2016-08-12 18:36   ` Alan Third
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2010-09-11 14:01 UTC (permalink / raw)
  To: David Fox; +Cc: 6800

> 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





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#6800: 23.1; EOT / ^D inserted into comint input string
  2010-09-11 14:01 ` Stefan Monnier
@ 2016-08-12 18:36   ` Alan Third
  2016-08-12 18:40     ` David Fox
  0 siblings, 1 reply; 5+ messages in thread
From: Alan Third @ 2016-08-12 18:36 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 6800-done, David Fox

Stefan Monnier <monnier@iro.umontreal.ca> 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





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#6800: 23.1; EOT / ^D inserted into comint input string
  2016-08-12 18:36   ` Alan Third
@ 2016-08-12 18:40     ` David Fox
  2016-08-12 18:43       ` Alan Third
  0 siblings, 1 reply; 5+ messages in thread
From: David Fox @ 2016-08-12 18:40 UTC (permalink / raw)
  To: Alan Third; +Cc: 6800-done, Stefan Monnier

[-- Attachment #1: Type: text/plain, Size: 879 bytes --]

On Fri, Aug 12, 2016 at 11:36 AM, Alan Third <alan@idiocy.org> wrote:

> Stefan Monnier <monnier@iro.umontreal.ca> 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

[-- Attachment #2: Type: text/html, Size: 1416 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#6800: 23.1; EOT / ^D inserted into comint input string
  2016-08-12 18:40     ` David Fox
@ 2016-08-12 18:43       ` Alan Third
  0 siblings, 0 replies; 5+ messages in thread
From: Alan Third @ 2016-08-12 18:43 UTC (permalink / raw)
  To: David Fox; +Cc: 6800, Stefan Monnier

On Fri, Aug 12, 2016 at 11:40:03AM -0700, David Fox wrote:
> On Fri, Aug 12, 2016 at 11:36 AM, Alan Third <alan@idiocy.org> wrote:
> 
> > Stefan Monnier <monnier@iro.umontreal.ca> 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





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-08-12 18:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-05 14:58 bug#6800: 23.1; EOT / ^D inserted into comint input string David Fox
2010-09-11 14:01 ` Stefan Monnier
2016-08-12 18:36   ` Alan Third
2016-08-12 18:40     ` David Fox
2016-08-12 18:43       ` Alan Third

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).