nbdtab_lexer.l includes (and thus depends on) nbdtab_parser.tab.h, which in turn is dynamically generated during the build from nbdtab_parser.y (via bison). However, this dependency is currently only implicit in Makefile.am. Building nbd with parallel make can thus fail via a race condition, where nbdtab_lexer.l is processed before nbdtab_parser.tab.h has been created.
While parallel make seems to work fine most of the time, I've actually run into this issue with failed builds in practice, when fixing a bug in (and thus repeatedly emerging) Gentoo's live ebuild for nbd while my hard drive was under load from another task (which seems to have triggered the race condition). Looking into it, I could then also reproduce the issue by manually cloning the git repo and running ./autogen.sh, ./configure, and make -j8 -l8:
nbd_failed_parallel_make.log
I'll add a pull request that solves this issue in my view.
PS: An artificial way to trigger the race condition is to run
git clean -dfxq && ./autogen.sh && ./configure && sed -i 's/^\tbison/\tsleep 10; bison/' Makefile && make -j8 -l8
nbdtab_lexer.l
includes (and thus depends on)nbdtab_parser.tab.h
, which in turn is dynamically generated during the build fromnbdtab_parser.y
(via bison). However, this dependency is currently only implicit inMakefile.am
. Building nbd with parallel make can thus fail via a race condition, wherenbdtab_lexer.l
is processed beforenbdtab_parser.tab.h
has been created.While parallel make seems to work fine most of the time, I've actually run into this issue with failed builds in practice, when fixing a bug in (and thus repeatedly emerging) Gentoo's live ebuild for nbd while my hard drive was under load from another task (which seems to have triggered the race condition). Looking into it, I could then also reproduce the issue by manually cloning the git repo and running
./autogen.sh
,./configure
, andmake -j8 -l8
: nbd_failed_parallel_make.logI'll add a pull request that solves this issue in my view.
PS: An artificial way to trigger the race condition is to run
git clean -dfxq && ./autogen.sh && ./configure && sed -i 's/^\tbison/\tsleep 10; bison/' Makefile && make -j8 -l8