Current-Users archive

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

Re: parallel build failure with .c.o rule interrupted mid-step!



Am 24.02.2025 um 21:04 schrieb Greg A. Woods:
> In jobs mode make is supposed to feed the whole rule's script to one
> invocation of a shell, and in theory that invocation should run to
> completion even if some other parallel branch of make encounters an
> error.

That's how it _should_ work.

I made up a little test case (see the attached Makefile), and that test
fails sometimes when I interrupt it by pressing Ctrl+C.

$ ktrace -i make -r -j20   # press Ctrl+C in the middle
$ make -r clean && ls -l

At this point, there may be one or more files named 'target-*' left that
are smaller than the expected 14 bytes.

I got the ktrace log from the above command and will further analyze it.

Roland
dirs=		20
targets=	20

all: .PHONY

.for d in ${:U:${:Urange=${dirs}}}

all: dir-$d

dir-$d: .PHONY
	@${MAKE} -f ${MAKEFILE} do-dir-$d

do-dir-$d: .PHONY

.  for t in ${:U:${:Urange=${targets}}}

do-dir-$d: target-$d-$t

target-$d-$t:
	@echo one > $@
	@echo two >> $@
	@echo three >> $@
	# Make one of the commands fail in the middle.
	@${:U$d$t:M1515}

.  endfor
.endfor

clean:
	@find . -name 'target-*' -size 14c -delete


Home | Main Index | Thread Index | Old Index