From 52ccf6f393c3cd694e92f5d67772c7ad64edff843686550812a63361217a4120 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Lie?= Date: Wed, 10 May 2017 15:26:00 +0000 Subject: [PATCH] Accepting request 492503 from home:bmwiedemann:reproducible:test Add fixrace.patch to fix random desktop file corruptions (lp#1687644 boo#1021335) OBS-URL: https://build.opensuse.org/request/show/492503 OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/intltool?expand=0&rev=35 --- fixrace.patch | 43 +++++++++++++++++++++++++++++++++++++++++++ intltool.changes | 6 ++++++ intltool.spec | 3 +++ 3 files changed, 52 insertions(+) create mode 100644 fixrace.patch diff --git a/fixrace.patch b/fixrace.patch new file mode 100644 index 0000000..8eb2438 --- /dev/null +++ b/fixrace.patch @@ -0,0 +1,43 @@ +From: Bernhard M. Wiedemann + +avoid a race where some processes try to use a partial cache file +that is still being written to. +Note that we release the lock before load_cache, +because if we got the lock, the cache is already completely written +and it is OK to have multiple parallel readers + +Index: intltool-0.51.0/intltool-merge.in +=================================================================== +--- intltool-0.51.0.orig/intltool-merge.in ++++ intltool-0.51.0/intltool-merge.in +@@ -43,6 +43,7 @@ use Getopt::Long; + use Text::Wrap; + use File::Basename; + use Encode; ++use Fcntl qw(:flock); + + my $must_end_tag = -1; + my $last_depth = -1; +@@ -392,11 +393,14 @@ sub load_cache + + sub get_cached_translation_database + { ++ open(my $lockfh, ">", "$cache_file.lock") or die $!; ++ flock($lockfh, LOCK_EX) or die "Could not lock '$cache_file.lock' - $!"; + my $cache_file_age = -M $cache_file; + if (defined $cache_file_age) + { + if ($cache_file_age <= &get_newest_po_age) + { ++ close($lockfh); + &load_cache; + return; + } +@@ -404,6 +408,7 @@ sub get_cached_translation_database + } + + &create_cache; ++ close($lockfh); + } + + sub add_translation diff --git a/intltool.changes b/intltool.changes index 4766545..f92d35a 100644 --- a/intltool.changes +++ b/intltool.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Tue May 2 15:22:35 UTC 2017 - bwiedemann@suse.com + +- Add fixrace.patch to fix random desktop file corruptions + (lp#1687644 boo#1021335) + ------------------------------------------------------------------- Fri Apr 15 22:26:26 UTC 2016 - mgorse@suse.com diff --git a/intltool.spec b/intltool.spec index 4368f78..010292f 100644 --- a/intltool.spec +++ b/intltool.spec @@ -32,6 +32,8 @@ Url: https://edge.launchpad.net/intltool/ Source: https://launchpad.net/%{name}/trunk/%{version}/+download/%{name}-%{version}.tar.gz # PATCH-FIX-UPSTREAM intltool-perl-5.22.patch lp#1490906 dimstar@opensuse.org -- Fix execution with perl 5.22 Patch0: intltool-perl-5.22.patch +# PATCH-FIX-UPSTREAM fixrace.patch lp#1687644 boo#1021335 +Patch1: fixrace.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build %description @@ -43,6 +45,7 @@ information is written back into the XML files. %prep %setup -q %patch0 -p0 +%patch1 -p1 %build %configure