1 From: Bernhard M. Wiedemann <bmwiedemann+intltool@suse.de>
3 avoid a race where some processes try to use a partial cache file
4 that is still being written to.
5 Note that we release the lock before load_cache,
6 because if we got the lock, the cache is already completely written
7 and it is OK to have multiple parallel readers
9 Index: intltool-0.51.0/intltool-merge.in
10 ===================================================================
11 --- intltool-0.51.0.orig/intltool-merge.in
12 +++ intltool-0.51.0/intltool-merge.in
13 @@ -43,6 +43,7 @@ use Getopt::Long;
17 +use Fcntl qw(:flock);
19 my $must_end_tag = -1;
21 @@ -392,11 +393,14 @@ sub load_cache
23 sub get_cached_translation_database
25 + open(my $lockfh, ">", "$cache_file.lock") or die $!;
26 + flock($lockfh, LOCK_EX) or die "Could not lock '$cache_file.lock' - $!";
27 my $cache_file_age = -M $cache_file;
28 if (defined $cache_file_age)
30 if ($cache_file_age <= &get_newest_po_age)
36 @@ -404,6 +408,7 @@ sub get_cached_translation_database