bugmake - Bugs: bug #54233, Infinite loop w/ -j2 &...

 
 

bug #54233: Infinite loop w/ -j2 & multiple pattern rules

Submitter:  Aleksey Covacevice <alecov>
Submitted:  Mon 02 Jul 2018 06:10:19 PM UTC
   
 
Severity:  3 - Normal Item Group:  Bug
Status:  Fixed Privacy:  Public
Assigned to:  psmith Open/Closed:  Closed
Component Version:  4.2.1 Operating System:  Any
Fixed Release:  4.3 Triage Status:  Medium Effort
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 05 Aug 2018 12:25:03 PM UTC, comment #2: 

Thanks for this report.  This bug has been fixed in the current Git HEAD and will be included in the next release of GNU make.

Paul D. Smith <psmith>
Group administrator
Mon 02 Jul 2018 06:25:29 PM UTC, comment #1: 

The use case here is the following:

  • %.lnk/%.elf: the recipe links an .elf and touches a tag file (.lnk);
  • %.dbg/%.elf: the recipe produces a .dbg file, updating (touching) an .elf in the process; the rule must depend only on %.lnk or it will be triggered unnecessarily in the next build.


%.elf is mentioned as a target in both rules because it is updated (touched) by both rules. (.DELETE_ON_ERROR will delete .elf files when either rule fails, which is correct.)

A workaround is not using .ONESHELL nor single-line recipes; or refrain from mentioning %.elf as a prerequisite (and instead mentioning %.lnk).

Aleksey Covacevice <alecov>
Mon 02 Jul 2018 06:10:19 PM UTC, original submission:  

Make enters an infinite loop when `-j2` is used in the following situation:


# make -j2
# Try with a single-line recipe for %.elf/%.lnk or .ONESHELL.

#.ONESHELL:

all: a.elf a.dbg

%.elf \
%.lnk: %.c
        #$*.elf
        #$*.lnk

%.elf \
%.dbg: %.lnk
        #$*.elf
        #$*.dbg


If either `.ONESHELL:` is omitted or a single-line recipe is used for the `%.elf/%.lnk` target, make runs fine.

A quick inspection with `make -d` yields:


Considering target file 'all'.
 File 'all' does not exist.
  Considering target file 'a.elf'.
  File 'a.elf' was considered already.
  Considering target file 'a.dbg'.
   File 'a.dbg' does not exist.
    Considering target file 'a.lnk'.
    Still updating file 'a.lnk'.
    Considering target file 'a.c'.
    File 'a.c' was considered already.
   Finished prerequisites of target file 'a.dbg'.
  The prerequisites of 'a.dbg' are being made.
 Finished prerequisites of target file 'all'.
The prerequisites of 'all' are being made.
(...repeats indefinitely...)


Aleksey Covacevice <alecov>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #44493:  Makefile added by alecov (169B - application/octet-stream - Test case)

 

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)
  • -email is unavailable- added by alecov (Submitted the item)
  • -email is unavailable- added by alecov
  •  

    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 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-08-05 psmith StatusNone Fixed
        Assigned toNone psmith
        Open/ClosedOpen Closed
        Fixed ReleaseNone 4.3
        Triage StatusNone Medium Effort
    2018-07-02 alecov Attached File- Added Makefile, #44493
        Carbon-Copy- Added alecov

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code