bugmake - Bugs: bug #31155, .SECONDEXPANSION: incorrect order...


bug #31155: .SECONDEXPANSION: incorrect order only parsing in patterns

Submitter:  None
Submitted:  Tue 28 Sep 2010 07:46:27 PM UTC
Severity:  3 - Normal Item Group:  Bug
Status:  Fixed Privacy:  Public
Assigned to:  psmith Open/Closed:  Closed
Component Version:  3.82 Operating System:  Any
Fixed Release:  4.0 Triage Status:  Verified
* Mandatory Fields

Add a New Comment Rich Markup

Sun 22 Sep 2013 09:11:41 PM UTC, comment #3: 

This will be fixed in the next release of GNU make.  Thanks for the report.

Paul D. Smith <psmith>
Group administrator
Thu 30 Sep 2010 11:27:30 PM UTC, comment #2: 

Sorry, I thought I had to attach this comment; here it is directly:

From running GNU Make 3.82 in a debugger:

For target "foo", pattern_search() treats "$(PREREQS)" as one
word not equal to "|", and therefore does not set the order-only
flag.  Instead, it applies second expansion to produce "p1|p2".
It then invokes PARSE_FILE_SEQ, which stops at '|', but the fact
that "|p2" remains unparsed goes unnoticed.

For target "bar", pattern_search() treats "p1|$(P2)" as two
words: "p1|" and "$(P2)", neither equal to "|".  Note the
significance of the absence of space before '|'.  The first
word gets second-expanded trivially and then split into "p1",
ignoring the leftover "|".  The second gets second-expanded
into p2, which is treated as a normal prerequisite because
the '|' was ignored.

The comparison of words against "|" before second expansion
seems both unnecessary and insufficient.  Would it be better
to check the results of PARSE_FILE_SEQ, to see if it stopped
because it found a '|'?

-- John Carey

Tue 28 Sep 2010 09:30:31 PM UTC, comment #1: 

Hm.  This is a side-effect of the performance increase in 3.82, where we do more of the parsing of the prerequisite list up-front, even for secondary expansion.

This will need to be looked at.  There may be other issues related to globbing etc.

Paul D. Smith <psmith>
Group administrator
Tue 28 Sep 2010 07:46:27 PM UTC, original submission:  

With this Makefile:

all : foo bar
f%o: $$(PREREQS) ; @echo '$@' from '$^' and '$|'
b%r: p1|$$(P2)   ; @echo '$@' from '$^' and '$|'
p% : ;

The GNU Make 3.81 output seems correct:

foo from p1 and p2
bar from p1 and p2

But the GNU Make 3.82 output seems incorrect:

foo from p1 and
bar from p1 p2 and

-- John Carey



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

Attach Files:

Attached Files
file #21586:  20100930.txt added by None (931B - text/plain - Please see attached file 20100930.txt for debugging results. -- John Carey)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by psmith (Posted a comment)

    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.


    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-09-22 psmith StatusNone Fixed
        Assigned toNone psmith
        Open/ClosedOpen Closed
        Fixed ReleaseNone 4.0
    2010-09-30 None Attached File- Added 20100930.txt, #21586
    2010-09-28 psmith Triage StatusNone Verified

    Back to the top

    Powered by Savane 3.12