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

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



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.

--
Raul


Reply to: