1 |
commit: b9d4084c9f71972fedca422c03856dcd0c846720 |
2 |
Author: Hans de Graaff <hans <AT> degraaff <DOT> org> |
3 |
AuthorDate: Wed Dec 28 14:38:45 2011 +0000 |
4 |
Commit: Hans de Graaff <graaff <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Dec 28 14:38:45 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/ruby-scripts.git;a=commit;h=b9d4084c |
7 |
|
8 |
Add patches for ruby 1.8.7p357. |
9 |
|
10 |
The mkconfig.rb patch has been applied upstream. |
11 |
|
12 |
--- |
13 |
patchsets/patches-1.8.7_p357/001_memory_leak.patch | 59 ++++++++++++++++++++ |
14 |
.../003_mkmf-parallel-install.patch | 16 +++++ |
15 |
patchsets/patches-1.8.7_p357/004_berkdb-5.0.patch | 13 ++++ |
16 |
.../patches-1.8.7_p357/007_no-undefined-ext.patch | 13 ++++ |
17 |
patchsets/patches-1.8.7_p357/008_ppc64.patch | 42 ++++++++++++++ |
18 |
.../patches-1.8.7_p357/013_CVE-2011-0188.patch | 14 +++++ |
19 |
patchsets/patches-1.8.7_p357/series | 6 ++ |
20 |
7 files changed, 163 insertions(+), 0 deletions(-) |
21 |
|
22 |
diff --git a/patchsets/patches-1.8.7_p357/001_memory_leak.patch b/patchsets/patches-1.8.7_p357/001_memory_leak.patch |
23 |
new file mode 100644 |
24 |
index 0000000..98edae0 |
25 |
--- /dev/null |
26 |
+++ b/patchsets/patches-1.8.7_p357/001_memory_leak.patch |
27 |
@@ -0,0 +1,59 @@ |
28 |
+Index: ruby-1.8.7-p299/ext/dl/handle.c |
29 |
+=================================================================== |
30 |
+--- ruby-1.8.7-p299.orig/ext/dl/handle.c |
31 |
++++ ruby-1.8.7-p299/ext/dl/handle.c |
32 |
+@@ -10,9 +10,12 @@ VALUE rb_cDLHandle; |
33 |
+ void |
34 |
+ dlhandle_free(struct dl_handle *dlhandle) |
35 |
+ { |
36 |
++ if (!dlhandle) |
37 |
++ return; |
38 |
+ if (dlhandle->ptr && dlhandle->open && dlhandle->enable_close) { |
39 |
+ dlclose(dlhandle->ptr); |
40 |
+ } |
41 |
++ dlfree(dlhandle); |
42 |
+ } |
43 |
+ |
44 |
+ VALUE |
45 |
+Index: ruby-1.8.7-p299/ext/dl/ptr.c |
46 |
+=================================================================== |
47 |
+--- ruby-1.8.7-p299.orig/ext/dl/ptr.c |
48 |
++++ ruby-1.8.7-p299/ext/dl/ptr.c |
49 |
+@@ -45,6 +45,8 @@ rb_dlmem_aref(void *ptr) |
50 |
+ void |
51 |
+ dlptr_free(struct ptr_data *data) |
52 |
+ { |
53 |
++ if (!data) |
54 |
++ return; |
55 |
+ if (data->ptr) { |
56 |
+ DEBUG_CODE({ |
57 |
+ printf("dlptr_free(): removing the pointer `0x%x' from the MemorySpace\n", |
58 |
+@@ -61,6 +63,7 @@ dlptr_free(struct ptr_data *data) |
59 |
+ if (data->stype) dlfree(data->stype); |
60 |
+ if (data->ssize) dlfree(data->ssize); |
61 |
+ if (data->ids) dlfree(data->ids); |
62 |
++ dlfree(data); |
63 |
+ } |
64 |
+ |
65 |
+ void |
66 |
+Index: ruby-1.8.7-p299/ext/dl/sym.c |
67 |
+=================================================================== |
68 |
+--- ruby-1.8.7-p299.orig/ext/dl/sym.c |
69 |
++++ ruby-1.8.7-p299/ext/dl/sym.c |
70 |
+@@ -57,6 +57,8 @@ char2type(int ch) |
71 |
+ void |
72 |
+ dlsym_free(struct sym_data *data) |
73 |
+ { |
74 |
++ if(!data) |
75 |
++ return; |
76 |
+ if( data->name ){ |
77 |
+ DEBUG_CODE({ |
78 |
+ printf("dlsym_free(): free(data->name:%s)\n",data->name); |
79 |
+@@ -69,6 +71,7 @@ dlsym_free(struct sym_data *data) |
80 |
+ }); |
81 |
+ free(data->type); |
82 |
+ } |
83 |
++ dlfree(data); |
84 |
+ } |
85 |
+ |
86 |
+ VALUE |
87 |
|
88 |
diff --git a/patchsets/patches-1.8.7_p357/003_mkmf-parallel-install.patch b/patchsets/patches-1.8.7_p357/003_mkmf-parallel-install.patch |
89 |
new file mode 100644 |
90 |
index 0000000..9ecdc9b |
91 |
--- /dev/null |
92 |
+++ b/patchsets/patches-1.8.7_p357/003_mkmf-parallel-install.patch |
93 |
@@ -0,0 +1,16 @@ |
94 |
+ Patch for bug 239101 by Matsuu Takuto, via Redmine issue 1337 (yes, really). |
95 |
+ Backported for 1.8.* by Alex Legler. |
96 |
+ |
97 |
+Index: ruby-1.8.7-p299/lib/mkmf.rb |
98 |
+=================================================================== |
99 |
+--- ruby-1.8.7-p299.orig/lib/mkmf.rb |
100 |
++++ ruby-1.8.7-p299/lib/mkmf.rb |
101 |
+@@ -1523,7 +1523,7 @@ static: $(STATIC_LIB)#{$extout ? " inst |
102 |
+ dest = "#{dir}/#{f}" |
103 |
+ mfile.puts dir, "install-so: #{dest}" |
104 |
+ unless $extout |
105 |
+- mfile.print "#{dest}: #{f}\n" |
106 |
++ mfile.print "#{dest}: #{dir} #{f}\n" |
107 |
+ if (sep = config_string('BUILD_FILE_SEPARATOR')) |
108 |
+ f.gsub!("/", sep) |
109 |
+ dir.gsub!("/", sep) |
110 |
|
111 |
diff --git a/patchsets/patches-1.8.7_p357/004_berkdb-5.0.patch b/patchsets/patches-1.8.7_p357/004_berkdb-5.0.patch |
112 |
new file mode 100644 |
113 |
index 0000000..2516cd3 |
114 |
--- /dev/null |
115 |
+++ b/patchsets/patches-1.8.7_p357/004_berkdb-5.0.patch |
116 |
@@ -0,0 +1,13 @@ |
117 |
+Index: ruby-1.8.7-p299/ext/dbm/extconf.rb |
118 |
+=================================================================== |
119 |
+--- ruby-1.8.7-p299.orig/ext/dbm/extconf.rb |
120 |
++++ ruby-1.8.7-p299/ext/dbm/extconf.rb |
121 |
+@@ -26,7 +26,7 @@ def headers.db_check(db) |
122 |
+ case db |
123 |
+ when /^db2?$/ |
124 |
+ db_prefix = "__db_n" |
125 |
+- hsearch = "-DDB_DBM_HSEARCH " |
126 |
++ hsearch = "-DDB_DBM_HSEARCH -DHAVE_DBM " |
127 |
+ when "gdbm" |
128 |
+ have_gdbm = true |
129 |
+ when "gdbm_compat" |
130 |
|
131 |
diff --git a/patchsets/patches-1.8.7_p357/007_no-undefined-ext.patch b/patchsets/patches-1.8.7_p357/007_no-undefined-ext.patch |
132 |
new file mode 100644 |
133 |
index 0000000..41a7ddb |
134 |
--- /dev/null |
135 |
+++ b/patchsets/patches-1.8.7_p357/007_no-undefined-ext.patch |
136 |
@@ -0,0 +1,13 @@ |
137 |
+Index: ruby-1.8.7-p299/configure.in |
138 |
+=================================================================== |
139 |
+--- ruby-1.8.7-p299.orig/configure.in |
140 |
++++ ruby-1.8.7-p299/configure.in |
141 |
+@@ -1223,7 +1223,7 @@ if test "$with_dln_a_out" != yes; then |
142 |
+ linux* | gnu* | k*bsd*-gnu | netbsd* | bsdi*) |
143 |
+ : ${LDSHARED='${CC} -shared'} |
144 |
+ if test "$rb_cv_binary_elf" = yes; then |
145 |
+- LDFLAGS="$LDFLAGS -Wl,-export-dynamic" |
146 |
++ LDFLAGS="$LDFLAGS -Wl,-export-dynamic -Wl,--no-undefined" |
147 |
+ fi |
148 |
+ rb_cv_dlopen=yes ;; |
149 |
+ interix*) : ${LDSHARED="$CC -shared"} |
150 |
|
151 |
diff --git a/patchsets/patches-1.8.7_p357/008_ppc64.patch b/patchsets/patches-1.8.7_p357/008_ppc64.patch |
152 |
new file mode 100644 |
153 |
index 0000000..9a52cd7 |
154 |
--- /dev/null |
155 |
+++ b/patchsets/patches-1.8.7_p357/008_ppc64.patch |
156 |
@@ -0,0 +1,42 @@ |
157 |
+ diff --git a/eval.c b/eval.c |
158 |
+ index a54fdce..e25ee24 100644 |
159 |
+ --- a/eval.c |
160 |
+ +++ b/eval.c |
161 |
+ @@ -188,6 +188,9 @@ int function_call_may_return_twice_false_2 = 0; |
162 |
+ (function_call_may_return_twice_false_2 ? \ |
163 |
+ setjmp(function_call_may_return_twice_jmp_buf) : \ |
164 |
+ 0) |
165 |
+ +# elif defined(__PPC64__) |
166 |
+ +# define JUST_BEFORE_SETJMP(extra_save, j) ((void)0) |
167 |
+ +# define JUST_AFTER_SETJMP(extra_save, j) ((j)->status ? (void)0 : (extra_save)) |
168 |
+ # elif defined(__FreeBSD__) && __FreeBSD__ < 7 |
169 |
+ /* |
170 |
+ * workaround for FreeBSD/i386 getcontext/setcontext bug. |
171 |
+ @@ -205,16 +208,23 @@ static int volatile freebsd_clear_carry_flag = 0; |
172 |
+ # ifndef POST_GETCONTEXT |
173 |
+ # define POST_GETCONTEXT 0 |
174 |
+ # endif |
175 |
+ +# ifndef JUST_BEFORE_SETJMP |
176 |
+ +# define JUST_BEFORE_SETJMP(extra_save, j) (extra_save) |
177 |
+ +# endif |
178 |
+ +# ifndef JUST_AFTER_SETJMP |
179 |
+ +# define JUST_AFTER_SETJMP(extra_save, j) ((void)0) |
180 |
+ +# endif |
181 |
+ # define ruby_longjmp(env, val) rb_jump_context(env, val) |
182 |
+ -# define ruby_setjmp(just_before_setjmp, j) ((j)->status = 0, \ |
183 |
+ - (just_before_setjmp), \ |
184 |
+ +# define ruby_setjmp(extra_save, j) ((j)->status = 0, \ |
185 |
+ + JUST_BEFORE_SETJMP(extra_save, j), \ |
186 |
+ PRE_GETCONTEXT, \ |
187 |
+ getcontext(&(j)->context), \ |
188 |
+ POST_GETCONTEXT, \ |
189 |
+ + JUST_AFTER_SETJMP(extra_save, j), \ |
190 |
+ (j)->status) |
191 |
+ #else |
192 |
+ -# define ruby_setjmp(just_before_setjmp, env) \ |
193 |
+ - ((just_before_setjmp), RUBY_SETJMP(env)) |
194 |
+ +# define ruby_setjmp(extra_save, env) \ |
195 |
+ + ((extra_save), RUBY_SETJMP(env)) |
196 |
+ # define ruby_longjmp(env,val) RUBY_LONGJMP(env,val) |
197 |
+ # ifdef __CYGWIN__ |
198 |
+ # ifndef _setjmp |
199 |
|
200 |
diff --git a/patchsets/patches-1.8.7_p357/013_CVE-2011-0188.patch b/patchsets/patches-1.8.7_p357/013_CVE-2011-0188.patch |
201 |
new file mode 100644 |
202 |
index 0000000..9e29917 |
203 |
--- /dev/null |
204 |
+++ b/patchsets/patches-1.8.7_p357/013_CVE-2011-0188.patch |
205 |
@@ -0,0 +1,14 @@ |
206 |
+Patch backported from upstream revision 30993 by a3li@g.o. |
207 |
+ |
208 |
+diff -Naur ruby-1.8.7-p334.orig/ext/bigdecimal/bigdecimal.c ruby-1.8.7-p334/ext/bigdecimal/bigdecimal.c |
209 |
+--- ruby-1.8.7-p334.orig/ext/bigdecimal/bigdecimal.c 2010-06-08 09:49:18.000000000 +0200 |
210 |
++++ ruby-1.8.7-p334/ext/bigdecimal/bigdecimal.c 2011-05-31 20:53:23.268999218 +0200 |
211 |
+@@ -2032,7 +2032,7 @@ |
212 |
+ VP_EXPORT void * |
213 |
+ VpMemAlloc(U_LONG mb) |
214 |
+ { |
215 |
+- void *p = xmalloc((unsigned int)mb); |
216 |
++ void *p = xmalloc(mb); |
217 |
+ if(!p) { |
218 |
+ VpException(VP_EXCEPTION_MEMORY,"failed to allocate memory",1); |
219 |
+ } |
220 |
|
221 |
diff --git a/patchsets/patches-1.8.7_p357/series b/patchsets/patches-1.8.7_p357/series |
222 |
new file mode 100644 |
223 |
index 0000000..9634e25 |
224 |
--- /dev/null |
225 |
+++ b/patchsets/patches-1.8.7_p357/series |
226 |
@@ -0,0 +1,6 @@ |
227 |
+001_memory_leak.patch |
228 |
+003_mkmf-parallel-install.patch |
229 |
+004_berkdb-5.0.patch |
230 |
+007_no-undefined-ext.patch |
231 |
+008_ppc64.patch |
232 |
+013_CVE-2011-0188.patch |