source:
patches/make-3.82-fixes-1.patch@
f30360e
Last change on this file since f30360e was d87123b, checked in by , 11 years ago | |
---|---|
|
|
File size: 9.4 KB |
-
expand.c
Submitted By: William Harrington at <kb0iic at cross-lfs dot org> Date: 2013-08-01 Initial Package Version: 3.82 Upstream Status: Fixed Upstream Origin: Upstream Description: Several bug fixes from upstream git diff -Naur make-3.82.orig/expand.c make-3.82/expand.c
old new 197 197 { 198 198 struct variable *v; 199 199 const char *p, *p1; 200 char * abuf = NULL;200 char *save; 201 201 char *o; 202 202 unsigned int line_offset; 203 203 … … 212 212 return (variable_buffer); 213 213 } 214 214 215 /* If we want a subset of the string, allocate a temporary buffer for it. 216 Most of the functions we use here don't work with length limits. */ 217 if (length > 0 && string[length] != '\0') 218 { 219 abuf = xmalloc(length+1); 220 memcpy(abuf, string, length); 221 abuf[length] = '\0'; 222 string = abuf; 223 } 224 p = string; 215 /* We need a copy of STRING: due to eval, it's possible that it will get 216 freed as we process it (it might be the value of a variable that's reset 217 for example). Also having a nil-terminated string is handy. */ 218 save = length < 0 ? xstrdup (string) : xstrndup (string, length); 219 p = save; 225 220 226 221 while (1) 227 222 { … … 411 406 ++p; 412 407 } 413 408 414 if (abuf) 415 free (abuf); 409 free (save); 416 410 417 411 variable_buffer_output (o, "", 1); 418 412 return (variable_buffer + line_offset); -
function.c
diff -Naur make-3.82.orig/function.c make-3.82/function.c
old new 706 706 const char *word_iterator = argv[0]; 707 707 char buf[20]; 708 708 709 while (find_next_token (&word_iterator, (unsigned int *) 0) != 0)709 while (find_next_token (&word_iterator, NULL) != 0) 710 710 ++i; 711 711 712 712 sprintf (buf, "%d", i); … … 1133 1133 1134 1134 /* Find the maximum number of words we'll have. */ 1135 1135 t = argv[0]; 1136 wordi = 1;1137 while ( *t != '\0')1136 wordi = 0; 1137 while ((p = find_next_token (&t, NULL)) != 0) 1138 1138 { 1139 char c = *(t++); 1140 1141 if (! isspace ((unsigned char)c)) 1142 continue; 1143 1139 ++t; 1144 1140 ++wordi; 1145 1146 while (isspace ((unsigned char)*t))1147 ++t;1148 1141 } 1149 1142 1150 words = xmalloc ( wordi* sizeof (char *));1143 words = xmalloc ((wordi == 0 ? 1 : wordi) * sizeof (char *)); 1151 1144 1152 1145 /* Now assign pointers to each string in the array. */ 1153 1146 t = argv[0]; -
make-3.82
diff -Naur make-3.82.orig/job.c make-3.82/job.c
old new 29 29 30 30 #include <string.h> 31 31 32 #if defined(__linux__) /* defined (HAVE_LINUX_BINFMTS_H) && defined (HAVE_SYS_USER_H) */ 33 #include <sys/user.h> 34 #include <unistd.h> 35 #ifndef PAGE_SIZE 36 #define PAGE_SIZE sysconf(_SC_PAGE_SIZE) 37 #endif 38 #include <linux/binfmts.h> 39 #endif 40 32 41 /* Default shell to use. */ 33 42 #ifdef WINDOWS32 34 43 #include <windows.h> … … 2791 2800 argument list. */ 2792 2801 2793 2802 unsigned int shell_len = strlen (shell); 2803 #ifdef MAX_ARG_STRLEN 2804 static char eval_line[] = "eval\\ \\\"set\\ x\\;\\ shift\\;\\ "; 2805 #define ARG_NUMBER_DIGITS 5 2806 #define EVAL_LEN (sizeof(eval_line)-1 + shell_len + 4 \ 2807 + (7 + ARG_NUMBER_DIGITS) * 2 * line_len / (MAX_ARG_STRLEN - 2)) 2808 #else 2809 #define EVAL_LEN 0 2810 #endif 2811 char *args_ptr; 2794 2812 unsigned int line_len = strlen (line); 2795 2813 unsigned int sflags_len = strlen (shellflags); 2796 2814 char *command_ptr = NULL; /* used for batch_mode_shell mode */ … … 2866 2884 } 2867 2885 2868 2886 new_line = alloca (shell_len + 1 + sflags_len + 1 2869 + (line_len*2) + 1 );2887 + (line_len*2) + 1 + EVAL_LEN); 2870 2888 ap = new_line; 2871 2889 memcpy (ap, shell, shell_len); 2872 2890 ap += shell_len; … … 2875 2893 ap += sflags_len; 2876 2894 *(ap++) = ' '; 2877 2895 command_ptr = ap; 2896 2897 #if !defined (WINDOWS32) && defined (MAX_ARG_STRLEN) 2898 if (unixy_shell && line_len > MAX_ARG_STRLEN) 2899 { 2900 unsigned j; 2901 memcpy (ap, eval_line, sizeof (eval_line) - 1); 2902 ap += sizeof (eval_line) - 1; 2903 for (j = 1; j <= 2 * line_len / (MAX_ARG_STRLEN - 2); j++) 2904 ap += sprintf (ap, "\\$\\{%u\\}", j); 2905 *ap++ = '\\'; 2906 *ap++ = '"'; 2907 *ap++ = ' '; 2908 /* Copy only the first word of SHELL to $0. */ 2909 for (p = shell; *p != '\0'; ++p) 2910 { 2911 if (isspace ((unsigned char)*p)) 2912 break; 2913 *ap++ = *p; 2914 } 2915 *ap++ = ' '; 2916 } 2917 #endif 2918 args_ptr = ap; 2919 2878 2920 for (p = line; *p != '\0'; ++p) 2879 2921 { 2880 2922 if (restp != NULL && *p == '\n') … … 2922 2964 } 2923 2965 #endif 2924 2966 *ap++ = *p; 2967 2968 #if !defined (WINDOWS32) && defined (MAX_ARG_STRLEN) 2969 if (unixy_shell && line_len > MAX_ARG_STRLEN && (ap - args_ptr > MAX_ARG_STRLEN - 2)) 2970 { 2971 *ap++ = ' '; 2972 args_ptr = ap; 2973 } 2974 #endif 2925 2975 } 2926 2976 if (ap == new_line + shell_len + sflags_len + 2) 2927 2977 /* Line was empty. */ -
make-3.82
diff -Naur make-3.82.orig/main.c make-3.82/main.c
old new 1138 1138 a macro and some compilers (MSVC) don't like conditionals in macros. */ 1139 1139 { 1140 1140 const char *features = "target-specific order-only second-expansion" 1141 " else-if shortest-stem undefine "1141 " else-if shortest-stem undefine oneshell" 1142 1142 #ifndef NO_ARCHIVES 1143 1143 " archives" 1144 1144 #endif … … 2093 2093 const char *pv = define_makeflags (1, 1); 2094 2094 char *p = alloca (sizeof ("MAKEFLAGS=") + strlen (pv) + 1); 2095 2095 sprintf (p, "MAKEFLAGS=%s", pv); 2096 putenv ( p);2096 putenv (allocated_variable_expand (p)); 2097 2097 } 2098 2098 2099 2099 if (ISDB (DB_BASIC)) -
make-3.82
diff -Naur make-3.82.orig/read.c make-3.82/read.c
old new 2904 2904 const char *name; 2905 2905 const char **nlist = 0; 2906 2906 char *tildep = 0; 2907 int globme = 1; 2907 2908 #ifndef NO_ARCHIVES 2908 2909 char *arname = 0; 2909 2910 char *memname = 0; … … 3028 3029 { 3029 3030 /* This looks like the first element in an open archive group. 3030 3031 A valid group MUST have ')' as the last character. */ 3031 const char *e = p + nlen;3032 const char *e = p; 3032 3033 do 3033 3034 { 3034 3035 e = next_token (e); … … 3084 3085 Go to the next item in the string. */ 3085 3086 if (flags & PARSEFS_NOGLOB) 3086 3087 { 3087 NEWELT (concat (2, prefix, t p));3088 NEWELT (concat (2, prefix, tmpbuf)); 3088 3089 continue; 3089 3090 } 3090 3091 3091 3092 /* If we get here we know we're doing glob expansion. 3092 3093 TP is a string in tmpbuf. NLEN is no longer used. 3093 3094 We may need to do more work: after this NAME will be set. */ 3094 name = t p;3095 name = tmpbuf; 3095 3096 3096 3097 /* Expand tilde if applicable. */ 3097 if (t p[0] == '~')3098 if (tmpbuf[0] == '~') 3098 3099 { 3099 tildep = tilde_expand (t p);3100 tildep = tilde_expand (tmpbuf); 3100 3101 if (tildep != 0) 3101 3102 name = tildep; 3102 3103 } … … 3112 3113 } 3113 3114 #endif /* !NO_ARCHIVES */ 3114 3115 3115 switch (glob (name, GLOB_NOSORT|GLOB_ALTDIRFUNC, NULL, &gl)) 3116 { 3117 case GLOB_NOSPACE: 3118 fatal (NILF, _("virtual memory exhausted")); 3119 3120 case 0: 3121 /* Success. */ 3122 i = gl.gl_pathc; 3123 nlist = (const char **)gl.gl_pathv; 3124 break; 3125 3126 case GLOB_NOMATCH: 3127 /* If we want only existing items, skip this one. */ 3128 if (flags & PARSEFS_EXISTS) 3129 { 3130 i = 0; 3131 break; 3132 } 3133 /* FALLTHROUGH */ 3134 3135 default: 3136 /* By default keep this name. */ 3116 /* glob() is expensive: don't call it unless we need to. */ 3117 if (!(flags & PARSEFS_EXISTS) && strpbrk (name, "?*[") == NULL) 3118 { 3119 globme = 0; 3137 3120 i = 1; 3138 3121 nlist = &name; 3139 break; 3140 } 3122 } 3123 else 3124 switch (glob (name, GLOB_NOSORT|GLOB_ALTDIRFUNC, NULL, &gl)) 3125 { 3126 case GLOB_NOSPACE: 3127 fatal (NILF, _("virtual memory exhausted")); 3128 3129 case 0: 3130 /* Success. */ 3131 i = gl.gl_pathc; 3132 nlist = (const char **)gl.gl_pathv; 3133 break; 3134 3135 case GLOB_NOMATCH: 3136 /* If we want only existing items, skip this one. */ 3137 if (flags & PARSEFS_EXISTS) 3138 { 3139 i = 0; 3140 break; 3141 } 3142 /* FALLTHROUGH */ 3143 3144 default: 3145 /* By default keep this name. */ 3146 i = 1; 3147 nlist = &name; 3148 break; 3149 } 3141 3150 3142 3151 /* For each matched element, add it to the list. */ 3143 3152 while (i-- > 0) … … 3152 3161 else 3153 3162 { 3154 3163 /* We got a chain of items. Attach them. */ 3155 (*newp)->next = found; 3164 if (*newp) 3165 (*newp)->next = found; 3166 else 3167 *newp = found; 3156 3168 3157 3169 /* Find and set the new end. Massage names if necessary. */ 3158 3170 while (1) … … 3174 3186 #endif /* !NO_ARCHIVES */ 3175 3187 NEWELT (concat (2, prefix, nlist[i])); 3176 3188 3177 globfree (&gl); 3189 if (globme) 3190 globfree (&gl); 3178 3191 3179 3192 #ifndef NO_ARCHIVES 3180 3193 if (arname)
Note:
See TracBrowser
for help on using the repository browser.