Commit graph

1 commit

Author SHA1 Message Date
265871658f Add patch to lock output file for writing
The previous patch that we had, to use a temporary file, is useful:
it prevents the situation where a half-written file is present on disk under the
name that the readers expect. For example, this solves the scenario where the
write is interrupted, and then the build process is restarted and something
reads the partially written file. This could happen when using intltool-merge
during development.

Nevertheless, the existing patch doesn't actually solve the problem of
concurrent writes: the name of the temporary file is fixed, so if two writers
attempt to write the file, they may open the same temporary file and then
finally rename the temporary file to destination. Readers will then read a
corrupted file. This happens in
https://bugzilla.redhat.com/show_bug.cgi?id=2268342, where we get a message that
indicates the cache file is corrupted ("odd number of elements"), and a desktop
file with some missing translations is written.

Patch was verified by rebuilding xfce4-terminal 10 times with an inserted check
that the two desktop files contain the expected number of elements.

The patch was written by Bernhard Wiedemann and is available in the intltool
repo on launchpad (but misattributed).
2025-08-25 17:15:28 -05:00