[gnome-continuous-yocto/gnomeostree-3.22-krogoth: 56/246] busybox: Avoid race building libbb



commit 8a7607f470ae2a63e9c7b0caddd0db2f6b259053
Author: Juro Bystricky <juro bystricky intel com>
Date:   Wed Sep 14 10:05:46 2016 -0700

    busybox: Avoid race building libbb
    
    When building busybox, an occasional error was observed.
    The error is consistently the same:
    
    libbb/appletlib.c:164:13: error: 'NUM_APPLETS' undeclared (first use in this function)
      while (i < NUM_APPLETS) {
    
    The reason is the include file where NUM_APPLETS is defined is not yet generated (or is being modified)
    at the time libbb/appletlib.c is compiled.
    The attached patchset fixes the problem by assuring libb is compiled as the last directory.
    
    [YOCTO#10116]
    
    (From OE-Core rev: a866a05e2c7d090a77aa6e95339c93e3592703a6)
    
    (From OE-Core rev: 6c94afadaa3e035bb58755985a9e193cae5e9b34)
    
    Signed-off-by: Juro Bystricky <juro bystricky intel com>
    Signed-off-by: Richard Purdie <richard purdie linuxfoundation org>
    Signed-off-by: Armin Kuster <akuster808 gmail com>
    Signed-off-by: Richard Purdie <richard purdie linuxfoundation org>

 .../busybox-kbuild-race-fix-commit-d8e61bb.patch   |   53 ++++++++++++++++
 .../commit-applet_tables-fix-commit-0dddbc1.patch  |   61 ++++++++++++++++++
 .../busybox/busybox/makefile-libbb-race.patch      |   34 ++++++++++
 .../busybox/busybox/parallel-make-fix.patch        |   65 --------------------
 meta/recipes-core/busybox/busybox_1.24.1.bb        |    4 +-
 5 files changed, 151 insertions(+), 66 deletions(-)
---
diff --git a/meta/recipes-core/busybox/busybox/busybox-kbuild-race-fix-commit-d8e61bb.patch 
b/meta/recipes-core/busybox/busybox/busybox-kbuild-race-fix-commit-d8e61bb.patch
new file mode 100644
index 0000000..38302e0
--- /dev/null
+++ b/meta/recipes-core/busybox/busybox/busybox-kbuild-race-fix-commit-d8e61bb.patch
@@ -0,0 +1,53 @@
+Upstream-Status: Backport
+
+Patch addressing a parallel make race in Busybox
+
+  http://git.busybox.net/busybox/commit/?id=d8e61bbf13d0cf38d477255cfd5dc71c5d51d575
+
+Signed-off-by: Juro Bystricky <juro bystricky intel com>
+
+From d8e61bbf13d0cf38d477255cfd5dc71c5d51d575 Mon Sep 17 00:00:00 2001
+From: Denys Vlasenko <vda linux googlemail com>
+Date: Sun, 21 Aug 2016 22:00:20 +0200
+Subject: build system: different fix for
+ include/applet_tables.h/include/NUM_APPLETS.h
+
+Signed-off-by: Denys Vlasenko <vda linux googlemail com>
+
+diff --git a/applets/Kbuild.src b/applets/Kbuild.src
+index 5cc1827..3aedbbf 100644
+--- a/applets/Kbuild.src
++++ b/applets/Kbuild.src
+@@ -29,7 +29,7 @@ applets/applets.o: include/usage_compressed.h include/applet_tables.h
+ 
+ applets/applet_tables: .config include/applets.h
+ applets/usage:         .config include/applets.h
+-applets/usage_pod:     .config include/applets.h include/applet_tables.h include/NUM_APPLETS.h
++applets/usage_pod:     .config include/applets.h include/applet_tables.h
+ 
+ quiet_cmd_gen_usage_compressed = GEN     include/usage_compressed.h
+       cmd_gen_usage_compressed = $(srctree_slash)applets/usage_compressed include/usage_compressed.h applets
+@@ -37,8 +37,21 @@ quiet_cmd_gen_usage_compressed = GEN     include/usage_compressed.h
+ include/usage_compressed.h: applets/usage $(srctree_slash)applets/usage_compressed
+       $(call cmd,gen_usage_compressed)
+ 
+-quiet_cmd_gen_applet_tables = GEN     include/applet_tables.h
++quiet_cmd_gen_applet_tables = GEN     include/applet_tables.h include/NUM_APPLETS.h
+       cmd_gen_applet_tables = applets/applet_tables include/applet_tables.h include/NUM_APPLETS.h
+ 
+-include/applet_tables.h include/NUM_APPLETS.h: applets/applet_tables
++include/NUM_APPLETS.h: applets/applet_tables
++      $(call cmd,gen_applet_tables)
++
++# In fact, include/applet_tables.h depends only on applets/applet_tables,
++# and is generated by it. But specifying only it can run
++# applets/applet_tables twice, possibly in parallel.
++# We say that it also needs NUM_APPLETS.h
++#
++# Unfortunately, we need to list the same command,
++# and it can be executed twice (sequentially).
++# The alternative is to not list any command,
++# and then if include/applet_tables.h is deleted, it won't be rebuilt.
++#
++include/applet_tables.h: include/NUM_APPLETS.h applets/applet_tables
+       $(call cmd,gen_applet_tables)
diff --git a/meta/recipes-core/busybox/busybox/commit-applet_tables-fix-commit-0dddbc1.patch 
b/meta/recipes-core/busybox/busybox/commit-applet_tables-fix-commit-0dddbc1.patch
new file mode 100644
index 0000000..7f80a1d
--- /dev/null
+++ b/meta/recipes-core/busybox/busybox/commit-applet_tables-fix-commit-0dddbc1.patch
@@ -0,0 +1,61 @@
+Upstream-Status: Backport
+
+Patch addressing a parallel make race in Busybox
+
+  http://git.busybox.net/busybox/commit/?id=0dddbc1a59795a77679d8c5ef48a2795cb470563
+
+Signed-off-by: Juro Bystricky <juro bystricky intel com>
+
+From 0dddbc1a59795a77679d8c5ef48a2795cb470563 Mon Sep 17 00:00:00 2001
+From: Denys Vlasenko <vda linux googlemail com>
+Date: Tue, 23 Aug 2016 20:21:36 +0200
+Subject: build system: always rewrite NUM_APPLETS.h
+
+Conditional rewrite can keep NUM_APPLETS.h mtime old,
+this causes make to try to regenerate it at every invocation.
+
+Signed-off-by: Denys Vlasenko <vda linux googlemail com>
+
+diff --git a/applets/applet_tables.c b/applets/applet_tables.c
+index 8401a15..ef911a4 100644
+--- a/applets/applet_tables.c
++++ b/applets/applet_tables.c
+@@ -192,27 +192,28 @@ int main(int argc, char **argv)
+       printf("};\n");
+ #endif
+       //printf("#endif /* SKIP_definitions */\n");
++
+ //    printf("\n");
+ //    printf("#define MAX_APPLET_NAME_LEN %u\n", MAX_APPLET_NAME_LEN);
+ 
+       if (argv[2]) {
+-              char line_old[80];
+-              char line_new[80];
+               FILE *fp;
++              char line_new[80];
++//            char line_old[80];
+ 
+-              line_old[0] = 0;
+-              fp = fopen(argv[2], "r");
+-              if (fp) {
+-                      fgets(line_old, sizeof(line_old), fp);
+-                      fclose(fp);
+-              }
+               sprintf(line_new, "#define NUM_APPLETS %u\n", NUM_APPLETS);
+-              if (strcmp(line_old, line_new) != 0) {
++//            line_old[0] = 0;
++//            fp = fopen(argv[2], "r");
++//            if (fp) {
++//                    fgets(line_old, sizeof(line_old), fp);
++//                    fclose(fp);
++//            }
++//            if (strcmp(line_old, line_new) != 0) {
+                       fp = fopen(argv[2], "w");
+                       if (!fp)
+                               return 1;
+                       fputs(line_new, fp);
+-              }
++//            }
+       }
+ 
+       return 0;
diff --git a/meta/recipes-core/busybox/busybox/makefile-libbb-race.patch 
b/meta/recipes-core/busybox/busybox/makefile-libbb-race.patch
new file mode 100644
index 0000000..97278ab
--- /dev/null
+++ b/meta/recipes-core/busybox/busybox/makefile-libbb-race.patch
@@ -0,0 +1,34 @@
+There is a potential race when building libbb, as some header files  
+needed by libbb are not generated yet (or are being modified) at the time
+libbb is compiled.
+This patch avoids this scenario by building libbb as the last directory.
+
+Upstream-Status: Submitted
+Signed-off-by: Juro Bystricky <juro bystricky intel com>
+
+Index: busybox-1.24.1/Makefile
+===================================================================
+diff --git a/Makefile b/Makefile
+index 5cfc763..69f3831 100644
+--- a/Makefile
++++ b/Makefile
+@@ -738,9 +738,18 @@ $(sort $(busybox-all)): $(busybox-dirs) ;
+ # Error messages still appears in the original language
+ 
+ PHONY += $(busybox-dirs)
+-$(busybox-dirs): prepare scripts
++
++libbb-dir = $(filter libbb,$(busybox-dirs))
++busybox-dirs1 = $(filter-out libbb,$(busybox-dirs))
++
++$(busybox-dirs1): prepare scripts
+       $(Q)$(MAKE) $(build)=$@
+ 
++ifneq ($(libbb-dir),)
++$(libbb-dir): | $(busybox-dirs1)
++      $(Q)$(MAKE) $(build)=$@
++endif
++
+ # Build the kernel release string
+ # The KERNELRELEASE is stored in a file named .kernelrelease
+ # to be used when executing for example make install or make modules_install
diff --git a/meta/recipes-core/busybox/busybox_1.24.1.bb b/meta/recipes-core/busybox/busybox_1.24.1.bb
index f370451..df0e131 100644
--- a/meta/recipes-core/busybox/busybox_1.24.1.bb
+++ b/meta/recipes-core/busybox/busybox_1.24.1.bb
@@ -49,8 +49,10 @@ SRC_URI = "http://www.busybox.net/downloads/busybox-${PV}.tar.bz2;name=tarball \
            file://CVE-2016-2147_2.patch \
            file://ip_fix_problem_on_mips64_n64_big_endian_musl_systems.patch \
            file://makefile-fix-backport.patch \
-           file://parallel-make-fix.patch \
            file://0001-sed-fix-sed-n-flushes-pattern-space-terminates-early.patch \
+           file://busybox-kbuild-race-fix-commit-d8e61bb.patch \
+           file://commit-applet_tables-fix-commit-0dddbc1.patch \
+           file://makefile-libbb-race.patch \
 "
 SRC_URI_append_libc-musl = " file://musl.cfg "
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]