1 From d328542bea50b9445c63cdf2454052392282a1ce Mon Sep 17 00:00:00 2001
2 From: Colin Walters <walters@verbum.org>
3 Date: Thu, 8 Oct 2015 16:25:47 -0400
4 Subject: [PATCH] intltool-merge: Create cache file atomically
6 It's going to be relatively common for build systems operating in
7 parallel to run multiple copies of `intltool-merge`, yet the cache
8 file is not created atomically (i.e. with the "open .tmp file and
11 I suspect (but have not yet determined conclusively) this is the cause
12 of some systemd build issues where translations don't appear in the
15 Regardless, this patch can't hurt.
17 intltool-merge.in | 3 ++-
18 1 file changed, 2 insertions(+), 1 deletion(-)
20 diff --git a/intltool-merge.in b/intltool-merge.in
21 index 1afa2a4..d1eba8f 100644
22 --- a/intltool-merge.in
23 +++ b/intltool-merge.in
24 @@ -371,9 +371,10 @@ sub create_cache
26 &create_translation_database;
28 - open CACHE, ">$cache_file" || die;
29 + open CACHE, ">$cache_file" . ".tmp" || die;
30 print CACHE join "\x01", %translations;
32 + rename("$cache_file" . ".tmp", "$cache_file");