bugmake - Bugs: bug #1517, $(eval ...) behaves strangely


bug #1517: $(eval ...) behaves strangely

Submitter:  Paul D. Smith <psmith>
Submitted:  Fri 25 Oct 2002 09:34:39 PM UTC
Severity:  3 - Normal Item Group:  Bug
Status:  Fixed Privacy:  Public
Assigned to:  psmith Open/Closed:  Closed
Component Version:  3.80 Operating System:  None
Fixed Release:  3.81 Triage Status:  None
* Mandatory Fields

Add a New Comment Rich Markup

Thu 24 Mar 2005 02:37:08 AM UTC, comment #3: 

I have been experiencing this problem and have tried the attached patch provided by psmith, however the patch did not solve the problem.  When I applied the patch to make 3.80 it did not apply smoothly:

$ patch -p0 < ../eval-crash.diff
patching file variable.h
patching file expand.c
Hunk #1 succeeded at 564 (offset 19 lines).
patching file function.c
Hunk #1 succeeded at 1281 with fuzz 2 (offset 85 lines).

I'm running on AIX 5.2.  Are there any other work arounds to this problem?

Craig Jeffree <jeffree>
Wed 26 Feb 2003 02:35:57 AM UTC, comment #2: 

Experienced similar symptoms under windows; patch fixed it nicely. Thanks much.

Invalid User ID <#16208>
Fri 25 Oct 2002 09:43:33 PM UTC, comment #1: 

Greg was kind enough to send me a big chunk of his build environment to reproduce this bug, and I produced a fix based on that; I liked Toomas's fix but ended up keeping mine because there were subtle places Toomas's could fail.

Paul D. Smith <psmith>
Group administrator
Fri 25 Oct 2002 09:34:39 PM UTC, original submission:  

Using $(eval ...) can lead to fatal errors about allocating too much memory, or it can evaluate to a value (the manual says it always evaluates to the empty string).  See:

  e0 = $(foreach s,foobar,$(eval $s:))
  e1 = $(foreach s,foobar, $(eval $s:))

  all: ; @echo e0 == $(e0) e1 == $(e1)

  $ make
  e0 ==  e1 == f

The e0 value is correct, but e1 is wrong.

Greg McGary reported the fatal memory allocation manifestation.

The above manifestation was reported by Toomas Rosin (and he provided a patch).  It's the same bug but this one is easier to reproduce in a bug report :).

Paul D. Smith <psmith>
Group administrator


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Attached Files
file #120:  eval-crash.diff added by psmith (2KiB - application/octet-stream - Patch to fix eval buffer mismanagement.)


Depends on the following items: None found

Items that depend on this one: None found


CC list is empty


There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

Only logged-in users can vote.


Follow 4 latest changes.

Date Changed by Updated Field Previous Value => Replaced by
2006-04-01 psmith Fixed Release4.0 3.81
2002-10-25 psmith StatusNone None
    Open/ClosedOpen None
    Fixed ReleaseNone None

Back to the top

Powered by Savane 3.13-3cd0.
Corresponding source code