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

 
 

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

Submitter:  Manoj Srivastava <srivasta>
Submitted:  Sun 21 Jun 2009 05:04:03 PM UTC
Votes: 10
 
Severity:  3 - Normal Item Group:  Bug
Status:  Duplicate Privacy:  Public
Assigned to:  None Open/Closed:  Closed
Component Version:  3.81 Operating System:  POSIX-Based
Fixed Release:  None Triage Status:  Verified
* Mandatory Fields

Add a New Comment Rich Markup
   

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

I believe this is a duplicate of bug #30653

Paul D. Smith <psmith>
Group 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>
Group 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>
Group 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 Files:
   
   
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
  • -email is unavailable- added by max_r (Voted in favor of this item)
  • -email is unavailable- added by saturn (Updated the item)
  • -email is unavailable- added by psmith (Posted a comment)
  • -email is unavailable- added by srivasta (Submitted the item)
  • -email is unavailable- added by srivasta (http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=530855)
  • -email is unavailable- added by srivasta (http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=530855)
  •  

    There are 10 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 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2012-09-10 psmith StatusNone Duplicate
        Open/ClosedOpen Closed
    2010-04-16 max_r Carbon-Copy- Added max_r
    2009-10-27 saturn Attached File- Added make.patch, #18949
    2009-10-03 psmith Triage StatusMedium Effort Verified
    2009-08-02 psmith Triage StatusNone Medium Effort
    2009-06-21 srivasta Carbon-Copy- Added -email is unavailable-
        Carbon-Copy- Added francois gouget <fgouget@free.fr>

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code