Messages in this thread | | | Date | Tue, 10 Dec 2013 06:00:57 -0500 | From | Peter Hurley <> | Subject | Re: [PATCH 3.12] Broken terminal due to echo bufferring |
| |
On 12/10/2013 05:48 AM, Karl Dahlke wrote: > | An involved discussion about race conditions and asynchronous events, > | which is beyond me. > | Please continue; I'm sure you will figure it out, > | and perhaps educate me along the way. > | But this thread began with the following program that revealed, > | I believe, the same echo crlf bug that I pointed out. > >> #include <stdio.h> >> #include <unistd.h> >> >> int main(void) >> { >> int c; >> while ((c = getchar()) != EOF) { >> if (c == '\n') write(1, "prompt>", 7); >> } >> return 0; >> } > > Peter sent me a patch which fixed my bug, in its console switch form. > And also seemed to fix the bug whenever I was in a cooked mode program. > So I was happy. > For grins I compiled this program, to see if it also > ran properly. > It does, while it is running. > Prompt and newline come out in sequence, in order, > and everything looks right. > Hit control d, for EOF, as the program expects, and all is well. > But hit ^c for interrupt, and as Tilly says, > "All hell done broke loose now." > The tty spills out a bunch of accumulated text that it has displayed in the past. > Don't know where it comes from, or why. > I ran the program several times, interrupt, > and the same thing happened each time, even the same stored output, > as though it were a 4k block that was retained from somewhere. > Try it and see (with Peter's latest patches).
Hi Karl,
That's happening because you're also running the 'tty: Fix ^C echo' patch series which pre-dates this fix and is _not_ compatible with it.
I've already asked Greg to drop that series for other reasons (which he had planned on anyway).
Regards, Peter Hurley
| |