Re: Parallel make race in 5.1

2021-01-19 Thread Chet Ramey

On 1/19/21 9:19 AM, Richard Purdie wrote:

Hi,

In bash 5.1 we're seeing a parallel make race during build, as found a
couple of times in our automated CI for Yocto Project:


Thanks for the report. Interesting. I haven't seen this one either.


The issue is around pipesize.h which in 5.1 can be built by two
different triggers, builtins/ulimit.o or redir.o.

They can race against each other and rewrite files causing the above
failure.


I suppose that workaround will do, since it should only be built one time,
no matter how many times you run make.

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRUc...@case.eduhttp://tiswww.cwru.edu/~chet/



Parallel make race in 5.1

2021-01-19 Thread Richard Purdie
Hi,

In bash 5.1 we're seeing a parallel make race during build, as found a
couple of times in our automated CI for Yocto Project:

https://autobuilder.yoctoproject.org/typhoon/#/builders/80/builds/1720/steps/14/logs/stdio
https://autobuilder.yoctoproject.org/typhoon/#/builders/44/builds/2969/steps/25/logs/stdio

The issue is around pipesize.h which in 5.1 can be built by two
different triggers, builtins/ulimit.o or redir.o.

They can race against each other and rewrite files causing the above
failure.

We added a bit of a hacky workaround:

Index: bash-5.1/Makefile.in
===
--- bash-5.1.orig/Makefile.in
+++ bash-5.1/Makefile.in
@@ -746,7 +746,7 @@ ${DEFDIR}/bashgetopt.o: $(BUILTIN_SRCDIR
 ${DEFDIR}/builtext.h: $(BUILTIN_DEFS)
@(cd $(DEFDIR) && $(MAKE) $(MFLAGS) builtext.h ) || exit 1
 
-${DEFDIR}/pipesize.h:
+${DEFDIR}/pipesize.h: $(BUILTINS_LIBRARY)
@(cd $(DEFDIR) && $(MAKE) $(MFLAGS) pipesize.h ) || exit 1
 
 $(SDIR)/man2html$(EXEEXT): ${SUPPORT_SRC}/man2html.c

Cheers,

Richard