From owner-freebsd-bugs@FreeBSD.ORG Fri Nov 12 09:34:58 2010 Return-Path: Delivered-To: freebsd-bugs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3B0E0106566C; Fri, 12 Nov 2010 09:34:58 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail06.syd.optusnet.com.au (mail06.syd.optusnet.com.au [211.29.132.187]) by mx1.freebsd.org (Postfix) with ESMTP id 930068FC20; Fri, 12 Nov 2010 09:34:57 +0000 (UTC) Received: from c122-107-121-73.carlnfd1.nsw.optusnet.com.au (c122-107-121-73.carlnfd1.nsw.optusnet.com.au [122.107.121.73]) by mail06.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id oAC9Yq7A008694 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 12 Nov 2010 20:34:55 +1100 Date: Fri, 12 Nov 2010 20:34:52 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: "Ronald F.Guilmette" In-Reply-To: <20101112010210.87641BDC46@segfault.tristatelogic.com> Message-ID: <20101112202011.E1172@besplex.bde.org> References: <20101112010210.87641BDC46@segfault.tristatelogic.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: freebsd-bugs@freebsd.org, FreeBSD-gnats-submit@freebsd.org 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 List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Nov 2010 09:34:58 -0000 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