From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: References: Date: Thu, 2 Sep 2010 15:24:49 -0400 Message-ID: Subject: Re: [9fans] P9p on Fedora 12 From: Russ Cox To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Topicbox-Message-UUID: 4df053f8-ead6-11e9-9d60-3106f5b1d025 On Mon, Aug 30, 2010 at 7:22 PM, Charles Forsyth wr= ote: > in rcinputproc > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0s =3D setecho(sfd,= 0); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if(write(rcfd, pai= r.s, pair.ns) < 0) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0threadexitsall(nil); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if(s) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0setecho(sfd, s); > > there's a race between setting echo off, writing to rcfd, resetting echo = and > the reader of the other side of rcfd. a sleep(1) before if(s) makes it le= ss frequent > because the reader gets to read the data in the right mode. > i haven't really looked at what linux is doing that allows that, > or what changed between revisions. > > it's not my observation, it was on a list or issue comment somewhere, > presumably for p9p. i can't find the bookmark. thanks for this. sleep(1) helped only rarely, sleep(10) helps most of the time. unfortunately then there's a race between the invoked program turning off echo and 9term turning it back on. so "sudo sh" is pretty likely to echo the password with the sleep in there. what a mess. russ