in a program initiated from the shell initiated w/ M-x shell, an input
line of 512 characters results in a spurious EOF to the program. here
are three steps to reproduce the problem, and some additional actions to
compare the actual and expected behaviors:
(A) compile this C program:
cat drain-stdin.c EOF
#include stdio.h
int
main (int argc, char *argv)
{
int count = 0;
int result;
unsigned char byte;
while (0 (result = read (0, byte, 1)))
{
count++;
printf ([%d:%d] %c\n, result, count, byte);
}
printf (count: %d\n, count);
return 0;
}
EOF
gcc -o /tmp/drain-stdin drain-stdin.c
(B) create a long input line:
(let ((s (apply 'concat (make-list 32 0123456789ABCDEF)))
(require-final-newline nil))
(with-temp-buffer
(insert s)
(write-region (point-min) (point-max) /tmp/.512)))
(C) run the program under M-x shell, giving it the input:
M-x shell
/tmp/drain-stdin RET
(insert-file-contents /tmp/.512)
(end-of-line)
RET
(D) run the program noninteractively under M-x shell
/tmp/drain-stdin /tmp/.512
(E) likewise, under a regular terminal (outside emacs):
/tmp/drain-stdin /tmp/.512
(F) likewise, with M-x compile
/tmp/drain-stdin /tmp/.512
for (C) i see output that ends with:
[1:503] 6
[1:504] 7
[1:505] 8
[1:506] 9
[1:507] A
[1:508] B
count: 508
$ bash: CDEF: command not found
for (D), (E) and (F), i see output that ends with:
[1:507] A
[1:508] B
[1:509] C
[1:510] D
[1:511] E
[1:512] F
count: 512
i believe (D), (E) and (F) are correct. all behaviors were reproducible
w/ emacs from cvs and emacs 21.4, started with -q --no-site-file.
thi
In GNU Emacs 22.0.98.2 (i686-pc-linux-gnu)
of 2007-04-20 on ambire
Windowing system distributor `The XFree86 Project, Inc', version 11.0.4031
configured using `configure '--prefix' '/home/ttn/local'
'CPPFLAGS=-DSITELOAD_PURESIZE_EXTRA=2''
Important settings:
value of $LC_ALL: nil
value of $LC_COLLATE: C
value of $LC_CTYPE: nil
value of $LC_MESSAGES: nil
value of $LC_MONETARY: nil
value of $LC_NUMERIC: nil
value of $LC_TIME: nil
value of $LANG: C
locale-coding-system: nil
default-enable-multibyte-characters: t
Major mode: Man
Minor modes in effect:
shell-dirtrack-mode: t
display-time-mode: t
mouse-wheel-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
unify-8859-on-encoding-mode: t
utf-translate-cjk-mode: t
auto-compression-mode: t
transient-mark-mode: t
Recent input:
C-a C-a C-a C-a C-a C-x C-s M-m M-p RET C-x C-k C-x
s M-p M-p return C-x i M-p return C-e return
C-x C-f M-p RET C-x h M-w C-x C-f C-a C-f C-f C-k .
e backspace b a s r h backspace backspace h r
tab return C-x C-f . v a r tab RET C-s E M A
C S C-s C-a C-a C-l M-: ( g e t e n v SPC E M A C
S ) return C-x s e c h o SPC $ P A G E R return
C-x b RET C-x C-b C-n C-n C-n RET C-x h M-w M-x r e
p o tab r tab return s p u r i o u s SPC e o
f SPC v i a SPC backspace backspace backspace
backspace t h r o u g h backspace backspace backspace
backspace backspace backspace backspace backspace
SPC t o SPC M - x SPC s h e l l SPC c h i l backspace
backspace backspace backspace c h i backspace
backspace backspace c h i d l r e n SPC backspace
backspace backspace backspace backspace backspace
l d r e n SPC s t d i n return C-p C-p C-p C-p C-p
C-n C-e M-b M-b M-f backspace backspace backspace
M- M- C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n
C-n C-p C-p C-p C-p C-p C-p C-p C-n C-x 1 C-p C-p C-p
C-p C-p C-p C-n C-n C-n C-n C-n C-n C-h c C-c C-a C-x
C-k C-x C-g M-x m a n return r e backspace backspace
2 SPC r e a d return C-x 0 C-x b RET C-x b RET C-x
b C-g M-x M-p M-p return
Recent messages:
Loading emacsbug...done
Fill column set to 72 (was 78)
Loading mailalias...done
Mark set [2 times]
C-c C-a is undefined
Loading man...done
Invoking man 2 read in the background
Please wait: formatting the 2 read man page...
2 read man page formatted
Loading tabify...done
Quit
___
emacs-pretest-bug mailing list
emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug