From: Karl Dahlke <eklhad@comcast.net>
To: mpatocka@redhat.com, peter@hurleysoftware.com
Cc: gregkh@linuxfoundation.org, jslaby@suse.cz, linux-kernel@vger.kernel.org
Subject: [PATCH 3.12] Broken terminal due to echo bufferring
Date: Tue, 10 Dec 2013 05:48:19 -0500 [thread overview]
Message-ID: <20131110054819.eklhad@comcast.net> (raw)
In-Reply-To: alpine.LRH.2.02.1312092103290.11182@file01.intranet.prod.int.rdu2.redhat.com
| 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).
I may try some variants: this program running in raw mode,
using read and write so we don't have half of it using stdio,
other standard cooked mode programs that are ^c interruptable.
I guess the tty is an incredibly complicated beast.
Karl Dahlke
next prev parent reply other threads:[~2013-12-10 10:48 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-09 2:55 [PATCH 3.12] Broken terminal due to echo bufferring Mikulas Patocka
2013-12-09 4:26 ` Karl Dahlke
2013-12-09 15:43 ` Peter Hurley
2013-12-09 22:18 ` Mikulas Patocka
2013-12-10 0:01 ` Peter Hurley
2013-12-10 2:29 ` Mikulas Patocka
2013-12-10 10:48 ` Karl Dahlke [this message]
2013-12-10 11:00 ` Peter Hurley
2013-12-10 10:52 ` Karl Dahlke
2013-12-10 14:34 ` Peter Hurley
2013-12-11 16:29 ` Mikulas Patocka
2013-12-13 21:24 ` Peter Hurley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20131110054819.eklhad@comcast.net \
--to=eklhad@comcast.net \
--cc=gregkh@linuxfoundation.org \
--cc=jslaby@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=mpatocka@redhat.com \
--cc=peter@hurleysoftware.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox