From owner-freebsd-bugs Sat Aug 3 15:20:10 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 71B3537B400 for ; Sat, 3 Aug 2002 15:20:02 -0700 (PDT) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id C7F0043E65 for ; Sat, 3 Aug 2002 15:20:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.4/8.12.4) with ESMTP id g73MK1JU064807 for ; Sat, 3 Aug 2002 15:20:01 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.4/8.12.4/Submit) id g73MK1o7064806; Sat, 3 Aug 2002 15:20:01 -0700 (PDT) Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9220137B400 for ; Sat, 3 Aug 2002 15:17:42 -0700 (PDT) Received: from mail.eecs.harvard.edu (bowser.eecs.harvard.edu [140.247.60.24]) by mx1.FreeBSD.org (Postfix) with ESMTP id 327E043E4A for ; Sat, 3 Aug 2002 15:17:42 -0700 (PDT) (envelope-from dholland@eecs.harvard.edu) Received: by mail.eecs.harvard.edu (Postfix, from userid 32170) id 5A84F54C659; Sat, 3 Aug 2002 18:17:41 -0400 (EDT) Message-Id: <20020803221741.5A84F54C659@mail.eecs.harvard.edu> Date: Sat, 3 Aug 2002 18:17:41 -0400 (EDT) From: "David A.Holland" Reply-To: "David A.Holland" To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: bin/41297: {t,}csh backquote/braces expansion bug Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 41297 >Category: bin >Synopsis: {t,}csh backquote/braces expansion bug >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat Aug 03 15:20:01 PDT 2002 >Closed-Date: >Last-Modified: >Originator: David A. Holland >Release: FreeBSD 4.5-RELEASE i386 >Organization: Harvard EESC >Environment: System: FreeBSD bowser.eecs.harvard.edu 4.5-RELEASE FreeBSD 4.5-RELEASE #1: Tue Jun 25 16:51:02 EDT 2002 palmer@bowser.eecs.harvard.edu:/usr/src/sys/compile/BOWSER i386 tcsh 6.11.00 was built from ports. >Description: If you write a program "foo" that prints echo '{' and then type echo `foo` tcsh incorrectly prints "Missing }." Similarly, if you have foo print echo '{a,b,c}' tcsh prints "echo 'a' 'b' 'c'". Observed with: tcsh 6.09 for i386-intel-NetBSD tcsh 6.10 for i386-intel-linux tcsh 6.11 for i386-intel-FreeBSD and also csh from FreeBSD 4.5-RELEASE csh from NetBSD 1.6-current What happens is that globexpand() in sh.glob.c is called to handle the backquotes, which is correct; however, after expanding the backquotes, globexpand proceeds to also expand braces, tilde, and some other things. None of these expansions check for or honor quotes (either single or double quotes) and this produces the problem. I don't claim to know enough about the inner workings of expansions in csh to suggest a correct fix. Probably the results of backquote expansion need to be rescanned for quotes earlier than they are. (They apparently are at some point, although I haven't found the code yet.) This problem gets tickled when using the X11 "resize" command in connection with a termcap entry that contains braces, as some do, but is more or less silent as long as the braces match, which generally in the past they have. (However, FreeBSD seems to have recently introduced an xterm termcap entry where the braces don't match. This broke my login and caused me to investigate.) The problem also affects FreeBSD and NetBSD's /bin/csh and, in fact, probably every csh. Therefore, copies of this message are being sent to various additional appropriate places. >How-To-Repeat: See above. >Fix: As a workaround to the immediate problem, the status quo can be restored by restoring the matching braces to the termcap file. Also see above. >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message