bugmake - Bugs: bug #48060, Recipe line flags leak between...

 
 

bug #48060: Recipe line flags leak between targets defined in one rule

Submitter:  Paul D. Smith <psmith>
Submitted:  Mon 30 May 2016 09:32:13 PM UTC
   
 
Severity:  3 - Normal Priority:  5 - Normal
Item Group:  Bug Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open Component Version:  3.82
Operating System:  None Fixed Release:  None
Triage Status:  None
* Mandatory Fields

Post a Comment

Add a New Comment Rich Markup
   

Discussion

Mon 30 May 2016 09:32:13 PM UTC, original submission:  

Found this on a StackOverflow question from last year and simplified it.  Consider this makefile:


foo : recurse = +

foo bar : ; $(recurse)echo $@: $(recurse)


Here we use a target-specific variable to specify whether or not the "recurse" flag is set: this allows us to have a single rule definition which defines two different recipes which have different recurse flags set (something that's not possible any other way).

Now consider the (correct) behavior when we run each one individually:


$ rm -f bar foo; make -q foo; echo $?
echo foo: +
foo: +
0

$ rm -f bar foo; make -q bar; echo $?
1


For "foo", where the recurse flag is set via the target-specific variable, we run the command and it doesn't need to run any more commands, so the -q flag causes us to exit with 0.  For "bar", where the recurse flag is NOT set, we don't run the command and -q causes us to exit with 1.

Now if we run both together, we get this:


$ rm -f bar foo; make -q foo bar; echo $?
echo foo: +
foo: +
echo bar:
bar:
0


This is clearly not right: somehow the "recurse" flag set for the "foo" target has been transferred to / also set for the "bar" target.

I think that these targets are sharing too much information about the commands to be invoked and/or it's not getting cleared properly after each expansion of the recipe.

Paul D. Smith <psmith>
Group administrator

 

Attached Files

This item currently has no attached files.

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

Attach Files:
   
   
Comment:
   

 

Dependencies

This item does not depend on any other items.

No items depend on this one.

 

Mail Notification Carbon-Copy List

Carbon-Copy List
  • -email is unavailable- added by psmith (Submitted the item)
  •  

    Votes

    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.

     

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

    History

    No changes have been made to this item

    Back to the top

    Powered by Savane 3.16-a7ba.
    Corresponding source code