archrelease: copy trunk to extra-x86_64
[arch-packages.git] / intltool / repos / extra-any / intltool-fixrace.patch
blobb1cf59a90326c0d6e7b0cbb381457a2aa227ea70
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;
14 use Text::Wrap;
15 use File::Basename;
16 use Encode;
17 +use Fcntl qw(:flock);
19 my $must_end_tag = -1;
20 my $last_depth = -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)
32 + close($lockfh);
33 &load_cache;
34 return;
36 @@ -404,6 +408,7 @@ sub get_cached_translation_database
39 &create_cache;
40 + close($lockfh);
43 sub add_translation