From owner-freebsd-bugs Tue Jul 30 19:10:11 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 114DF37B400 for ; Tue, 30 Jul 2002 19:10:04 -0700 (PDT) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 45CEA43E5E for ; Tue, 30 Jul 2002 19:10:03 -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 g6V2A3JU024611 for ; Tue, 30 Jul 2002 19:10:03 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.4/8.12.4/Submit) id g6V2A3Fi024610; Tue, 30 Jul 2002 19:10:03 -0700 (PDT) Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D912137B401 for ; Tue, 30 Jul 2002 19:00:43 -0700 (PDT) Received: from smtp.noos.fr (camus.noos.net [212.198.2.70]) by mx1.FreeBSD.org (Postfix) with ESMTP id B058943E31 for ; Tue, 30 Jul 2002 19:00:42 -0700 (PDT) (envelope-from root@gits.dyndns.org) Received: (qmail 49160778 invoked by uid 0); 31 Jul 2002 02:00:26 -0000 Received: from unknown (HELO gits.gits.dyndns.org) ([212.198.229.153]) (envelope-sender ) by 212.198.2.70 (qmail-ldap-1.03) with SMTP for ; 31 Jul 2002 02:00:26 -0000 Received: from gits.gits.dyndns.org (sh9g6w5ad0ctwn63@localhost [127.0.0.1]) by gits.gits.dyndns.org (8.12.5/8.12.5) with ESMTP id g6V20EJD004789; Wed, 31 Jul 2002 04:00:15 +0200 (CEST) (envelope-from root@gits.dyndns.org) Received: (from root@localhost) by gits.gits.dyndns.org (8.12.5/8.12.5/Submit) id g6V20Dbb004787; Wed, 31 Jul 2002 04:00:13 +0200 (CEST) (envelope-from root) Message-Id: <200207310200.g6V20Dbb004787@gits.gits.dyndns.org> Date: Wed, 31 Jul 2002 04:00:13 +0200 (CEST) From: Cyrille Lefevre Reply-To: Cyrille Lefevre To: FreeBSD-gnats-submit@FreeBSD.org Cc: "Tim J. Robbins" X-Send-Pr-Version: 3.113 Subject: bin/41190: in sed, report the { linenum instead of EOF linenum on pending } 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: 41190 >Category: bin >Synopsis: in sed, report the { linenum instead of EOF linenum on pending } >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Tue Jul 30 19:10:01 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Cyrille Lefevre >Release: FreeBSD 4.6-STABLE i386 >Organization: ACME >Environment: System: FreeBSD gits 4.6-STABLE FreeBSD 4.6-STABLE #21: Sun Jul 28 09:42:24 CEST 2002 root@gits:/disk2/freebsd/stable/src/sys/compile/CUSTOM i386 >Description: actually, sed reports the EOF linenum on pending }. this patch makes sed to report the { linenum instead. >How-To-Repeat: fetch http://queen.rett.polimi.it/~paolob/seders/scripts/sokoban.sed sed -f sokoban.sed sed: 2266: /root/sokoban.sed: unexpected EOF (pending }'s) patched version says : sed: 2063: /root/sokoban.sed: unexpected EOF (pending }'s) which is more accurate, IMHO. >Fix: Index: compile.c =================================================================== RCS file: /home/ncvs/src/usr.bin/sed/compile.c,v retrieving revision 1.21 diff -u -r1.21 compile.c --- compile.c 1 Jun 2002 13:25:47 -0000 1.21 +++ compile.c 31 Jul 2002 01:53:02 -0000 @@ -165,9 +165,12 @@ stack = 0; for (;;) { if ((p = cu_fgets(lbuf, sizeof(lbuf), NULL)) == NULL) { - if (stack != 0) + if (stack != 0) { + for (cmd = stack; cmd->next; cmd = cmd->next) + /* nothing */ ; errx(1, "%lu: %s: unexpected EOF (pending }'s)", - linenum, fname); + cmd->linenum, fname); + } return (link); } @@ -226,6 +229,7 @@ p++; EATSPACE(); cmd->next = stack; + cmd->linenum = linenum; stack = cmd; link = &cmd->u.c; if (*p) Index: defs.h =================================================================== RCS file: /home/ncvs/src/usr.bin/sed/defs.h,v retrieving revision 1.3 diff -u -r1.3 defs.h --- defs.h 11 Aug 1997 07:21:00 -0000 1.3 +++ defs.h 31 Jul 2002 01:51:04 -0000 @@ -88,6 +88,7 @@ int fd; /* File descriptor for w */ } u; char code; /* Command code */ + u_long linenum; /* Line number. */ u_int nonsel:1; /* True if ! */ u_int inrange:1; /* True if in range */ }; >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message