Date: Sun, 22 Sep 2002 21:54:22 -0500 (CDT) From: Dan Nelson <dnelson@allantgroup.com> To: FreeBSD-gnats-submit@FreeBSD.org Cc: tjr@FreeBSD.org Subject: bin/43275: [PATCH] ash cannot parse "case hello in \n esac" Message-ID: <200209230254.g8N2sMmf049380@dan.emsphone.com>
next in thread | raw e-mail | index | archive | help
>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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200209230254.g8N2sMmf049380>