bugmake - Bugs: bug #42910, chained implicit rule can fail to...

 
 

bug #42910: chained implicit rule can fail to make a prerequisite

Submitted by:  Manoj Srivastava <srivasta>
Submitted on:  Mon 04 Aug 2014 09:25:37 PM UTC  
 
Severity: 3 - NormalItem Group: Bug
Status: Works for mePrivacy: Public
Assigned to: NoneOpen/Closed: Closed
Component Version: 3.81Operating System: POSIX-Based
Fixed Release: NoneTriage Status: None

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Sun 12 Jul 2015 09:56:20 PM UTC, comment #1:

Hi Manoj; I ran the test with both 3.81 and 3.82 and it failed almost immediately: I ran it 100 times with 4.0 and 4.1 and couldn't reproduce the failure. So, some change between 3.82 and 4.0 fixed the issue; unfortunately I'm not sure which one so I can't help with that. It probably wouldn't be too difficult to use git bisect to find the particular change if you wanted to backport it.

Paul D. Smith <psmith>
Project Administrator
Mon 04 Aug 2014 09:25:37 PM UTC, original submission:

Gi,

This was reported by a Debian user. Please retain a CC to -unavailable- so that the Debian BTS has a record of this issue.

Please note that I have been unable top reproduce this with 4.0.X versiosn of make, so this issue may have been resolved. It would help if we knew what the fix wwas, and any information that helps us backport it to Debian stable would be appreciated.

have a Makefile where make appears to decide to use the 2nd of a
pair of chained implicit rules to construct a file, despite having earlier rejected this same pair of rules when deciding whether to build the necessasry intermediate file.

As a result, make can run the rules for the 2nd implicit rule despite the fact that one of its prerequisites has not been built. The ommands for the 2nd rule then fail.

To reproduce:

Firstly, preparation:

$ git clone git://git.chiark.greenend.org.uk/~ianmdlvl/adns.git
[ usual output from git clone ]
$ cd adns
$ git checkout make-bug.2014-07-26
[ warning about git about detached HEAD ]
$ ./configure
$ make
[ build should complete successfully ]
$ cd regress

Now repeat the following steps until you lose the race like this:

$ touch ../src/addrfam.c
$ make -j2
gcc -g -O2 -Wall -Wmissing-prototypes -Wwrite-strings -Wstrict-prototypes -Wcast-qual -Wpointer-arith -Wno-pointer-sign -I../src -I. -I./../src -DADNS_REGRESS_TEST -I. -c -g -o addrfam_d.o ../src/addrfam.c
gcc adnstest_c.o hrecord.o hcommon.o types_d.o event_d.o query_d.o reply_d.o general_d.o setup_d.o transmit_d.o parse_d.o poll_d.o check_d.o addrfam_d.o -o adnstest_record
gcc: error: adnstest_c.o: No such file or directory
make: *** [adnstest_record] Error 1
$

(If you win the race it rebuilds adnstest_c.o again.)

Detailed consideration of the manual node `Implicit Rule Search'
suggests that the Makefile is correct by virtue of para.6: while the intermediate file adnstest_c.o does not exist, and is not mentioned as a target or explicit prerequisite, it can be made.

So make is correct to try to use this rule. But of course it ought to construct the file first.

The bug occurs only with nontrivial -j options. I have reproduced it with -j4 and (as here) -j2.

I have also, once, seen it do this:

regress$ touch ../src/addrfam.c; make -j adnstest_record
gcc -g -O2 -Wall -Wmissing-prototypes -Wwrite-strings -Wstrict-prototypes -Wcast-qual -Wpointer-arith -Wno-pointer-sign -I../src -I. -I./../src -DADNS_REGRESS_TEST -I. -c -g -o addrfam_d.o ../src/addrfam.c
regress$

Manoj Srivastava <srivasta>

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by psmith (Posted a comment)
  • -unavailable- added by srivasta (Submitted the item)
  • -unavailable- added by srivasta
  • -unavailable- added by srivasta
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 12 Jul 2015 09:56:20 PM UTCpsmithStatusNone=>Works for me
      Open/ClosedOpen=>Closed
    Mon 04 Aug 2014 09:25:37 PM UTCsrivastaCarbon-Copy-=>Added -unavailable-
      Carbon-Copy-=>Added -unavailable-

    Back to the top


    Powered by Savane 3.1-cleanup1