Browse code

Fixing make in chroot environment: Bug Id: 1651704

Change-Id: I8f9bf087d79bcde87c8c8de54656b26654aa6657
Reviewed-on: http://photon-jenkins.eng.vmware.com/854
Tested-by: jenkins-photon <wangnan2015@hotmail.com>
Reviewed-by: Sharath George

Kumar Kaushik authored on 2016/05/11 08:42:21
Showing 2 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,43 @@
0
+diff -ru make-4.1/main.c make-4.1-modified/main.c
1
+--- make-4.1/main.c	2014-10-05 09:24:51.000000000 -0700
2
+@@ -1401,13 +1401,18 @@
3
+ #ifdef HAVE_ISATTY
4
+     if (isatty (fileno (stdout)))
5
+       if (! lookup_variable (STRING_SIZE_TUPLE ("MAKE_TERMOUT")))
6
+-        define_variable_cname ("MAKE_TERMOUT", TTYNAME (fileno (stdout)),
7
+-                               o_default, 0)->export = v_export;
8
+-
9
++      {
10
++          const char *tty = TTYNAME (fileno (stdout));
11
++          define_variable_cname ("MAKE_TERMOUT", tty ? tty : DEFAULT_TTYNAME,
12
++                                 o_default, 0)->export = v_export;
13
++      }
14
+     if (isatty (fileno (stderr)))
15
+       if (! lookup_variable (STRING_SIZE_TUPLE ("MAKE_TERMERR")))
16
+-        define_variable_cname ("MAKE_TERMERR", TTYNAME (fileno (stderr)),
17
+-                               o_default, 0)->export = v_export;
18
++      {
19
++          const char *tty = TTYNAME (fileno (stderr));
20
++          define_variable_cname ("MAKE_TERMERR", tty ? tty : DEFAULT_TTYNAME,
21
++                                 o_default, 0)->export = v_export;
22
++      }
23
+ #endif
24
+ 
25
+   /* Reset in case the switches changed our minds.  */
26
+diff -ru make-4.1/makeint.h make-4.1-modified/makeint.h
27
+--- make-4.1/makeint.h	2014-10-05 09:24:51.000000000 -0700
28
+@@ -424,10 +424,11 @@
29
+ /* The number of bytes needed to represent the largest integer as a string.  */
30
+ #define INTSTR_LENGTH         CSTRLEN ("18446744073709551616")
31
+ 
32
++#define DEFAULT_TTYNAME "true"
33
+ #ifdef HAVE_TTYNAME
34
+ # define TTYNAME(_f) ttyname (_f)
35
+ #else
36
+-# define TTYNAME(_f) "true"
37
++# define TTYNAME(_f) DEFAULT_TTYNAME
38
+ #endif
39
+ 
40
+ 
... ...
@@ -1,18 +1,20 @@
1 1
 Summary:	Program for compiling packages
2 2
 Name:		make
3 3
 Version:	4.1
4
-Release:	1%{?dist}
4
+Release:	2%{?dist}
5 5
 License:	GPLv3+
6 6
 URL:		http://www.gnu.org/software/make
7 7
 Group:		Development/Tools
8 8
 Vendor:		VMware, Inc.
9 9
 Distribution: 	Photon
10
+Patch0:         chroot-segfault-fix.patch
10 11
 Source0:	http://ftp.gnu.org/gnu/make/%{name}-%{version}.tar.bz2
11 12
 %define sha1 make=0d701882fd6fd61a9652cb8d866ad7fc7de54d58
12 13
 %description
13 14
 The Make package contains a program for compiling packages.
14 15
 %prep
15 16
 %setup -q
17
+%patch0 -p1
16 18
 %build
17 19
 ./configure \
18 20
 	--prefix=%{_prefix} \
... ...
@@ -30,6 +32,8 @@ make -k check |& tee %{_specdir}/%{name}-check-log || %{nocheck}
30 30
 %{_includedir}/gnumake.h
31 31
 %{_mandir}/*/*
32 32
 %changelog
33
+*       Tue May 10 2016 Kumar Kaushik <kaushikk@vmware.com>  4.1-2
34
+-       Fix for segfaults in chroot env.
33 35
 *       Tue Jan 12 2016 Anish Swaminathan <anishs@vmware.com>  4.1-1
34 36
 -       Update version.
35 37
 *	Wed Nov 5 2014 Divya Thaluru <dthaluru@vmware.com> 4.0-1