WebKit/DerivedSources.make is written such that generate-message-receiver.py can be invoked N times, where N is the value passed to -j. This results in the N invocations of generate-message-receiver.py trying trying to generate the same set of files at the same time, possibly leading to their being corrupted. We have reports of generated files starting with a 4K block of NULs, and this contention may be causing it. Address this by using a "pattern rule" in the makefile, which is documented in GNU make's documentation as the approach to take when there is one build rule that creates multiple outputs, as is the case here. See also Bug 166814 and <http://trac.webkit.org/changeset/210507>.
rdar://problem/63595589
Created attachment 405775 [details] Patch
Committed r265178: <https://trac.webkit.org/changeset/265178> All reviewed patches have been landed. Closing bug and clearing flags on attachment 405775 [details].
Comment on attachment 405775 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=405775&action=review > Source/WebKit/DerivedSources.make:257 > +MESSAGES_FILES := $(addsufix Messages.h,$(notdir $(MESSAGE_RECEIVERS))) The "addsuffix" here was missing an "f" so this didn’t quite work. Also, I did some further research, and I think a better solution is a "grouped target" rather than a pattern rule.
I put a fix for those things into bug 215064.
I commented in <rdar://problem/63595589> that "grouped targets" won't work.
That missing "f" was from the original code. I wonder how long it had been broken that way.
Issue was introduced May 6 with r261254. The first report of the generated file corruption was on May 25.
That revision replaced the existing pattern rule with a non-pattern rule! I think we found the root cause.