From ru@ucb.crimea.ua Fri Mar 12 02:25:45 1999
Return-Path: <ru@ucb.crimea.ua>
Received: from relay.ucb.crimea.ua (relay.ucb.crimea.ua [212.110.138.1])
	by hub.freebsd.org (Postfix) with ESMTP id 0BF9C152EB
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 12 Mar 1999 02:25:07 -0800 (PST)
	(envelope-from ru@ucb.crimea.ua)
Received: (from ru@localhost)
	by relay.ucb.crimea.ua (8.9.2/8.9.2/UCB) id MAA12297;
	Fri, 12 Mar 1999 12:24:39 +0200 (EET)
	(envelope-from ru)
Message-Id: <199903121024.MAA12297@relay.ucb.crimea.ua>
Date: Fri, 12 Mar 1999 12:24:39 +0200 (EET)
From: Ruslan Ermilov <ru@ucb.crimea.ua>
Reply-To: ru@ucb.crimea.ua
To: FreeBSD-gnats-submit@freebsd.org
Subject: [PATCH] awk dumps core
X-Send-Pr-Version: 3.2

>Number:         10555
>Category:       gnu
>Synopsis:       [PATCH] awk dumps core
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    sheldonh
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri Mar 12 02:30:01 PST 1999
>Closed-Date:    Tue Dec 21 06:53:06 PST 1999
>Last-Modified:  Tue Dec 21 06:53:18 PST 1999
>Originator:     Ruslan Ermilov
>Release:        FreeBSD 3.1-STABLE i386
>Organization:
United Commercial Bank
>Environment:

3.1-STABLE
GNU Awk 3.0.3

>Description:

awk dumps core (signal 11)

>How-To-Repeat:

# awk '{ print $1,,$2 }'
awk: cmd. line:1: { print $1,,$2 }
awk: cmd. line:1:            ^ parse error
awk: cmd. line:1: fatal error: internal error
Abort trap - core dumped


GDB is free software and you are welcome to distribute copies of it
 under certain conditions; type "show copying" to see the conditions.
