2013-02-23 20:28:12 +01:00
|
|
|
Index: make-3.82/configure.in
|
|
|
|
===================================================================
|
|
|
|
--- make-3.82.orig/configure.in
|
|
|
|
+++ make-3.82/configure.in
|
|
|
|
@@ -64,7 +64,8 @@ AC_HEADER_DIRENT
|
2012-08-30 09:56:40 +02:00
|
|
|
AC_HEADER_STAT
|
|
|
|
AC_HEADER_TIME
|
|
|
|
AC_CHECK_HEADERS(stdlib.h locale.h unistd.h limits.h fcntl.h string.h \
|
|
|
|
- memory.h sys/param.h sys/resource.h sys/time.h sys/timeb.h)
|
|
|
|
+ memory.h sys/param.h sys/resource.h sys/time.h sys/timeb.h \
|
|
|
|
+ sys/user.h linux/binfmts.h)
|
|
|
|
|
|
|
|
# Set a flag if we have an ANSI C compiler
|
|
|
|
if test "$ac_cv_prog_cc_stdc" != no; then
|
2013-02-23 20:28:12 +01:00
|
|
|
Index: make-3.82/job.c
|
|
|
|
===================================================================
|
|
|
|
--- make-3.82.orig/job.c
|
|
|
|
+++ make-3.82/job.c
|
|
|
|
@@ -29,6 +29,14 @@ this program. If not, see <http://www.g
|
2012-08-30 09:56:40 +02:00
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
+#if defined (HAVE_LINUX_BINFMTS_H) && defined (HAVE_SYS_USER_H)
|
|
|
|
+#include <sys/user.h>
|
|
|
|
+#include <linux/binfmts.h>
|
2013-02-23 20:28:12 +01:00
|
|
|
+#ifndef PAGE_SIZE
|
|
|
|
+#define PAGE_SIZE getpagesize()
|
|
|
|
+#endif
|
2012-08-30 09:56:40 +02:00
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
/* Default shell to use. */
|
|
|
|
#ifdef WINDOWS32
|
|
|
|
#include <windows.h>
|
2013-02-23 20:28:12 +01:00
|
|
|
@@ -2795,6 +2803,7 @@ construct_command_argv_internal (char *l
|
2012-08-30 09:56:40 +02:00
|
|
|
unsigned int sflags_len = strlen (shellflags);
|
|
|
|
char *command_ptr = NULL; /* used for batch_mode_shell mode */
|
|
|
|
char *new_line;
|
|
|
|
+ char *args_ptr;
|
|
|
|
|
|
|
|
# ifdef __EMX__ /* is this necessary? */
|
|
|
|
if (!unixy_shell)
|
2013-02-23 20:28:12 +01:00
|
|
|
@@ -2865,8 +2874,17 @@ construct_command_argv_internal (char *l
|
2012-08-30 09:56:40 +02:00
|
|
|
return new_argv;
|
|
|
|
}
|
|
|
|
|
|
|
|
+#ifdef MAX_ARG_STRLEN
|
|
|
|
+ static char eval_line[] = "eval\\ \\\"set\\ x\\;\\ shift\\;\\ ";
|
|
|
|
+#define ARG_NUMBER_DIGITS 5
|
|
|
|
+#define EVAL_LEN (sizeof(eval_line)-1 + shell_len + 4 \
|
|
|
|
+ + (7 + ARG_NUMBER_DIGITS) * 2 * line_len / (MAX_ARG_STRLEN - 2))
|
|
|
|
+#else
|
|
|
|
+#define EVAL_LEN 0
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
new_line = alloca (shell_len + 1 + sflags_len + 1
|
|
|
|
- + (line_len*2) + 1);
|
|
|
|
+ + (line_len*2) + 1 + EVAL_LEN);
|
|
|
|
ap = new_line;
|
|
|
|
memcpy (ap, shell, shell_len);
|
|
|
|
ap += shell_len;
|
2013-02-23 20:28:12 +01:00
|
|
|
@@ -2875,6 +2893,30 @@ construct_command_argv_internal (char *l
|
2012-08-30 09:56:40 +02:00
|
|
|
ap += sflags_len;
|
|
|
|
*(ap++) = ' ';
|
|
|
|
command_ptr = ap;
|
|
|
|
+
|
|
|
|
+#if !defined (WINDOWS32) && defined (MAX_ARG_STRLEN)
|
|
|
|
+ if (unixy_shell && line_len > MAX_ARG_STRLEN)
|
|
|
|
+ {
|
|
|
|
+ unsigned j;
|
|
|
|
+ memcpy (ap, eval_line, sizeof (eval_line) - 1);
|
|
|
|
+ ap += sizeof (eval_line) - 1;
|
|
|
|
+ for (j = 1; j <= 2 * line_len / (MAX_ARG_STRLEN - 2); j++)
|
|
|
|
+ ap += sprintf (ap, "\\$\\{%u\\}", j);
|
|
|
|
+ *ap++ = '\\';
|
|
|
|
+ *ap++ = '"';
|
|
|
|
+ *ap++ = ' ';
|
|
|
|
+ /* Copy only the first word of SHELL to $0. */
|
|
|
|
+ for (p = shell; *p != '\0'; ++p)
|
|
|
|
+ {
|
|
|
|
+ if (isspace ((unsigned char)*p))
|
|
|
|
+ break;
|
|
|
|
+ *ap++ = *p;
|
|
|
|
+ }
|
|
|
|
+ *ap++ = ' ';
|
|
|
|
+ }
|
|
|
|
+#endif
|
|
|
|
+ args_ptr = ap;
|
|
|
|
+
|
|
|
|
for (p = line; *p != '\0'; ++p)
|
|
|
|
{
|
|
|
|
if (restp != NULL && *p == '\n')
|
2013-02-23 20:28:12 +01:00
|
|
|
@@ -2922,6 +2964,14 @@ construct_command_argv_internal (char *l
|
2012-08-30 09:56:40 +02:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
*ap++ = *p;
|
|
|
|
+
|
|
|
|
+#if !defined (WINDOWS32) && defined (MAX_ARG_STRLEN)
|
|
|
|
+ if (unixy_shell && line_len > MAX_ARG_STRLEN && (ap - args_ptr > MAX_ARG_STRLEN - 2))
|
|
|
|
+ {
|
|
|
|
+ *ap++ = ' ';
|
|
|
|
+ args_ptr = ap;
|
|
|
|
+ }
|
|
|
|
+#endif
|
|
|
|
}
|
|
|
|
if (ap == new_line + shell_len + sflags_len + 2)
|
|
|
|
/* Line was empty. */
|