[PATCH] gpg, gpgsm, python: atomic directory creation

Alon Bar-Lev alon.barlev at gmail.com
Wed Oct 19 11:04:07 CEST 2016


* lang/python/tests/Makefile.am,
tests/gpg/Makefile.am,
tests/gpgsm/Makefile.am: atomic directory creation.

--
Solves race in parallel build when mkdir fails if directory exists.

Signed-off-by: Alon Bar-Lev <alon.barlev at gmail.com>
---
 lang/python/tests/Makefile.am | 2 +-
 tests/gpg/Makefile.am         | 2 +-
 tests/gpgsm/Makefile.am       | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lang/python/tests/Makefile.am b/lang/python/tests/Makefile.am
index aa88bdc..39f532c 100644
--- a/lang/python/tests/Makefile.am
+++ b/lang/python/tests/Makefile.am
@@ -89,7 +89,7 @@ clean-local:
 
 
 ./private-keys-v1.d/gpg-sample.stamp: $(private_keys)
-	test -d ./private-keys-v1.d || mkdir ./private-keys-v1.d
+	$(MKDIR_P) ./private-keys-v1.d
 	for k in $(private_keys); do \
           cp $$k private-keys-v1.d/$${k#$(test_srcdir)/}.key; \
         done
diff --git a/tests/gpg/Makefile.am b/tests/gpg/Makefile.am
index 2538f63..044bf3a 100644
--- a/tests/gpg/Makefile.am
+++ b/tests/gpg/Makefile.am
@@ -90,7 +90,7 @@ export GNUPGHOME := $(abs_builddir)
 export GPG_AGENT_INFO :=
 
 ./private-keys-v1.d/gpg-sample.stamp: $(srcdir)/$(private_keys)
-	test -d ./private-keys-v1.d || mkdir ./private-keys-v1.d
+	$(MKDIR_P) ./private-keys-v1.d
 	for k in $(private_keys); do \
           cp $(srcdir)/$$k private-keys-v1.d/$$k.key; \
         done
diff --git a/tests/gpgsm/Makefile.am b/tests/gpgsm/Makefile.am
index 41645b6..46d6a9b 100644
--- a/tests/gpgsm/Makefile.am
+++ b/tests/gpgsm/Makefile.am
@@ -70,7 +70,7 @@ export GPG_AGENT_INFO :=
 	echo faked-system-time 1008241200 >> ./gpgsm.conf
 
 ./private-keys-v1.d/$(key_id).key: $(srcdir)/$(key_id)
-	test -d ./private-keys-v1.d || mkdir ./private-keys-v1.d
+	$(MKDIR_P) ./private-keys-v1.d
 	cp $(srcdir)/$(key_id) private-keys-v1.d/$(key_id).key
 
 ./trustlist.txt:
-- 
2.7.3




More information about the Gnupg-devel mailing list