[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

From: Paul D. Smith
Subject: [bug #48060] Recipe line flags leak between targets defined in one rule
Date: Mon, 30 May 2016 21:32:15 +0000 (UTC)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:46.0) Gecko/20100101 Firefox/46.0


                 Summary: Recipe line flags leak between targets defined in
one rule
                 Project: make
            Submitted by: psmith
            Submitted on: Mon 30 May 2016 05:32:13 PM EDT
                Severity: 3 - Normal
              Item Group: Bug
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
       Component Version: 3.82
        Operating System: None
           Fixed Release: None
           Triage Status: None



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.


Reply to this item at:


  Message sent via/by Savannah

reply via email to

[Prev in Thread] Current Thread [Next in Thread]