Ticket #900 (new defect)

Opened 11 years ago

Last modified 11 years ago

Parallel builds of discuss can fail due to unsafe Makefile

Reported by: achernya Owned by:
Priority: normal Milestone: The Distant Future
Component: -- Keywords:
Cc: mitchb Fixed in version:
Upstream bug:


The Makefile in discuss/server has the following block:

rpproc.k.o: rpproc.c
        ${CC} ${ALL_CFLAGS} -DINETD -c rpproc.c
        mv rpproc.o rpproc.k.o

rpproc.nk.o: rpproc.c
        ${CC} ${ALL_CFLAGS} -DSUBPROC -DNOKERBEROS -c rpproc.c
        mv rpproc.o rpproc.nk.o

rpproc.debug.o: rpproc.c
        ${CC} ${ALL_CFLAGS} -c rpproc.c
        mv rpproc.o rpproc.debug.o

When performing a parallel make, it is possible that the compilation will finish at approximately the same time, and then the object files will be clobbered, resulting in mv being unable to find the file.

I saw this bug while building discuss for Scripts, but was unable to reproduce it on Debathena because I could not convince debuild to run "make -j2".

Change History

comment:1 Changed 11 years ago by mitchb

  • Cc mitchb added

Theoretically, that's the least bad result of this race. You can also end up with the commands being interleaved and either discussd or disserve being successfully linked with the other daemon's rpproc.o, which effectively switches which daemon it is. Presumably the other one would also fail to build for lack of any rpproc.o at all, though.

Geoff does point out that we should be able to solve this by not moving anything, and just passing '-o rpproc.foo.o' to the CC line. I don't know what the history is in terms of why we didn't do that originally, but I could believe one of the ancient Athena platforms' linkers didn't honor it.

Note: See TracTickets for help on using tickets.