[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Parallel build results

* Patrick Schoenfeld <schoenfeld@in-medias-res.com> [071202 20:43]:
> Relevant parts for detox are:
> /usr/bin/install -c -d /tmp/buildd/detox-1.1.1/debian/tmp/etc
> /usr/bin/install: cannot create regular file
> `/tmp/buildd/detox-1.1.1/debian/tmp/etc/detoxrc.sample': No such file or
> directory
> So I assume the first install command for debian/tmp/etc was not
> successful? I'm not very experienced with parallel builds and I cannot
> reproduce this on my single-core-systems. So: Is there some
> documentation or hints on how to make package building be parallel-safe?

The problem is in upstream's Makefile.in:

install: install-base install-safe-config install-sample-config

install-base: detox
        ${INSTALL} -d ${DESTDIR}${sysconfdir}

        @if [ ! -f ${DESTDIR}${sysconfdir}/detoxrc ]; then \
                ${INSTALL} detoxrc ${DESTDIR}${sysconfdir}; \

As you can see, install says it needs install-base and install-sample-config
but install-sample-config does not say it wants install-base to be run before
it is run, so nothing enforces sysconfigdir is actually created.
Only when install-safe-config is run while install-base had not yet had enough
time to complete directory creating, this produces an error.

The fix for this problem is just to tell install-safe-config (and the other
install-* stuff needing a directory) to either create the directory first or
depend on the rule that creates it.

Catching those race conditions is hard, even a -jN run might just not trigger it
if the directory creating is fast enough. Perhaps someone would like to write a
patched make that does reorderable target in reversed order and try to build the
whole archive with it (and -j1), to catch those problems more reliable.

	Bernhard R. Link
"Never contain programs so few bugs, as when no debugging tools are available!"
	Niklaus Wirth

Reply to: