Return to BSD News archive
Newsgroups: comp.unix.bsd Path: sserve!manuel!munnari.oz.au!news.hawaii.edu!ames!pasteur!cory.Berkeley.EDU!sim From: sim@cory.Berkeley.EDU (Peng-Toh Sim) Subject: Re: 386BSD: Dinky little socket(?) bug -- ^V as escape character? Message-ID: <1992Jul30.011650.5292@pasteur.Berkeley.EDU> Summary: POSIX termios Sender: nntp@pasteur.Berkeley.EDU (NNTP Poster) Nntp-Posting-Host: cory Organization: University of California, at Berkeley References: <sand.712454840@milton> Date: Thu, 30 Jul 1992 01:16:50 GMT In article <sand.712454840@milton> sand@milton.u.washington.edu (Derek Upham) writes: >I've noticed the following problem while running "screen" on 386BSD >(both of these from the vanilla bin01 and etc01 sources): control-v >needs to be typed twice for it to be received by a process. For >example, under tcsh, the key sequence > > echo ^V^G > >which should enter a literal ^G (BEL, 0x7) on the command line, simply >beeps. Similarly, "^V^B", which should enter a literal ^B (0x2), >moves the cursor back one space. Both of these DO work correctly when >you type two ^V characters instead of one. Inserting some suitable >printf's in "screen" indicates that the problem occurs before the data >stream reaches the program---somewhere in the pty or socket code, >looks like. Anyone else noticed this problem? > >Derek > >-- >Derek Lynn Upham University of Washington >sand@u.washington.edu University Computing Services Operations >============================================================================= >"Ha! Your Leaping Tiger Kung Fu is no match for my Frightened Piglet Style!" Hi I believe this bug is due to misinterpretation of POSIX.1 . I have seen this bug under 0.0 with screen3.2 and kermit 5a. When screen3.2 or kermit is compiled with POSIX.1 termios, it switches to RAW mode by resetting ICANON in c_lflags for the terminal. This, however, does not disable IEXTEN under the current implementation of 386bsd, so keys enabled by IEXTEN like ^V still gets processed. Since with screen (or kermit), you go though the tty discipline twice, ^V gets processed twice. Example, if you want to enter ^V itself, you have to hit it four times!!! I figure this from "POSIX Programmer's Guide" by Donald Lewine. However, this book does not say if the kernel should ignore IEXTEN when ICANON is not set. So I don't know who's bug this is. My modified version of screen3.2 and kermit disables the IEXTEN flag when they switch to RAW mode so I don't see this problem. Can somebody who has access to the actual POSIX.1 document comment on this please? PT sim@cory.berkeley.edu