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 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

Add a New Comment Rich Markup

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: +

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

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:

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


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

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


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

    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.


    No changes have been made to this item

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code