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

Bug#3201: screen ^a:exec ! doesn't clear TIOCPKT on filtered pty

package: screen
version: 3.7.1-3

Demonstration: Fire up screen. Hit "^a:exec !cat -v". Run some
commands. Note that you get leading ^@ mixed in. (If you're running
tcsh, bash, or some other interactive program, you'll get ^@ before
the echo of every keystroke, which makes it *really* clear.)

Analysis: screen creates all pty's in packet mode (ioctl(fd,TIOCPKT,&on))
and expects to read the leading character off of each. This makes
sense, as it allows screen to do clever things with flow control.
	However, the winexec() and following ForkWindow() in window.c
don't clear packet mode before handing the master filedescriptor over
to the forked program, leading to the above bug. It looks like code to
set TIOCPKT mode off could be added in ForkWindow, and set it back in
FreePseudoWin, but I'm not sure where to find the file descriptor for
the master pty at that point (the master for the *pseudo* is easy to
find, we need the master for the underlying window - which may be
w->w_ptyfd, I haven't tried hacking it though.)

Other comments: This has nothing to do with the linux bug where
TIOCPKT mode survives the close of a pty. It is generic to any system
with TIOCPKT; I was just able to reproduce it (with screen-3.6.1)
under SunOS 4.1.4.

I'll try and send along a patch (if my guess about w_ptyfd is right,
the comments in window.h seem to confirm this) but would appreciate
other input.
			_Mark_ <eichin@kitten.gen.ma.us>
			The Herd of Kittens

Reply to: