diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2012-09-28 11:28:13 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2012-09-28 13:04:46 +0000 |
commit | dd655ad0ae11bb4b44195baff93c15542f494ff9 (patch) | |
tree | 8d6a3d4ae8fb2e48eaf50d09dadbe6e5cb59bbb7 /main | |
parent | ced9eb976e2db4d16f30fa93150304c09286000f (diff) | |
download | aports-dd655ad0ae11bb4b44195baff93c15542f494ff9.tar.bz2 aports-dd655ad0ae11bb4b44195baff93c15542f494ff9.tar.xz |
main/make: patch for using insanely long command lines
Fixes build of webkitgtk.
Patch is from:
http://trac.webkit.org/browser/trunk/Tools/gtk/patches
Diffstat (limited to 'main')
-rw-r--r-- | main/make/APKBUILD | 6 | ||||
-rw-r--r-- | main/make/make-3.82-arg-list-length.patch | 89 | ||||
-rw-r--r-- | main/make/use-malloc.patch | 20 |
3 files changed, 100 insertions, 15 deletions
diff --git a/main/make/APKBUILD b/main/make/APKBUILD index eee9d2eee..215ffb5cc 100644 --- a/main/make/APKBUILD +++ b/main/make/APKBUILD @@ -1,7 +1,7 @@ # Maintainer: Natanael Copa <ncopa@alpinelinux.org> pkgname=make pkgver=3.82 -pkgrel=5 +pkgrel=6 pkgdesc="GNU make utility to maintain groups of programs" url="http://www.gnu.org/software/make" arch="all" @@ -16,6 +16,7 @@ source="ftp://ftp.gnu.org/gnu/$pkgname/$pkgname-$pkgver.tar.bz2 make-3.82-expensive_glob.patch make-3.82-parallel-remake.patch make-3.82-dont-prune-intermediate.patch + make-3.82-arg-list-length.patch use-malloc.patch " @@ -52,4 +53,5 @@ md5sums="1a11100f3c63fcf5753818e59d63088f make-3.82.tar.bz2 f2ed48ea701e8ab6e5b870a3d125b71a make-3.82-expensive_glob.patch 89f8032d2f314eb6338739f024d8ecec make-3.82-parallel-remake.patch 97c9f064c4006c41f29d67febda858af make-3.82-dont-prune-intermediate.patch -44469128d5044e14ac48b3b991889ceb use-malloc.patch" +1d175e00f931b7d866d2fddcf0c0b302 make-3.82-arg-list-length.patch +c5b90dd539b5950ac2cf502f266c66aa use-malloc.patch" diff --git a/main/make/make-3.82-arg-list-length.patch b/main/make/make-3.82-arg-list-length.patch new file mode 100644 index 000000000..1b59da79e --- /dev/null +++ b/main/make/make-3.82-arg-list-length.patch @@ -0,0 +1,89 @@ +diff -u make-3.82-orig/job.c make-3.82/job.c +--- make-3.82-orig/job.c 2010-07-24 10:27:50.000000000 +0200 ++++ make-3.82/job.c 2012-03-21 12:34:20.000000000 +0100 +@@ -29,6 +29,11 @@ + + #include <string.h> + ++//#if defined (HAVE_LINUX_BINFMTS_H) && defined (HAVE_SYS_USER_H) ++#include <sys/user.h> ++#include <linux/binfmts.h> ++//#endif ++ + /* Default shell to use. */ + #ifdef WINDOWS32 + #include <windows.h> +@@ -2795,6 +2800,7 @@ + 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) +@@ -2865,8 +2871,17 @@ + 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; +@@ -2875,6 +2890,30 @@ + 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') +@@ -2922,6 +2961,14 @@ + } + #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. */ + diff --git a/main/make/use-malloc.patch b/main/make/use-malloc.patch index 8e3284c03..dfda84c60 100644 --- a/main/make/use-malloc.patch +++ b/main/make/use-malloc.patch @@ -1,23 +1,17 @@ -Use malloc when construction the command argv instead of stack space. -This fixes overflowing the stack when building webkit on uclibc based -systems. - -https://savannah.gnu.org/bugs/index.php?36451 - --- ./job.c.orig +++ ./job.c -@@ -2865,7 +2865,7 @@ - return new_argv; - } +@@ -2880,7 +2880,7 @@ + #define EVAL_LEN 0 + #endif - new_line = alloca (shell_len + 1 + sflags_len + 1 + new_line = xmalloc (shell_len + 1 + sflags_len + 1 - + (line_len*2) + 1); + + (line_len*2) + 1 + EVAL_LEN); ap = new_line; memcpy (ap, shell, shell_len); -@@ -2923,9 +2923,11 @@ +@@ -2970,9 +2970,11 @@ + } #endif - *ap++ = *p; } - if (ap == new_line + shell_len + sflags_len + 2) + if (ap == new_line + shell_len + sflags_len + 2) { @@ -28,7 +22,7 @@ https://savannah.gnu.org/bugs/index.php?36451 *ap = '\0'; #ifdef WINDOWS32 -@@ -3065,6 +3067,7 @@ +@@ -3112,6 +3114,7 @@ fatal (NILF, _("%s (line %d) Bad shell context (!unixy && !batch_mode_shell)\n"), __FILE__, __LINE__); #endif |