bug-make
[Top][All Lists]
Advanced

[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

URL:
  <http://savannah.gnu.org/bugs/?48060>

                 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

    _______________________________________________________

Details:

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.




    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?48060>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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