There is absolutely no warranty for GDB; type "show warranty" for details.
GDB 4.16 (i386-unknown-freebsd), 
Copyright 1996 Free Software Foundation, Inc...
Core was generated by `awk'.
Program terminated with signal 6, Abort trap.
Reading symbols from /usr/lib/libgnuregex.so.2...done.
Reading symbols from /usr/lib/libm.so.2...done.
Reading symbols from /usr/lib/libc.so.3...done.
Reading symbols from /usr/libexec/ld-elf.so.1...done.
#0  0x280d1c44 in _kill ()
(gdb) bt
#0  0x280d1c44 in _kill ()
#1  0x28105cf4 in abort ()
#2  0x8058432 in catchsig (sig=11, code=12)
    at /usr/src/gnu/usr.bin/awk/../../../contrib/awk/main.c:708
#3  <signal handler called>
#4  0x804d934 in append_right (list=0x0, new=0x806c990) at awktab.y:2114
#5  0x804ae98 in yyparse () at awktab.y:630
#6  0x8057cad in main (argc=2, argv=0xefbfdbe4)
    at /usr/src/gnu/usr.bin/awk/../../../contrib/awk/main.c:373
#7  0x8049635 in _start ()


>Fix:

The following patch is for src/contrib/awk/awk.y:

Index: awk.y
===================================================================
RCS file: /usr/FreeBSD-CVS/src/contrib/awk/awk.y,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 awk.y
--- awk.y	1997/10/14 18:16:58	1.1.1.1
+++ awk.y	1999/03/12 10:06:47
@@ -2111,7 +2111,9 @@
 
 	oldlist = list;
 	if (savefront == oldlist) {
-		savetail = savetail->rnode = new;
+		savetail = new;
+		if (savetail)
+			savetail->rnode = new;
 		return oldlist;
 	} else
 		savefront = oldlist;


>Release-Note:
>Audit-Trail:

From: Dave Bodenstab <imdave@mcs.net>
To: ru@ucb.crimea.ua
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: gnu/10555: [PATCH] awk dumps core
Date: Fri, 12 Mar 1999 12:45:20 -0600

 Ruslan Ermilov wrote:
 > 
 > >Number:         10555
 > >Category:       gnu
 > >Synopsis:       [PATCH] awk dumps core
 > >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:   Fri Mar 12 02:30:01 PST 1999
 > >Closed-Date:
 > >Last-Modified:
 > >Originator:     Ruslan Ermilov
 > >Release:        FreeBSD 3.1-STABLE i386
 > >Organization:
 > United Commercial Bank
 > >Environment:
 > 
 > 3.1-STABLE
 > GNU Awk 3.0.3
 > 
 > >Description:
 > 
 > awk dumps core (signal 11)
 > 
 > >How-To-Repeat:
 > 
 > # awk '{ print $1,,$2 }'
 > awk: cmd. line:1: { print $1,,$2 }
 > awk: cmd. line:1:            ^ parse error
 > awk: cmd. line:1: fatal error: internal error
 > Abort trap - core dumped
 > 
 > GDB is free software and you are welcome to distribute copies of it
 >  under certain conditions; type "show copying" to see the conditions.
 > There is absolutely no warranty for GDB; type "show warranty" for details.
 > GDB 4.16 (i386-unknown-freebsd),
 > Copyright 1996 Free Software Foundation, Inc...
 > Core was generated by `awk'.
 > Program terminated with signal 6, Abort trap.
 > Reading symbols from /usr/lib/libgnuregex.so.2...done.
 > Reading symbols from /usr/lib/libm.so.2...done.
 > Reading symbols from /usr/lib/libc.so.3...done.
 > Reading symbols from /usr/libexec/ld-elf.so.1...done.
 > #0  0x280d1c44 in _kill ()
 > (gdb) bt
 > #0  0x280d1c44 in _kill ()
 > #1  0x28105cf4 in abort ()
 > #2  0x8058432 in catchsig (sig=11, code=12)
 >     at /usr/src/gnu/usr.bin/awk/../../../contrib/awk/main.c:708
 > #3  <signal handler called>
 > #4  0x804d934 in append_right (list=0x0, new=0x806c990) at awktab.y:2114
 > #5  0x804ae98 in yyparse () at awktab.y:630
 > #6  0x8057cad in main (argc=2, argv=0xefbfdbe4)
 >     at /usr/src/gnu/usr.bin/awk/../../../contrib/awk/main.c:373
 > #7  0x8049635 in _start ()
 > 
 > >Fix:
 > 
 > The following patch is for src/contrib/awk/awk.y:
 > 
 > Index: awk.y
 > ===================================================================
 > RCS file: /usr/FreeBSD-CVS/src/contrib/awk/awk.y,v
 > retrieving revision 1.1.1.1
 > diff -u -r1.1.1.1 awk.y
 > --- awk.y       1997/10/14 18:16:58     1.1.1.1
 > +++ awk.y       1999/03/12 10:06:47
 > @@ -2111,7 +2111,9 @@
 > 
 >         oldlist = list;
 >         if (savefront == oldlist) {
 > -               savetail = savetail->rnode = new;
 > +               savetail = new;
 > +               if (savetail)
 > +                       savetail->rnode = new;
 >                 return oldlist;
 >         } else
 >                 savefront = oldlist;
 > 
 > >Release-Note:
 > >Audit-Trail:
 > >Unformatted:
 > 
 > To Unsubscribe: send mail to majordomo@FreeBSD.org
 > with "unsubscribe freebsd-bugs" in the body of the message
 
 This problem was fixed with the following patch from Arnold
 Robbins (the GNU awk maintainer.)  I say this based on my
 having replaced FreeBSD's awk with GNU awk 3.0.3 with the
 following patch.  Running the above example results in the
 "parse error" message and awk simply exits.  Here is the
 patch: 
 
 --- awk.y       1997/07/31 14:40:58     30.3.1.1
 +++ awk.y       1997/09/26 16:39:37     30.3.1.2
 @@ -2111,6 +2111,8 @@
         register NODE *oldlist;
         static NODE *savefront = NULL, *savetail = NULL;
  
 +       if (list == NULL || new == NULL)
 +               return;
         oldlist = list;
         if (savefront == oldlist) {
                 savetail = savetail->rnode = new;
 
 Seems to me that FreeBSD should track the original maintainer's
 version rather than fork off a FreeBSD-specific "fix".  BTW, there
 have been other patches against 3.0.3 released by Arnold Robbins
 on the gnu.utils.bug news group.
 
 Regards,
 
 Dave Bodenstab
 imdave@mcs.net
 
Responsible-Changed-From-To: freebsd-bugs->jraynard 
Responsible-Changed-By: sheldonh 
Responsible-Changed-When: Tue Mar 30 04:46:57 PST 1999 
Responsible-Changed-Why:  
Original importer of awk. 

From: hoek@freebsd.org
To: freebsd-gnats-submit@freebsd.org, ru@ucb.crimea.ua
Cc:  
Subject: Re:gnu/10555
Date: Mon, 2 Aug 1999 21:20:06 -0400 (EDT)

 >
 > This problem was fixed with the following patch from Arnold
 > Robbins (the GNU awk maintainer.)  I say this based on my
 
 Obviously time to upgrade our version of gawk.
 
 See also gnu/9281, gnu/10555, gnu/7821, all of which will be closed
 by upgrading gawk.
 
Responsible-Changed-From-To: jraynard->sheldonh 
Responsible-Changed-By: sheldonh 
Responsible-Changed-When: Tue Dec 21 06:52:39 PST 1999 
Responsible-Changed-Why:  
James has retired from active service. 
State-Changed-From-To: open->closed 
State-Changed-By: sheldonh 
State-Changed-When: Tue Dec 21 06:53:06 PST 1999 
State-Changed-Why:  
Our gawk was upgraded to 3.0.4 in CURRENT a while ago and merged in 
time for 3.4-RELEASE. 
>Unformatted:
