1 |
jlec 13/11/23 08:38:24 |
2 |
|
3 |
Modified: tclreadline-2.1.0-gold.patch |
4 |
Added: tclreadline-2.1.0-rl-history-expand.patch |
5 |
tclreadline-2.1.0-rl-prompt.patch |
6 |
tclreadline-2.1.0-alloc-free.patch |
7 |
tclreadline-2.1.0-rl-executing-macro.patch |
8 |
Log: |
9 |
dev-tcltk/tclreadline: Add multiple fixes imported from debian and kindly provided by Quentin Minster, #440648 |
10 |
|
11 |
(Portage version: 2.2.7/cvs/Linux x86_64, signed Manifest commit with key B9D4F231BD1558AB!) |
12 |
|
13 |
Revision Changes Path |
14 |
1.2 dev-tcltk/tclreadline/files/tclreadline-2.1.0-gold.patch |
15 |
|
16 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-tcltk/tclreadline/files/tclreadline-2.1.0-gold.patch?rev=1.2&view=markup |
17 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-tcltk/tclreadline/files/tclreadline-2.1.0-gold.patch?rev=1.2&content-type=text/plain |
18 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-tcltk/tclreadline/files/tclreadline-2.1.0-gold.patch?r1=1.1&r2=1.2 |
19 |
|
20 |
Index: tclreadline-2.1.0-gold.patch |
21 |
=================================================================== |
22 |
RCS file: /var/cvsroot/gentoo-x86/dev-tcltk/tclreadline/files/tclreadline-2.1.0-gold.patch,v |
23 |
retrieving revision 1.1 |
24 |
retrieving revision 1.2 |
25 |
diff -u -r1.1 -r1.2 |
26 |
--- tclreadline-2.1.0-gold.patch 4 Nov 2012 19:52:08 -0000 1.1 |
27 |
+++ tclreadline-2.1.0-gold.patch 23 Nov 2013 08:38:24 -0000 1.2 |
28 |
@@ -9,7 +9,7 @@ |
29 |
INCLUDES = -I$(TCL_INCLUDE_DIR) -I$(READLINE_INCLUDE_DIR) |
30 |
|
31 |
## libtclreadline_la_LIBADD = $(LIBS) |
32 |
-+libtclreadline_la_LIBADD = -ltcl |
33 |
++libtclreadline_la_LIBADD = $(TCL_LIB_SPEC) -lreadline |
34 |
libtclreadline_la_LDFLAGS = -release $(MAJOR).$(MINOR).$(PATCHLEVEL) |
35 |
|
36 |
tclrldir = @TCLRL_DIR@ |
37 |
|
38 |
|
39 |
|
40 |
1.1 dev-tcltk/tclreadline/files/tclreadline-2.1.0-rl-history-expand.patch |
41 |
|
42 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-tcltk/tclreadline/files/tclreadline-2.1.0-rl-history-expand.patch?rev=1.1&view=markup |
43 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-tcltk/tclreadline/files/tclreadline-2.1.0-rl-history-expand.patch?rev=1.1&content-type=text/plain |
44 |
|
45 |
Index: tclreadline-2.1.0-rl-history-expand.patch |
46 |
=================================================================== |
47 |
diff -ur a/tclreadline.c b/tclreadline.c |
48 |
--- a/tclreadline.c 2013-11-16 20:14:28.876272386 +0100 |
49 |
+++ b/tclreadline.c 2013-11-16 20:14:24.191390550 +0100 |
50 |
@@ -503,25 +503,22 @@ |
51 |
char* expansion = (char*) NULL; |
52 |
int status = history_expand(ptr, &expansion); |
53 |
|
54 |
- if (status >= 1) { |
55 |
+ if (status >= 2) { |
56 |
/* TODO: make this a valid tcl output */ |
57 |
printf("%s\n", expansion); |
58 |
free(ptr); |
59 |
free(expansion); |
60 |
return; |
61 |
- } else if (-1 == status) { |
62 |
+ } else if (status <= -1) { |
63 |
Tcl_AppendResult |
64 |
- (tclrl_interp, "error in history expansion\n", (char*) NULL); |
65 |
+ (tclrl_interp, "error in history expansion: ", expansion, "\n", (char*) NULL); |
66 |
TclReadlineTerminate(TCL_ERROR); |
67 |
free(ptr); |
68 |
free(expansion); |
69 |
return; |
70 |
- } |
71 |
- /** |
72 |
- * TODO: status == 2 ... |
73 |
- */ |
74 |
- |
75 |
- Tcl_AppendResult(tclrl_interp, expansion, (char*) NULL); |
76 |
+ } else { |
77 |
+ Tcl_AppendResult(tclrl_interp, expansion, (char*) NULL); |
78 |
+ } |
79 |
|
80 |
#ifdef EXECUTING_MACRO_HACK |
81 |
/** |
82 |
|
83 |
|
84 |
|
85 |
1.1 dev-tcltk/tclreadline/files/tclreadline-2.1.0-rl-prompt.patch |
86 |
|
87 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-tcltk/tclreadline/files/tclreadline-2.1.0-rl-prompt.patch?rev=1.1&view=markup |
88 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-tcltk/tclreadline/files/tclreadline-2.1.0-rl-prompt.patch?rev=1.1&content-type=text/plain |
89 |
|
90 |
Index: tclreadline-2.1.0-rl-prompt.patch |
91 |
=================================================================== |
92 |
diff -ur a/tclreadline.c b/tclreadline.c |
93 |
--- a/tclreadline.c 2013-11-16 20:14:28.876272386 +0100 |
94 |
+++ b/tclreadline.c 2013-11-16 20:37:47.455986902 +0100 |
95 |
@@ -234,7 +234,7 @@ |
96 |
|
97 |
rl_callback_handler_install( |
98 |
objc == 3 ? Tcl_GetStringFromObj(objv[2], 0) |
99 |
- : "%", TclReadlineLineCompleteHandler); |
100 |
+ : "% ", TclReadlineLineCompleteHandler); |
101 |
|
102 |
Tcl_CreateFileHandler(0, TCL_READABLE, |
103 |
TclReadlineReadHandler, (ClientData) NULL); |
104 |
|
105 |
|
106 |
|
107 |
1.1 dev-tcltk/tclreadline/files/tclreadline-2.1.0-alloc-free.patch |
108 |
|
109 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-tcltk/tclreadline/files/tclreadline-2.1.0-alloc-free.patch?rev=1.1&view=markup |
110 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-tcltk/tclreadline/files/tclreadline-2.1.0-alloc-free.patch?rev=1.1&content-type=text/plain |
111 |
|
112 |
Index: tclreadline-2.1.0-alloc-free.patch |
113 |
=================================================================== |
114 |
diff -ur a/tclreadline.c b/tclreadline.c |
115 |
--- a/tclreadline.c 2000-09-20 19:44:34.000000000 +0200 |
116 |
+++ b/tclreadline.c 2013-11-18 10:35:13.889610060 +0100 |
117 |
@@ -343,7 +343,9 @@ |
118 |
return TCL_ERROR; |
119 |
} else if (3 == objc) { |
120 |
- if (tclrl_custom_completer) |
121 |
+ if (tclrl_custom_completer) { |
122 |
- FREE(tclrl_custom_completer); |
123 |
+ free(tclrl_custom_completer); |
124 |
+ tclrl_custom_completer = NULL; |
125 |
+ } |
126 |
if (!blank_line(Tcl_GetStringFromObj(objv[2], 0))) |
127 |
tclrl_custom_completer = |
128 |
stripwhite(strdup(Tcl_GetStringFromObj(objv[2], 0))); |
129 |
@@ -378,7 +380,9 @@ |
130 |
return TCL_ERROR; |
131 |
} else if (3 == objc) { |
132 |
- if (tclrl_eof_string) |
133 |
+ if (tclrl_eof_string) { |
134 |
- FREE(tclrl_eof_string); |
135 |
+ free(tclrl_eof_string); |
136 |
+ tclrl_eof_string = NULL; |
137 |
+ } |
138 |
if (!blank_line(Tcl_GetStringFromObj(objv[2], 0))) |
139 |
tclrl_eof_string = |
140 |
stripwhite(strdup(Tcl_GetStringFromObj(objv[2], 0))); |
141 |
@@ -506,10 +510,16 @@ |
142 |
if (status >= 1) { |
143 |
/* TODO: make this a valid tcl output */ |
144 |
printf("%s\n", expansion); |
145 |
+ free(ptr); |
146 |
+ free(expansion); |
147 |
+ return; |
148 |
} else if (-1 == status) { |
149 |
Tcl_AppendResult |
150 |
(tclrl_interp, "error in history expansion\n", (char*) NULL); |
151 |
TclReadlineTerminate(TCL_ERROR); |
152 |
+ free(ptr); |
153 |
+ free(expansion); |
154 |
+ return; |
155 |
} |
156 |
/** |
157 |
* TODO: status == 2 ... |
158 |
@@ -544,8 +554,8 @@ |
159 |
* tell the calling routines to terminate. |
160 |
*/ |
161 |
TclReadlineTerminate(LINE_COMPLETE); |
162 |
- FREE(ptr); |
163 |
- FREE(expansion); |
164 |
+ free(ptr); |
165 |
+ free(expansion); |
166 |
} |
167 |
} |
168 |
|
169 |
@@ -673,7 +683,7 @@ |
170 |
strcpy(rl_line_buffer, expansion); |
171 |
rl_end = strlen(expansion); |
172 |
rl_point += strlen(expansion) - oldlen; |
173 |
- FREE(expansion); |
174 |
+ free(expansion); |
175 |
/* |
176 |
* TODO: |
177 |
* because we return 0 == matches, |
178 |
@@ -682,7 +690,8 @@ |
179 |
*/ |
180 |
return matches; |
181 |
} |
182 |
- FREE(expansion); |
183 |
+ free(expansion); |
184 |
+ expansion = NULL; |
185 |
} |
186 |
|
187 |
if (tclrl_custom_completer) { |
188 |
@@ -699,15 +710,19 @@ |
189 |
state = Tcl_VarEval(tclrl_interp, tclrl_custom_completer, |
190 |
" \"", quoted_text, "\" ", start_s, " ", end_s, |
191 |
" \"", quoted_rl_line_buffer, "\"", (char*) NULL); |
192 |
- FREE(quoted_text); |
193 |
- FREE(quoted_rl_line_buffer); |
194 |
if (TCL_OK != state) { |
195 |
Tcl_AppendResult (tclrl_interp, " `", tclrl_custom_completer, |
196 |
" \"", quoted_text, "\" ", start_s, " ", end_s, |
197 |
" \"", quoted_rl_line_buffer, "\"' failed.", (char*) NULL); |
198 |
TclReadlineTerminate(state); |
199 |
+ free(quoted_text); |
200 |
+ free(quoted_rl_line_buffer); |
201 |
return matches; |
202 |
} |
203 |
+ free(quoted_text); |
204 |
+ quoted_text = NULL; |
205 |
+ free(quoted_rl_line_buffer); |
206 |
+ quoted_rl_line_buffer = NULL; |
207 |
obj = Tcl_GetObjResult(tclrl_interp); |
208 |
status = Tcl_ListObjGetElements(tclrl_interp, obj, &objc, &objv); |
209 |
if (TCL_OK != status) |
210 |
@@ -715,12 +732,12 @@ |
211 |
|
212 |
if (objc) { |
213 |
int i, length; |
214 |
- matches = (char**) MALLOC(sizeof(char*) * (objc + 1)); |
215 |
+ matches = (char**) malloc(sizeof(char*) * (objc + 1)); |
216 |
for (i = 0; i < objc; i++) { |
217 |
matches[i] = strdup(Tcl_GetStringFromObj(objv[i], &length)); |
218 |
if (1 == objc && !strlen(matches[i])) { |
219 |
- FREE(matches[i]); |
220 |
+ free(matches[i]); |
221 |
- FREE(matches); |
222 |
+ free(matches); |
223 |
Tcl_ResetResult(tclrl_interp); /* clear result space */ |
224 |
return (char**) NULL; |
225 |
} |
226 |
@@ -735,7 +752,7 @@ |
227 |
*/ |
228 |
if (2 == objc && !strlen(matches[1])) { |
229 |
i--; |
230 |
- FREE(matches[1]); |
231 |
+ free(matches[1]); |
232 |
rl_completion_append_character = '\0'; |
233 |
} |
234 |
|
235 |
|
236 |
|
237 |
|
238 |
1.1 dev-tcltk/tclreadline/files/tclreadline-2.1.0-rl-executing-macro.patch |
239 |
|
240 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-tcltk/tclreadline/files/tclreadline-2.1.0-rl-executing-macro.patch?rev=1.1&view=markup |
241 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-tcltk/tclreadline/files/tclreadline-2.1.0-rl-executing-macro.patch?rev=1.1&content-type=text/plain |
242 |
|
243 |
Index: tclreadline-2.1.0-rl-executing-macro.patch |
244 |
=================================================================== |
245 |
diff -ur a/configure.ac b/configure.ac |
246 |
--- a/configure.ac 2000-12-08 01:45:45.000000000 +0100 |
247 |
+++ b/configure.ac 2013-11-15 13:37:36.490520853 +0100 |
248 |
@@ -182,29 +182,36 @@ |
249 |
[ --with-readline-library=DIR |
250 |
lib spec to readline (e.g. '-L/usr/local/lib -lreadline')], |
251 |
LIBS="$LIBS $withval", |
252 |
- AC_CHECK_LIB(readline, rl_callback_read_char, , |
253 |
- AC_MSG_RESULT([ |
254 |
- Your readline version does not support readline's alternate interface. |
255 |
- Please upgrade to readline >= 2.2 and retry. |
256 |
- ]) |
257 |
- exit |
258 |
+ AC_SEARCH_LIBS(rl_callback_read_char, readline, , |
259 |
+ AC_MSG_RESULT([ |
260 |
+ Your readline version does not support readline's alternate interface. |
261 |
+ Please upgrade to readline >= 2.2 and retry. |
262 |
+ ]) |
263 |
+ exit |
264 |
) |
265 |
) |
266 |
|
267 |
|
268 |
|
269 |
-# check for readline's (macro.c) private variable |
270 |
-# _rl_executing_macro. |
271 |
+# check for readline's rl_executing_macro |
272 |
+# (could be macro.c's private variable _rl_executing_macro). |
273 |
|
274 |
-AC_MSG_CHECKING([for _rl_executing_macro in -lreadline]) |
275 |
-AC_TRY_LINK(,[ |
276 |
+AC_CHECK_DECL(rl_executing_macro |
277 |
+, AC_DEFINE(EXECUTING_MACRO_NAME, rl_executing_macro, |
278 |
+ [ Define the name of the executing macro variable in libreadline. ]) |
279 |
+, AC_MSG_CHECKING([for _rl_executing_macro in -lreadline]) |
280 |
+ AC_TRY_LINK(,[ |
281 |
extern char* _rl_executing_macro; |
282 |
_rl_executing_macro = (char*) 0; |
283 |
-], |
284 |
- AC_MSG_RESULT(yes); |
285 |
+ ] |
286 |
+ , AC_MSG_RESULT(yes) |
287 |
AC_DEFINE(EXECUTING_MACRO_HACK, 1, |
288 |
- [ Define if _rl_executing_macro is resolved in libreadline. ]), |
289 |
- AC_MSG_RESULT(no)) |
290 |
+ [ Define if EXECUTING_MACRO_NAME is resolved in libreadline. ]) |
291 |
+ AC_DEFINE(EXECUTING_MACRO_NAME, _rl_executing_macro, |
292 |
+ [ Define the name of the executing macro variable in libreadline. ]) |
293 |
+ , AC_MSG_RESULT(no)) |
294 |
+, [AC_INCLUDES_DEFAULT |
295 |
+#include "$READLINE_INCLUDE_DIR/readline.h"]) |
296 |
|
297 |
# check for readline's rl_cleanup_after_signal |
298 |
|
299 |
diff -ur a/tclreadline.c b/tclreadline.c |
300 |
--- a/tclreadline.c 2000-09-20 19:44:34.000000000 +0200 |
301 |
+++ b/tclreadline.c 2013-11-15 11:09:42.269771129 +0100 |
302 |
@@ -41,7 +41,7 @@ |
303 |
* We need it here to decide, if we should read more |
304 |
* characters from a macro. Dirty, but it should work. |
305 |
*/ |
306 |
-extern char* _rl_executing_macro; |
307 |
+extern char* EXECUTING_MACRO_NAME; |
308 |
#endif |
309 |
|
310 |
#include "tclreadline.h" |
311 |
@@ -249,14 +249,14 @@ |
312 |
tclrl_state = LINE_PENDING; |
313 |
|
314 |
while (!TclReadlineLineComplete()) { |
315 |
-#ifdef EXECUTING_MACRO_HACK |
316 |
+#ifdef EXECUTING_MACRO_NAME |
317 |
/** |
318 |
* check first, if more characters are |
319 |
* available from _rl_executing_macro, |
320 |
* because Tcl_DoOneEvent() will (naturally) |
321 |
* not detect this `event'. |
322 |
*/ |
323 |
- if (_rl_executing_macro) |
324 |
+ if (EXECUTING_MACRO_NAME) |
325 |
TclReadlineReadHandler((ClientData) NULL, TCL_READABLE); |
326 |
else |
327 |
#endif |
328 |
@@ -468,17 +468,17 @@ |
329 |
TclReadlineReadHandler(ClientData clientData, int mask) |
330 |
{ |
331 |
if (mask & TCL_READABLE) { |
332 |
-#ifdef EXECUTING_MACRO_HACK |
333 |
+#ifdef EXECUTING_MACRO_NAME |
334 |
do { |
335 |
#endif |
336 |
rl_callback_read_char(); |
337 |
-#ifdef EXECUTING_MACRO_HACK |
338 |
+#ifdef EXECUTING_MACRO_NAME |
339 |
/** |
340 |
* check, if we're inside a macro and |
341 |
* if so, read all macro characters |
342 |
* until the next eol. |
343 |
*/ |
344 |
- } while (_rl_executing_macro && !TclReadlineLineComplete()); |
345 |
+ } while (EXECUTING_MACRO_NAME && !TclReadlineLineComplete()); |
346 |
#endif |
347 |
} |
348 |
} |
349 |
@@ -517,12 +517,12 @@ |
350 |
|
351 |
Tcl_AppendResult(tclrl_interp, expansion, (char*) NULL); |
352 |
|
353 |
-#ifdef EXECUTING_MACRO_HACK |
354 |
+#ifdef EXECUTING_MACRO_NAME |
355 |
/** |
356 |
* don't stuff macro lines |
357 |
* into readline's history. |
358 |
*/ |
359 |
- if(!_rl_executing_macro) { |
360 |
+ if(!EXECUTING_MACRO_NAME) { |
361 |
#endif |
362 |
/** |
363 |
* don't stuff empty lines |
364 |
@@ -537,7 +537,7 @@ |
365 |
if (tclrl_last_line) |
366 |
free(tclrl_last_line); |
367 |
tclrl_last_line = strdup(expansion); |
368 |
-#ifdef EXECUTING_MACRO_HACK |
369 |
+#ifdef EXECUTING_MACRO_NAME |
370 |
} |
371 |
#endif |
372 |
/** |