reticulatedpines / magiclantern_simplified

A Git based version of Magic Lantern, for those unwilling or unable to work using Mercurial. The vast majority of branches have been removed, with those thought to be important brought in individually and merged.
GNU General Public License v2.0
142 stars 47 forks source link

Audit makefiles for bad >> usage, race condition #146

Open reticulatedpines opened 1 month ago

reticulatedpines commented 1 month ago

In multiple places, we build up a file using >> with shell commands for concatenating output. If the target file is a dependency for a make target, e.g. version.c, which version.o depends on, and you build in parallel, it's possible for version.o to attempt to build with an intermediate version of the file, since it may exist on disk at any stage in the process of concatenating file data.

We should probably concat into a temp file, and move that to the correct name as the final step, so intermediate content cannot be seen.