Package: make-dfsg
Version: 4.0-4
Followup-For: Bug #688601
User: [email protected]
Usertags: origin-ubuntu utopic ubuntu-patch



This is my mangled version of the patch referenced earlier in this
thread, tested to build and work with make 4.0. Enjoy.

... Adam

-- System Information:
Debian Release: jessie/sid
  APT prefers utopic-updates
  APT policy: (500, 'utopic-updates'), (500, 'utopic-security'), (500, 
'utopic'), (500, 'trusty-proposed')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.13.0-24-generic (SMP w/4 CPU cores)
Locale: LANG=en_CA.UTF-8, LC_CTYPE=en_CA.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
diff -Nru make-dfsg-4.0/debian/changelog make-dfsg-4.0/debian/changelog
diff -Nru make-dfsg-4.0/debian/patches/0099-job.c_handle_excessive_command_length.patch make-dfsg-4.0/debian/patches/0099-job.c_handle_excessive_command_length.patch
--- make-dfsg-4.0/debian/patches/0099-job.c_handle_excessive_command_length.patch	1969-12-31 17:00:00.000000000 -0700
+++ make-dfsg-4.0/debian/patches/0099-job.c_handle_excessive_command_length.patch	2014-05-03 14:17:38.000000000 -0600
@@ -0,0 +1,105 @@
+Description: Handle excessively long command lines (like from Webkit)
+Author: Adam Conrad <[email protected]>
+Bug-Debian: http://bugs.debian.org/688601
+
+--- make-dfsg-4.0.orig/configure.ac
++++ make-dfsg-4.0/configure.ac
+@@ -62,7 +62,8 @@ AC_HEADER_DIRENT
+ 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])
+ 
+ AM_PROG_CC_C_O
+ AC_C_CONST
+--- make-dfsg-4.0.orig/job.c
++++ make-dfsg-4.0/job.c
+@@ -27,6 +27,14 @@ this program.  If not, see <http://www.g
+ 
+ #include <string.h>
+ 
++#if defined (HAVE_LINUX_BINFMTS_H) && defined (HAVE_SYS_USER_H)
++#include <sys/user.h>
++#include <linux/binfmts.h>
++#endif
++#ifndef PAGE_SIZE
++# define PAGE_SIZE (sysconf(_SC_PAGESIZE))
++#endif
++
+ /* Default shell to use.  */
+ #ifdef WINDOWS32
+ #include <windows.h>
+@@ -3067,6 +3075,7 @@ construct_command_argv_internal (char *l
+ #ifdef WINDOWS32
+     char *command_ptr = NULL; /* used for batch_mode_shell mode */
+ #endif
++    char *args_ptr;
+ 
+ # ifdef __EMX__ /* is this necessary? */
+     if (!unixy_shell && shellflags)
+@@ -3232,8 +3241,17 @@ construct_command_argv_internal (char *l
+         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 = xmalloc ((shell_len*2) + 1 + sflags_len + 1
+-                        + (line_len*2) + 1);
++                        + (line_len*2) + 1 + EVAL_LEN);
+     ap = new_line;
+     /* Copy SHELL, escaping any characters special to the shell.  If
+        we don't escape them, construct_command_argv_internal will
+@@ -3253,6 +3271,30 @@ construct_command_argv_internal (char *l
+ #ifdef WINDOWS32
+     command_ptr = ap;
+ #endif
++
++#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')
+@@ -3300,6 +3342,13 @@ construct_command_argv_internal (char *l
+           }
+ #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)
+       {
diff -Nru make-dfsg-4.0/debian/patches/series make-dfsg-4.0/debian/patches/series
--- make-dfsg-4.0/debian/patches/series	2014-05-02 19:33:24.000000000 -0600
+++ make-dfsg-4.0/debian/patches/series	2014-05-03 14:17:04.000000000 -0600
@@ -7,3 +7,4 @@
 0006-configure.ac-SV-40790-Fix-load-autoconf-variables.patch
 0007-job.c-set_child_handler_action_flags-SV-41341.patch
 0008-SV-42249-Propagate-correct-rule-status-results.patch
+0099-job.c_handle_excessive_command_length.patch

Reply via email to