[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#2383: readline doesn't reliably handle EOF on stdin



On Wed, 21 Feb 1996, Raul Miller wrote:

> Package: libreadline2
> Version: 2.0-12
>
> According to (readline.info.gz)Basic Behavior, Subfile: readline.info-1.gz,
>
>    If `readline' encounters an `EOF' while reading the line, and the
> line is empty at that point, then `(char *)NULL' is returned.
> Otherwise, the line is ended just as if a newline had been typed.
>
> However, it's easy to demonstrate that this is not the case:
>
> $ cat <<END >rtest.c
> char *readline(char *PROMPT);
> main() {
>         char *s;
>         while (s= readline("ready: ")) {
>                 puts(s);
>         }
> }
> $ cc rtest.c -o rtest -lreadline
> $ echo foo | ./rtest
>
> [this will hang]
>
> I suspect that this is a bug in the line editing logic of readline, since
> C-d is supposed to delete the character under the cursor.  I presume this
> is enough information to fix this problem.

roro@ernie:tty7:~/tmp$ export LD_LIBRARY_PATH=~/zz1/libreadline-2.0/shared/
roro@ernie:tty7:~/tmp$ ldd a.out
        libreadline.so.2.0 => /home/roro/zz1/libreadline-2.0/shared/libreadline.so.2.0
        libc.so.5 => /lib/libc.so.5.2.18
        libncurses.so.3.0 => /lib/libncurses.so.3.0
roro@ernie:tty7:~/tmp$ echo foo | ./a.out
ready: foo
foo
ready: roro@ernie:tty7:~/tmp$

Is above that what you expect?  This is a readline with bash's
modifications applied (see Bug#2362).

mfg
Rolf Rossius


Reply to: