summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools
diff options
context:
space:
mode:
authorChang Rebecca Swee Fun <rebecca.swee.fun.chang@intel.com>2016-03-10 12:01:48 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-03-11 16:50:45 +0000
commit40c9774d5e0512bdb66e4ecd15df26551d1ebe68 (patch)
treead4c1a22bd435ebd29579907e3f0a3de86d63887 /meta/recipes-devtools
parent7f27713f27e15f265277cb2f3a01ebc4713e382d (diff)
downloadpoky-40c9774d5e0512bdb66e4ecd15df26551d1ebe68.tar.gz
make 4.1: fix segfault when ttyname fails
GNU make segfaults when run in a chroot environment because of a known bug in GNU make 4.1. See [1] for details. Works if /dev/pts is mounted before chroot. [1] http://savannah.gnu.org/bugs/?43434 [YOCTO #9067] Reported-by: Alexander Larsson <alexl@redhat.com> (From OE-Core rev: 0fe2a4b428b1b9a937914d87ec089b5a64f641eb) Signed-off-by: Anuj Mittal <anujx.mittal@intel.com> Signed-off-by: Chang Rebecca Swee Fun <rebecca.swee.fun.chang@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools')
-rw-r--r--meta/recipes-devtools/make/make-4.1/0001-main.c-main-SV-43434-Handle-NULL-returns-from-ttynam.patch63
-rw-r--r--meta/recipes-devtools/make/make_4.1.bb2
2 files changed, 65 insertions, 0 deletions
diff --git a/meta/recipes-devtools/make/make-4.1/0001-main.c-main-SV-43434-Handle-NULL-returns-from-ttynam.patch b/meta/recipes-devtools/make/make-4.1/0001-main.c-main-SV-43434-Handle-NULL-returns-from-ttynam.patch
new file mode 100644
index 0000000000..7a5f4ba055
--- /dev/null
+++ b/meta/recipes-devtools/make/make-4.1/0001-main.c-main-SV-43434-Handle-NULL-returns-from-ttynam.patch
@@ -0,0 +1,63 @@
1From 292da6f6867b75a5af7ddbb639a1feae022f438f Mon Sep 17 00:00:00 2001
2From: Paul Smith <psmith@gnu.org>
3Date: Mon, 20 Oct 2014 01:54:56 -0400
4Subject: [PATCH] * main.c (main): [SV 43434] Handle NULL returns from
5 ttyname().
6
7Upstream-Status: Backport
8
9From: http://git.savannah.gnu.org/cgit/make.git/commit/?id=292da6f6867b75a5af7ddbb639a1feae022f438f
10
11---
12 main.c | 15 ++++++++++-----
13 makeint.h | 3 ++-
14 2 files changed, 12 insertions(+), 6 deletions(-)
15
16diff --git a/main.c b/main.c
17index b2d169c..0cdb8a8 100644
18--- a/main.c
19+++ b/main.c
20@@ -1429,13 +1429,18 @@ main (int argc, char **argv, char **envp)
21 #ifdef HAVE_ISATTY
22 if (isatty (fileno (stdout)))
23 if (! lookup_variable (STRING_SIZE_TUPLE ("MAKE_TERMOUT")))
24- define_variable_cname ("MAKE_TERMOUT", TTYNAME (fileno (stdout)),
25- o_default, 0)->export = v_export;
26-
27+ {
28+ const char *tty = TTYNAME (fileno (stdout));
29+ define_variable_cname ("MAKE_TERMOUT", tty ? tty : DEFAULT_TTYNAME,
30+ o_default, 0)->export = v_export;
31+ }
32 if (isatty (fileno (stderr)))
33 if (! lookup_variable (STRING_SIZE_TUPLE ("MAKE_TERMERR")))
34- define_variable_cname ("MAKE_TERMERR", TTYNAME (fileno (stderr)),
35- o_default, 0)->export = v_export;
36+ {
37+ const char *tty = TTYNAME (fileno (stderr));
38+ define_variable_cname ("MAKE_TERMERR", tty ? tty : DEFAULT_TTYNAME,
39+ o_default, 0)->export = v_export;
40+ }
41 #endif
42
43 /* Reset in case the switches changed our minds. */
44diff --git a/makeint.h b/makeint.h
45index 6223936..2009f41 100644
46--- a/makeint.h
47+++ b/makeint.h
48@@ -436,10 +436,11 @@ extern struct rlimit stack_limit;
49 /* The number of bytes needed to represent the largest integer as a string. */
50 #define INTSTR_LENGTH CSTRLEN ("18446744073709551616")
51
52+#define DEFAULT_TTYNAME "true"
53 #ifdef HAVE_TTYNAME
54 # define TTYNAME(_f) ttyname (_f)
55 #else
56-# define TTYNAME(_f) "true"
57+# define TTYNAME(_f) DEFAULT_TTYNAME
58 #endif
59
60
61--
621.9.1
63
diff --git a/meta/recipes-devtools/make/make_4.1.bb b/meta/recipes-devtools/make/make_4.1.bb
index a1b0d7c45f..78fe0b5471 100644
--- a/meta/recipes-devtools/make/make_4.1.bb
+++ b/meta/recipes-devtools/make/make_4.1.bb
@@ -4,6 +4,8 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504 \
4 file://glob/COPYING.LIB;md5=4a770b67e6be0f60da244beb2de0fce4" 4 file://glob/COPYING.LIB;md5=4a770b67e6be0f60da244beb2de0fce4"
5require make.inc 5require make.inc
6 6
7SRC_URI += "file://0001-main.c-main-SV-43434-Handle-NULL-returns-from-ttynam.patch"
8
7EXTRA_OECONF += "--without-guile" 9EXTRA_OECONF += "--without-guile"
8 10
9SRC_URI[md5sum] = "57a7a224a822f94789a587ccbcedff69" 11SRC_URI[md5sum] = "57a7a224a822f94789a587ccbcedff69"