The following reply was made to PR lib/47858; it has been noted by GNATS.
From: christos%zoulas.com@localhost (Christos Zoulas)
To: gnats-bugs%NetBSD.org@localhost, lib-bug-people%netbsd.org@localhost,
gnats-admin%netbsd.org@localhost, netbsd-bugs%netbsd.org@localhost,
linasvepstas%gmail.com@localhost
Cc:
Subject: Re: lib/47858: libedit widechar version mishandles EOF
Date: Wed, 29 May 2013 14:29:51 -0400
On May 26, 9:30pm, linasvepstas%gmail.com@localhost (Linas Vepstas) wrote:
-- Subject: Re: lib/47858: libedit widechar version mishandles EOF
| Just to be clear, here is a closer description of the problem. The
| offending lines are these:
|
| #ifdef WIDECHAR
| if (el->el_flags & CHARSET_IS_UTF8) {
| if (!utf8_islead((unsigned char)cbuf[0]))
| goto again; /* discard the byte we read and try again */
|
| When an EOF is read, cbuf[0] contains some sort of undefined garbage,
| left over from a previous read, thus the goto again is taken. The
| non-widechar version doesn't have this problem, and thus perhaps my
| earlier patch is too general/too broad. I believe it's a great patch,
| but if you don't like it, the below is a more conservative patch:
I understand, I moved it outside the WIDECHAR conditional because it
should apply to the normal case too.
thanks,
christos