[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
race condition in build system
From: |
Mike Frysinger |
Subject: |
race condition in build system |
Date: |
Sun, 26 Aug 2007 13:08:08 -0400 |
User-agent: |
KMail/1.9.7 |
the top level Makefile has a race condition in the readline subdir due to how
it's been architected ...
start with the bash deps:
$(Program): ... $(LIBDEP) ...
LIBDEP expands to:
LIBDEP = ... $(READLINE_DEP) $(HISTORY_DEP) ...
and the DEP vars expant to the LIBRARY vars:
$(READLINE_LIBRARY): ...
cd ${RL_LIBDIR} && $(MAKE) ... libreadline.a ...
$(HISTORY_LIBRARY): ...
cd ${HIST_LIBDIR} && $(MAKE) ... libhistory.a ...
RL_LIBDIR and HIST_LIBDIR are the same (lib/readline/) and once we peek in
there, we see that libreadline.a and libhistory.a have some common files ...
which brings us to the problem
the top level thinks it can build libreadline.a and libhistory.a in parallel
so forks two sep jobs to descend into lib/readline/ and tries to build up the
same object files which can lead to failure. consider the case where
xmalloc.o doesnt exist, so both makes start to process it ... one finishes
and moves on to building the static archive, but as it is executing the `ar`,
the other make deletes the xmalloc.o which makes the `ar` command angry.
i think an acceptable workaround here is for the toplevel $(HISTORY_LIBRARY)
to depend on $(READLINE_LIBRARY) seeing as how in the subdir, it already
effectively does according to the object list ...
-mike
signature.asc
Description: This is a digitally signed message part.
--- bash-3.2/Makefile.in
+++ bash-3.2/Makefile.in
@@ -584,7 +584,9 @@
@( { test "${RL_LIBDIR}" = "${libdir}" && exit 0; } || \
cd ${RL_LIBDIR} && $(MAKE) $(MFLAGS) libreadline.a) || exit 1
-$(HISTORY_LIBRARY): config.h $(HISTORY_SOURCE)
+# prevent parallel build race conditions in the lib/readline/ subdir
+# by depending on libreadline.a when applicable
+$(HISTORY_LIBRARY): config.h $(HISTORY_SOURCE) $(READLINE_DEP)
@echo making $@ in ${HIST_LIBDIR}
@( { test "${HIST_LIBDIR}" = "${libdir}" && exit 0; } || \
cd ${HIST_LIBDIR} && $(MAKE) $(MFLAGS) libhistory.a) || exit 1
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- race condition in build system,
Mike Frysinger <=