Skip to content

Extra EOT from NoBuffering mode in emacs

Compile the following program:

import System.IO

main = hSetBuffering stdin NoBuffering >> getLine >>= print

Then start emacs, run M-x shell, and start the above program. Paste the output of replicate 252 'x' as input and press return. An extra EOT character is added to the end of the input:

$ ./foo
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"     

"\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"\\
EOT"

I can make this happen consistently using Ubuntu 8.04.2 and emacs-22.1.1. I can't reproduce it on OS X or outside of emacs's shell.

This was originally reported on the Haskeline bug tracker, as it affects ghci/haskeline: http://trac.haskell.org/haskeline/ticket/79 . From that ticket:

The problem seems to be that Emacs does not send all of the input at once: If STRING is more than 500 characters long, it is sent in several bunches. This may happen even for shorter strings. (From the documentation of process-send-string in GNU Emacs 23.0.93.1.) See also the following message: http://thread.gmane.org/gmane.comp.lang.haskell.glasgow.user/15591/focus=15632.

Trac metadata
Trac field Value
Version 6.10.3
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information