bugmake - Bugs: bug #2238, Simply expanded variables do not...

 
 

bug #2238: Simply expanded variables do not work with $(eval...)

Submitted by:  Robert Bogomip <bobbogo>
Submitted on:  Thu 16 Jan 2003 06:03:38 PM UTC  
 
Severity: 3 - NormalItem Group: Bug
Status: FixedPrivacy: Public
Assigned to: Paul D. Smith <psmith>Open/Closed: Closed
Component Version: 3.80Operating System: Any
Fixed Release: 3.81Triage Status: None

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Thu 30 Jan 2003 07:52:12 AM UTC, comment #1:

Oops. The read.c:eval() function was not quite fully reentrant when dealing with simply-expanded variables.

See the attached patch (probably won't apply without fuzz; you might even have to do it by hand).

Paul D. Smith <psmith>
Project AdministratorIn charge of this item.
Thu 16 Jan 2003 06:03:38 PM UTC, original submission:

Make 3.80: At last, a (simple) way to reverse a list.
Consider this function:

..9 := 0 1 2 3 4 5 6 7 8 9

rev=$(eval res:=)$(foreach word,$1,$(eval res:=${word} ${res}))${res}

When used with this makefile snippet:

$(error [$(call rev,${..9})])

we get:

$ make -f bug.mak
1:3: *** [ 9 8 7 6 5 4 3 2 1 0 ]. Stop.

This is fine. However, if we generate the result via a simply expanded variable, then oddness occurs. Change the $(error...) above to:

a:=$(call rev,${..9})
$(error [${a}])

This time make reports:

$ make -f bug.mak
1:5: *** [ 9 8 7 6 5 4 3 2 1 0 1 0 ]. Stop.

What's that extra "1 0 " doing there? Strangely, things start working again if we change "a" to a recursive variable.

Problem occurs on 3.80, and the head of CVS (a version marked as 3.81 beta 1) on cygwin/win2k and Linux (a recent SuSE).

Robert Bogomip <bobbogo>

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #266:  eval.patch added by psmith (1KiB - application/octet-stream - Fix non-reentrancy in read.c:eval())
file #239:  bug.mak added by bobbogo (364B - application/octet-stream - Illustrate odd results assigning to simple variable)

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

Do you think this task is very important?
If so, you can click here to add your encouragement to it.
This task has 0 encouragements so far.

Only logged-in users can vote.

 

Please enter the title of George Orwell's famous dystopian book (it's a date):

 

 

Follow 5 latest changes.

Date Changed By Updated Field Previous Value => Replaced By
Sat 01 Apr 2006 07:04:05 AM UTCpsmithFixed Release4.0=>3.81
Thu 30 Jan 2003 07:52:12 AM UTCpsmithStatusNone=>(Error - Not Found)
  Assigned toNone=>NA
  Open/ClosedOpen=>(Error - Not Found)
  Fixed ReleaseNone=>(Error - Not Found)

Back to the top


Powered by Savane 3.1-cleanup1