Subject: Re: CVS commit: basesrc
To: Jun-ichiro itojun Hagino <itojun@netbsd.org>
From: Charles M. Hannum <root@ihack.net>
List: source-changes
Date: 03/09/2001 10:39:24
On Fri, Mar 09, 2001 at 02:49:06PM +0200, Jun-ichiro itojun Hagino wrote:
> 
> Module Name:	basesrc
> Committed By:	itojun
> Date:		Fri Mar  9 12:49:06 UTC 2001
> 
> Modified Files:
> 	basesrc/usr.bin/make: var.c
> 
> Log Message:
> correct case with VAR_KEEP.  if clause checked VAR_KEEP backwards,
> and made str a dangling pointer.

I'm failing to see how this change could possibly be correct.  Was it
even tested (with, say, a build of the source tree)?

As the comments indicate, VAR_KEEP is used when the value of the string
must be retained, because they're used by the caller.  This is the case
for, e.g., :U expansion.  Your change will actually cause the string to
be freed in that case!

I spent rather a lot of time fixing this stuff the first time.  B-P