bugmake - Bugs: bug #26864, make -j2 fails to rebuild...

 
 

bug #26864: make -j2 fails to rebuild intermediate file

Submitted by:  Manoj Srivastava <srivasta>
Submitted on:  Sun 21 Jun 2009 05:04:03 PM UTC  
Votes:  10  
 
Severity: 3 - NormalItem Group: Bug
Status: DuplicatePrivacy: Public
Assigned to: NoneOpen/Closed: Closed
Component Version: 3.81Operating System: POSIX-Based
Fixed Release: NoneTriage Status: Verified

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Mon 10 Sep 2012 05:24:21 AM UTC, comment #4:

I believe this is a duplicate of bug #30653

Paul D. Smith <psmith>
Project Administrator
Tue 27 Oct 2009 11:06:20 AM UTC, comment #3:

I have noticed the same thing, it seems to fix itself with the following pa

(file #18949)

Christian Häggström <saturn>
Sat 03 Oct 2009 09:28:23 PM UTC, comment #2:

I added a test for this into the test suite. I did some back-tracking and this bug was introduced with GNU make 3.81; GNU make 3.80 appears to work properly.

Paul D. Smith <psmith>
Project Administrator
Sun 02 Aug 2009 11:39:24 PM UTC, comment #1:

I can reproduce this even with the latest CVS version of make.

Paul D. Smith <psmith>
Project Administrator
Sun 21 Jun 2009 05:04:03 PM UTC, original submission:

This was reported by a Debian user. Here is how to reproduce the problem:

cat >Makefile <<"EOF"
# .bar files depend on .c files as well as foo.h
%.bar: %.c foo.h
cat $^ >$@ || rm $@

# foo.h is created from foo.in
foo.h: foo.h.in
cat $^ >$@ || rm $@

# main.c should be created from main.y below
EOF

cat >main.y <"EOF"
%%
command:
"q" { return 1; }
;
%%
EOF

echo bar >foo.h.in

# The initial build is fine
make -j2 main.bar
cat foo.h.in >foo.h || rm foo.h
yacc main.y
mv -f y.tab.c main.c
cat main.c foo.h >main.bar || rm main.bar
rm main.c

# But touch foo.h.in and things go wrong
touch foo.h.in
make -j2 main.bar
cat foo.h.in >foo.h || rm foo.h
cat main.c foo.h >main.bar || rm main.bar
cat: main.c: No such file or directory

# Here 'make -j2' decides to rebuild main.bar without first
# recreating main.c although we explicitly stated that main.bar
# depends on main.c. Here is what that command says with -d:

Considering target file `main.bar'.
Considering target file `main.y'. <--- Should be main.c
File `main.y' was considered already.
Considering target file `foo.h'.
File `foo.h' was considered already.
Pruning file `main.c'. <--- ???
Finished prerequisites of target file `main.bar'.
Prerequisite `main.c' of target `main.bar' does not exist. <--- !!!
Prerequisite `foo.h' is newer than target `main.bar'.
Must remake target `main.bar'.
cat main.c foo.h >main.bar || rm main.bar
cat: main.c: No such file or directory <--- Doh!

# The next attempt works though (but this time make does not
# have to rebuild foo.h)
make -j2 main.bar
yacc main.y
mv -f y.tab.c main.c
cat main.c foo.h >main.bar || rm main.bar
rm main.c

# Compare this with 'make -j1'
touch foo.h.in
make -j1 main.bar
cat foo.h.in >foo.h || rm foo.h
yacc main.y
mv -f y.tab.c main.c
cat main.c foo.h >main.bar || rm main.bar
rm main.c

# Here make correctly realizes it must rebuild main.c before attempting
# to run the command to generate main.bar. And the corresponding make
# -d output:

Prerequisite `foo.h.in' is newer than target `foo.h'.
Must remake target `foo.h'.
cat foo.h.in >foo.h || rm foo.h
Successfully remade target file `foo.h'.
Considering target file `main.c'. <--- Correct target
File `main.c' does not exist.
Pruning file `main.y'.
Finished prerequisites of target file `main.c'.
Must remake target `main.c'. <--- Yes!
yacc main.y
mv -f y.tab.c main.c
Must remake target `main.bar'.
cat main.c foo.h >main.bar || rm main.bar
Successfully remade target file `main.bar'.
Removing intermediate files...
rm main.c

It looks like make -j2 swapped main.c and main.y

I can't get around the fact that there is a reproducible
difference based on whether or not the -j2 argument was give,

manoj

Manoj Srivastava <srivasta>

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #18949:  make.patch added by saturn (658B - text/x-diff - I have encountered the same problem, and it seems to be fixed by the attached patch. I haven't tried the testcase posted here though.)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by max_r (Voted in favor of this item)
  • -unavailable- added by saturn (Updated the item)
  • -unavailable- added by psmith (Posted a comment)
  • -unavailable- added by srivasta (Submitted the item)
  • -unavailable- added by srivasta (http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=530855)
  • -unavailable- added by srivasta (http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=530855)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 10 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 8 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 10 Sep 2012 05:24:21 AM UTCpsmithStatusNone=>Duplicate
      Open/ClosedOpen=>Closed
    Fri 16 Apr 2010 01:47:10 PM UTCmax_rCarbon-Copy-=>Added max_r
    Tue 27 Oct 2009 11:06:20 AM UTCsaturnAttached File-=>Added make.patch, #18949
    Sat 03 Oct 2009 09:28:23 PM UTCpsmithTriage StatusMedium Effort=>Verified
    Sun 02 Aug 2009 11:39:24 PM UTCpsmithTriage StatusNone=>Medium Effort
    Sun 21 Jun 2009 05:04:03 PM UTCsrivastaCarbon-Copy-=>Added -unavailable-
      Carbon-Copy-=>Added francois gouget

    Back to the top


    Powered by Savane 3.1-cleanup1