From owner-freebsd-bugs Sun Sep 22 20: 0:16 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 0FBDB37B401 for ; Sun, 22 Sep 2002 20:00:12 -0700 (PDT) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id C1D4943E77 for ; Sun, 22 Sep 2002 20:00:10 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id g8N30ACo080650 for ; Sun, 22 Sep 2002 20:00:10 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id g8N30A6T080649; Sun, 22 Sep 2002 20:00:10 -0700 (PDT) Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8BE4637B401; Sun, 22 Sep 2002 19:54:23 -0700 (PDT) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by mx1.FreeBSD.org (Postfix) with ESMTP id 19CB943E3B; Sun, 22 Sep 2002 19:54:23 -0700 (PDT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.12.6/8.12.5) id g8N2sMmf049380; Sun, 22 Sep 2002 21:54:22 -0500 (CDT) (envelope-from dan) Message-Id: <200209230254.g8N2sMmf049380@dan.emsphone.com> Date: Sun, 22 Sep 2002 21:54:22 -0500 (CDT) From: Dan Nelson To: FreeBSD-gnats-submit@FreeBSD.org Cc: tjr@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: bin/43275: [PATCH] ash cannot parse "case hello in \n esac" 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: 43275 >Category: bin >Synopsis: [PATCH] ash cannot parse "case hello in \n esac" >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Sep 22 20:00:09 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Dan Nelson >Release: FreeBSD 5.0-CURRENT i386 >Organization: The Allant Group >Environment: System: FreeBSD dan.emsphone.com 5.0-CURRENT FreeBSD 5.0-CURRENT #191: Tue Sep 17 17:38:00 CDT 2002 zsh@dan.emsphone.com:/usr/src/sys/i386/compile/DANSMP i386 >Description: /bin/sh is current coded to require a pattern inside a case/esac block, where it's really optional. >How-To-Repeat: $ /bin/sh $ case hello in > esac > [^D]Syntax error: end of file unexpected (expecting ")") $ >Fix: This is a partial fix. With this, "case hello in \n esac" works, but "case hello in ; esac" doesn't, and I think it should. Half a fix is better than none though. This fix also will close PR ports/35879. Index: parser.c =================================================================== RCS file: /home/ncvs/src/bin/sh/parser.c,v retrieving revision 1.44 diff -u -p -r1.44 parser.c --- parser.c 25 Aug 2002 13:01:47 -0000 1.44 +++ parser.c 23 Sep 2002 02:41:46 -0000 @@ -429,7 +429,7 @@ TRACE(("expecting DO got %s %s\n", tokna cpp = &n1->ncase.cases; noaliases = 1; /* turn off alias expansion */ checkkwd = 2, readtoken(); - do { + while (lasttoken != TESAC) { *cpp = cp = (union node *)stalloc(sizeof (struct nclist)); cp->type = NCLIST; app = &cp->nclist.pattern; @@ -456,7 +456,7 @@ TRACE(("expecting DO got %s %s\n", tokna checkkwd = 2, readtoken(); } cpp = &cp->nclist.next; - } while(lasttoken != TESAC); + } noaliases = 0; /* reset alias expansion */ *cpp = NULL; checkkwd = 1; >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message