intltool: avoid process race

This commit is contained in:
Nathan Owens 2019-01-01 12:41:39 -06:00 committed by maxice8
parent 57e20e6f5a
commit b7957aec97
2 changed files with 39 additions and 3 deletions

View file

@ -0,0 +1,36 @@
https://bazaar.launchpad.net/~intltool/intltool/trunk/revision/748?start_revid=748
=== modified file 'intltool-merge.in'
--- intltool-merge.in 2014-11-24 02:37:01 +0000
+++ intltool-merge.in 2017-05-18 19:09:18 +0000
@@ -43,6 +43,7 @@
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 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 @@
}
&create_cache;
+ close($lockfh);
}
sub add_translation

View file

@ -1,7 +1,7 @@
# Template build file for 'intltool'.
# Template file for 'intltool'
pkgname=intltool
version=0.51.0
revision=4
revision=5
noarch=yes
build_style=gnu-configure
hostmakedepends="perl-XML-Parser"
@ -9,7 +9,7 @@ makedepends="perl-XML-Parser gettext"
depends="${makedepends}"
short_desc="Toolbox for internationalization"
maintainer="Juan RP <xtraeme@voidlinux.eu>"
license="GPL-2"
license="GPL-2.0-or-later"
homepage="https://edge.launchpad.net/intltool"
distfiles="http://launchpad.net/intltool/trunk/$version/+download/$pkgname-$version.tar.gz"
checksum=67c74d94196b153b774ab9f89b2fa6c6ba79352407037c8c14d5aeb334e959cd