From owner-freebsd-bugs@FreeBSD.ORG Fri Nov 12 09:40:11 2010 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7318F106566C for ; Fri, 12 Nov 2010 09:40:11 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 467F08FC15 for ; Fri, 12 Nov 2010 09:40:11 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id oAC9eBBF002815 for ; Fri, 12 Nov 2010 09:40:11 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id oAC9eBaX002814; Fri, 12 Nov 2010 09:40:11 GMT (envelope-from gnats) Date: Fri, 12 Nov 2010 09:40:11 GMT Message-Id: <201011120940.oAC9eBaX002814@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Bruce Evans Cc: Subject: Re: bin/152154: /bin/csh & /bin/tcsh improperly diddle termios flags X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Bruce Evans List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Nov 2010 09:40:11 -0000 The following reply was made to PR bin/152154; it has been noted by GNATS. From: Bruce Evans To: "Ronald F.Guilmette" Cc: FreeBSD-gnats-submit@freebsd.org, freebsd-bugs@freebsd.org Subject: Re: bin/152154: /bin/csh & /bin/tcsh improperly diddle termios flags Date: Fri, 12 Nov 2010 20:34:52 +1100 (EST) On Thu, 11 Nov 2010, Ronald F.Guilmette wrote: >> Description: > > Apparently, /bin/csh (aka /bin/tcsh) is diddling termios flags, in particular > the ECHO flag, for no apparently good reason and without ever even having been > asked to do so. The result is that the /usr/bin/script program, when invoked > with the -k option, will log every input character the user types in TWICE, > but only if the user has SHELL set in the environment to either /bin/csh or > to /bin/tcsh. This behavior does not seem to occur when and if SHELL is set > to /bin/sh. /bin/sh now does this too. bash does this too (in at least versions 1.14.7 and 4.0.35). I think the mode switch in the shell is an unavoidable consequence of line editing in the shell, and script is depending on the line editing being done in the kernel. The old versions of /bin/sh that don't have the problem differ in not starting up in line editing mode. > P.S. Strangely, when you run /usr/bin/script with SHELL set to /bin/tcsh > and when you then run a program from the tcsh command prompt, that program > will see a properly set group of termios bitflags, e.g. when and if it > calls tcgetattr(). This also happens with at least bash, since bash is careful to virtualize the terminal state by context switching it to a different value only while in its line editor. I don't understand why clearing ECHO in line editing mode doubles the script -k output instead of suppressing it. Bruce