From nsmart@www.in-design.com  Fri May 29 14:49:58 1998
Received: from www.in-design.com (www.in-design.com [206.210.93.16])
          by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id OAA10631
          for <FreeBSD-gnats-submit@freebsd.org>; Fri, 29 May 1998 14:49:53 -0700 (PDT)
          (envelope-from nsmart@www.in-design.com)
Received: (from nsmart@localhost)
	by www.in-design.com (8.8.7/8.8.5) id RAA06615;
	Fri, 29 May 1998 17:49:21 -0400 (EDT)
Message-Id: <199805292149.RAA06615@www.in-design.com>
Date: Fri, 29 May 1998 17:49:21 -0400 (EDT)
From: njs3@doc.ic.ac.uk
Reply-To: njs3@doc.ic.ac.uk
To: FreeBSD-gnats-submit@freebsd.org
Subject: [PATCH] make(1) coredumps in debugging mode g2
X-Send-Pr-Version: 3.2

>Number:         6790
>Category:       bin
>Synopsis:       [PATCH] make(1) coredumps in debugging mode g2
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri May 29 14:50:00 PDT 1998
>Closed-Date:    Tue Sep 8 22:13:54 PDT 1998
>Last-Modified:  Tue Sep  8 22:16:12 PDT 1998
>Originator:     nsmart
>Release:        FreeBSD 2.2.5-RELEASE i386
>Organization:
>Environment:

>Description:

make(1) coredumps in debugging mode g2 because memory is
free()'d which is required later by a debugging routine.

>How-To-Repeat:

www% make -d g2 2>&1 | grep "(null)"
        (null)
www% cat Makefile
FOO     = bar

feh:
        echo ${FOO}

foo:    feh

The (null) is a result of a null pointer being passed to
printf, this causes a coredump in Solaris.  (I am working
on an autoconf package of pmake)

>Fix:

*** compat.c~	Fri May 29 22:40:15 1998
--- compat.c	Fri May 29 22:35:01 1998
***************
*** 333,340 ****
  	}
  	exit(1);
      }
!     free(cmdStart);
!     Lst_Replace (cmdNode, (ClientData) NULL);
  
      /*
       * The child is off and running. Now all we can do is wait...
--- 335,350 ----
  	}
  	exit(1);
      }
!     
!     /* we need to print out the command associated with this Gnode in
!        Targ_PrintCmd from Targ_PrintGraph when debugging at level g2,
!        in main(), Fatal() and DieHorribly(), therefore do not free it
!        when debugging. */
!        
!     if (!DEBUG(GRAPH2)) {
! 	    free(cmdStart);
! 	    Lst_Replace (cmdNode, cmdp);
!     }
  
      /*
       * The child is off and running. Now all we can do is wait...
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->suspended 
State-Changed-By: phk 
State-Changed-When: Tue Jun 2 03:00:03 PDT 1998 
State-Changed-Why:  
awaiting committer 
State-Changed-From-To: suspended->closed 
State-Changed-By: jkoshy 
State-Changed-When: Tue Sep 8 22:13:54 PDT 1998 
State-Changed-Why:  
Fixed in rev 1.12 of "src/usr.bin/make/compat.c", thanks! 
>Unformatted:
