summaryrefslogtreecommitdiffstats
path: root/meta/recipes-extended/bash
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2021-06-30 12:54:17 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-07-02 07:24:21 +0100
commit68a4cbb7b2dba70fdf931fbd4a316e1dacd2dacc (patch)
treec27f8fae1e1ecd5cedd450a8ffb9fe09ff6c2860 /meta/recipes-extended/bash
parent1f3094e7756ebd2f9ac527f62de07695b7eeca28 (diff)
downloadpoky-68a4cbb7b2dba70fdf931fbd4a316e1dacd2dacc.tar.gz
bash: Fix a rare make race build failure
There is a rare make race that occurs in bash due to the way it constructs certain headers and a build tool. Restructure the creation to remove the race. [YOCTO #14227] (From OE-Core rev: 6f683cf21630142e82cc37d79f3d797d179d8d12) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-extended/bash')
-rw-r--r--meta/recipes-extended/bash/bash/makerace2.patch98
-rw-r--r--meta/recipes-extended/bash/bash_5.1.8.bb1
2 files changed, 99 insertions, 0 deletions
diff --git a/meta/recipes-extended/bash/bash/makerace2.patch b/meta/recipes-extended/bash/bash/makerace2.patch
new file mode 100644
index 0000000000..43cdd04157
--- /dev/null
+++ b/meta/recipes-extended/bash/bash/makerace2.patch
@@ -0,0 +1,98 @@
1The main makefile can call mkbuiltins from multiple different codepaths in parallel.
2When called, it moves the existing files out the way and creates new ones, then
3compares which will break the build if timing is unlucky.
4
5The root of the problem is mkbuiltins.c creating a file but also referencing that
6file under the same name. By modifing it to allow the final name and the temp name
7to be specified, we can avoid the original reason for the moving of files around.
8This allows them to be created under a new name and then replaced if changed,
9removing any race windows around accessing the files whilst they've been
10moved or are being rewritten.
11
12See [YOCTO #14227]
13
14Upstream-Status: Pending
15Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
16
17Index: bash-5.1.8/builtins/Makefile.in
18===================================================================
19--- bash-5.1.8.orig/builtins/Makefile.in
20+++ bash-5.1.8/builtins/Makefile.in
21@@ -185,19 +185,17 @@ gen-helpfiles: tmpbuiltins.o gen-helpfil
22 $(CC_FOR_BUILD) ${CCFLAGS_FOR_BUILD} $(LDFLAGS_FOR_BUILD) -o $@ gen-helpfiles.o tmpbuiltins.o $(LIBS_FOR_BUILD)
23
24 builtext.h builtins.c: $(MKBUILTINS) $(DEFSRC)
25- @-if test -f builtins.c; then mv -f builtins.c old-builtins.c; fi
26- @-if test -f builtext.h; then mv -f builtext.h old-builtext.h; fi
27- ./$(MKBUILTINS) -externfile builtext.h -structfile builtins.c \
28+ ./$(MKBUILTINS) -externfile builtext-new.h -externfinalfile builtext.h -structfile builtins-new.c \
29 -noproduction $(DIRECTDEFINE) $(HELPDIRDEFINE) $(HELPSTRINGS) $(DEFSRC)
30- @-if cmp -s old-builtext.h builtext.h 2>/dev/null; then \
31- mv old-builtext.h builtext.h; \
32+ @-if ! cmp -s builtext.h builtext-new.h 2>/dev/null; then \
33+ mv builtext-new.h builtext.h; \
34 else \
35- $(RM) old-builtext.h; \
36+ $(RM) builtext-new.h; \
37 fi
38- @-if cmp -s old-builtins.c builtins.c 2>/dev/null; then \
39- mv old-builtins.c builtins.c; \
40+ @-if ! cmp -s builtins.c builtins-new.c 2>/dev/null; then \
41+ mv builtins-new.c builtins.c; \
42 else \
43- $(RM) old-builtins.c; \
44+ $(RM) builtins-new.c; \
45 fi
46
47 helpdoc: gen-helpfiles
48Index: bash-5.1.8/builtins/mkbuiltins.c
49===================================================================
50--- bash-5.1.8.orig/builtins/mkbuiltins.c
51+++ bash-5.1.8/builtins/mkbuiltins.c
52@@ -113,6 +113,9 @@ char *struct_filename = (char *)NULL;
53 /* The name of the external declaration file. */
54 char *extern_filename = (char *)NULL;
55
56+/* The final name of the external declaration file. */
57+char *extern_final_filename = (char *)NULL;
58+
59 /* Here is a structure for manipulating arrays of data. */
60 typedef struct {
61 int size; /* Number of slots allocated to array. */
62@@ -230,6 +233,8 @@ main (argc, argv)
63
64 if (strcmp (arg, "-externfile") == 0)
65 extern_filename = argv[arg_index++];
66+ else if (strcmp (arg, "-externfinalfile") == 0)
67+ extern_final_filename = argv[arg_index++];
68 else if (strcmp (arg, "-structfile") == 0)
69 struct_filename = argv[arg_index++];
70 else if (strcmp (arg, "-noproduction") == 0)
71@@ -273,6 +278,9 @@ main (argc, argv)
72 }
73 }
74
75+ if (!extern_final_filename)
76+ extern_final_filename = extern_filename;
77+
78 /* If there are no files to process, just quit now. */
79 if (arg_index == argc)
80 exit (0);
81@@ -1174,7 +1182,7 @@ write_file_headers (structfile, externfi
82 fprintf (structfile, "%s\n", structfile_header[i]);
83
84 fprintf (structfile, "#include \"%s\"\n",
85- extern_filename ? extern_filename : "builtext.h");
86+ extern_final_filename ? extern_final_filename : "builtext.h");
87
88 fprintf (structfile, "#include \"bashintl.h\"\n");
89
90@@ -1184,7 +1192,7 @@ write_file_headers (structfile, externfi
91 if (externfile)
92 fprintf (externfile,
93 "/* %s - The list of builtins found in libbuiltins.a. */\n",
94- extern_filename ? extern_filename : "builtext.h");
95+ extern_final_filename ? extern_final_filename : "builtext.h");
96 }
97
98 /* Write out any necessary closing information for
diff --git a/meta/recipes-extended/bash/bash_5.1.8.bb b/meta/recipes-extended/bash/bash_5.1.8.bb
index 55d3d0b16e..5d7704af17 100644
--- a/meta/recipes-extended/bash/bash_5.1.8.bb
+++ b/meta/recipes-extended/bash/bash_5.1.8.bb
@@ -14,6 +14,7 @@ SRC_URI = "${GNU_MIRROR}/bash/${BP}.tar.gz;name=tarball \
14 file://fix-run-builtins.patch \ 14 file://fix-run-builtins.patch \
15 file://use_aclocal.patch \ 15 file://use_aclocal.patch \
16 file://makerace.patch \ 16 file://makerace.patch \
17 file://makerace2.patch \
17 " 18 "
18 19
19SRC_URI[tarball.sha256sum] = "0cfb5c9bb1a29f800a97bd242d19511c997a1013815b805e0fdd32214113d6be" 20SRC_URI[tarball.sha256sum] = "0cfb5c9bb1a29f800a97bd242d19511c997a1013815b805e0fdd32214113d6be"