Patchwork glib-2.0: fix race in parallel builds

login
register
mail settings
Submitter Ross Burton
Date Feb. 4, 2014, 4:16 p.m.
Message ID <1391530589-1800-1-git-send-email-ross.burton@intel.com>
Download mbox | patch
Permalink /patch/66311/
State New
Headers show

Comments

Ross Burton - Feb. 4, 2014, 4:16 p.m.
There is a race condition in the makefile that can result in build failures like
this in parallel builds:

| ./gdbus-test-codegen-generated.h:7:0: error: unterminated #ifndef
|  #ifndef __GDBUS_TEST_CODEGEN_GENERATED_H__

Fix the rules to stop this happening.

Signed-off-by: Ross Burton <ross.burton@intel.com>
---
 .../glib-2.0/glib-2.0/gio-test-race.patch          |   54 ++++++++++++++++++++
 meta/recipes-core/glib-2.0/glib-2.0_2.38.2.bb      |    1 +
 2 files changed, 55 insertions(+)
 create mode 100644 meta/recipes-core/glib-2.0/glib-2.0/gio-test-race.patch

Patch

diff --git a/meta/recipes-core/glib-2.0/glib-2.0/gio-test-race.patch b/meta/recipes-core/glib-2.0/glib-2.0/gio-test-race.patch
new file mode 100644
index 0000000..720ea6c
--- /dev/null
+++ b/meta/recipes-core/glib-2.0/glib-2.0/gio-test-race.patch
@@ -0,0 +1,54 @@ 
+Upstream-Status: Submitted
+Signed-off-by: Ross Burton <ross.burton@intel.com>
+
+From a047a0270ee5faf1d9d6080cbc613defdf52baea Mon Sep 17 00:00:00 2001
+From: Ross Burton <ross.burton@intel.com>
+Date: Tue, 4 Feb 2014 13:15:08 +0000
+Subject: [PATCH] gio/tests: fix race when generating code
+
+There is a race condition in the makefile that can result in build failures like this in parallel builds:
+
+| ./gdbus-test-codegen-generated.h:7:0: error: unterminated #ifndef
+|  #ifndef __GDBUS_TEST_CODEGEN_GENERATED_H__
+
+This is because a rule like this:
+
+x.c x.h: prerequisites
+	@commands
+
+doesn't consider x.c and x.h together. Instead, it expands to two rules, one to
+generate x.c and one to generate x.h, which happen to run the same commands.  In
+the worst case they execute in parallel, overwriting each other's output.
+
+Signed-off-by: Ross Burton <ross.burton@intel.com>
+
+https://bugzilla.gnome.org/show_bug.cgi?id=723616
+---
+ gio/tests/Makefile.am |    4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/gio/tests/Makefile.am b/gio/tests/Makefile.am
+index 0beb239..270faf6 100644
+--- a/gio/tests/Makefile.am
++++ b/gio/tests/Makefile.am
+@@ -436,7 +436,7 @@ gmenumodel_SOURCES                       = $(gdbus_sessionbus_sources) gmenumode
+ gnotification_SOURCES                    = $(gdbus_sessionbus_sources) gnotification.c gnotification-server.h gnotification-server.c
+ 
+ gdbus-test-codegen.o: gdbus-test-codegen-generated.h
+-gdbus-test-codegen-generated.h gdbus-test-codegen-generated.c: test-codegen.xml Makefile $(top_builddir)/gio/gdbus-2.0/codegen/gdbus-codegen
++gdbus-test-codegen-generated.h: test-codegen.xml Makefile $(top_builddir)/gio/gdbus-2.0/codegen/gdbus-codegen
+ 	$(AM_V_GEN) UNINSTALLED_GLIB_SRCDIR=$(top_srcdir) \
+ 		UNINSTALLED_GLIB_BUILDDIR=$(top_builddir) \
+ 		$(PYTHON) $(top_builddir)/gio/gdbus-2.0/codegen/gdbus-codegen \
+@@ -455,6 +455,8 @@ gdbus-test-codegen-generated.h gdbus-test-codegen-generated.c: test-codegen.xml
+ 		--annotate "org.project.Bar::TestSignal[array_of_strings]" Key8 Value8 \
+ 		$(srcdir)/test-codegen.xml \
+ 		$(NULL)
++gdbus-test-codegen-generated.c: gdbus-test-codegen-generated.h
++	@: # Generated as side-effect of .h
+ 
+ EXTRA_DIST += test-codegen.xml
+ CLEANFILES += gdbus-test-codegen-generated.[ch] gdbus-test-codegen-generated-doc-*.xml
+-- 
+1.7.10.4
+
diff --git a/meta/recipes-core/glib-2.0/glib-2.0_2.38.2.bb b/meta/recipes-core/glib-2.0/glib-2.0_2.38.2.bb
index 161f7da..6c336f7 100644
--- a/meta/recipes-core/glib-2.0/glib-2.0_2.38.2.bb
+++ b/meta/recipes-core/glib-2.0/glib-2.0_2.38.2.bb
@@ -14,6 +14,7 @@  SRC_URI = "${GNOME_MIRROR}/glib/${SHRT_VER}/glib-${PV}.tar.xz \
            file://ptest-dbus.patch \
            file://ptest-paths.patch \
            file://gtest-skip-fixes.patch \
+           file://gio-test-race.patch \
           "
 
 SRC_URI_append_class-native = " file://glib-gettextize-dir.patch"