]> git.pld-linux.org Git - packages/expect.git/blame - expect-5.45-segfault-with-stubs.patch
- updated to 5.45.4
[packages/expect.git] / expect-5.45-segfault-with-stubs.patch
CommitLineData
dade3e15
AM
1diff -up expect5.45/exp_clib.c.orig expect5.45/exp_clib.c
2--- expect5.45/exp_clib.c.orig 2010-09-01 00:20:27.000000000 +0200
3+++ expect5.45/exp_clib.c 2015-05-19 12:01:22.413349423 +0200
4@@ -84,6 +84,8 @@ would appreciate credit if this program
5 #ifndef _STDLIB
6 #define _STDLIB
7
8+#include <tcl.h>
9+
10 extern void abort _ANSI_ARGS_((void));
11 extern double atof _ANSI_ARGS_((CONST char *string));
12 extern int atoi _ANSI_ARGS_((CONST char *string));
13@@ -114,7 +116,6 @@ extern unsigned long strtoul _ANSI_ARGS_
14 #include <stdlib.h> /* for malloc */
15 #endif
16
17-#include <tcl.h>
18 #include "expect.h"
19 #define TclRegError exp_TclRegError
20
21@@ -1465,6 +1466,467 @@ TclGetRegError()
22 */
23
24 /*
25+ * following stolen from tcl8.0.4/generic/tclPosixStr.c
26+ */
27+
28+/*
29+ *----------------------------------------------------------------------
30+ *
31+ * Tcl_ErrnoMsg --
32+ *
33+ * Return a human-readable message corresponding to a given
34+ * errno value.
35+ *
36+ * Results:
37+ * The return value is the standard POSIX error message for
38+ * errno. This procedure is used instead of strerror because
39+ * strerror returns slightly different values on different
40+ * machines (e.g. different capitalizations), which cause
41+ * problems for things such as regression tests. This procedure
42+ * provides messages for most standard errors, then it calls
43+ * strerror for things it doesn't understand.
44+ *
45+ * Side effects:
46+ * None.
47+ *
48+ *----------------------------------------------------------------------
49+ */
50+
51+static
52+char *
53+Tcl_ErrnoMsg(err)
54+ int err; /* Error number (such as in errno variable). */
55+{
56+ switch (err) {
57+#ifdef E2BIG
58+ case E2BIG: return "argument list too long";
59+#endif
60+#ifdef EACCES
61+ case EACCES: return "permission denied";
62+#endif
63+#ifdef EADDRINUSE
64+ case EADDRINUSE: return "address already in use";
65+#endif
66+#ifdef EADDRNOTAVAIL
67+ case EADDRNOTAVAIL: return "can't assign requested address";
68+#endif
69+#ifdef EADV
70+ case EADV: return "advertise error";
71+#endif
72+#ifdef EAFNOSUPPORT
73+ case EAFNOSUPPORT: return "address family not supported by protocol family";
74+#endif
75+#ifdef EAGAIN
76+ case EAGAIN: return "resource temporarily unavailable";
77+#endif
78+#ifdef EALIGN
79+ case EALIGN: return "EALIGN";
80+#endif
81+#if defined(EALREADY) && (!defined(EBUSY) || (EALREADY != EBUSY ))
82+ case EALREADY: return "operation already in progress";
83+#endif
84+#ifdef EBADE
85+ case EBADE: return "bad exchange descriptor";
86+#endif
87+#ifdef EBADF
88+ case EBADF: return "bad file number";
89+#endif
90+#ifdef EBADFD
91+ case EBADFD: return "file descriptor in bad state";
92+#endif
93+#ifdef EBADMSG
94+ case EBADMSG: return "not a data message";
95+#endif
96+#ifdef EBADR
97+ case EBADR: return "bad request descriptor";
98+#endif
99+#ifdef EBADRPC
100+ case EBADRPC: return "RPC structure is bad";
101+#endif
102+#ifdef EBADRQC
103+ case EBADRQC: return "bad request code";
104+#endif
105+#ifdef EBADSLT
106+ case EBADSLT: return "invalid slot";
107+#endif
108+#ifdef EBFONT
109+ case EBFONT: return "bad font file format";
110+#endif
111+#ifdef EBUSY
112+ case EBUSY: return "file busy";
113+#endif
114+#ifdef ECHILD
115+ case ECHILD: return "no children";
116+#endif
117+#ifdef ECHRNG
118+ case ECHRNG: return "channel number out of range";
119+#endif
120+#ifdef ECOMM
121+ case ECOMM: return "communication error on send";
122+#endif
123+#ifdef ECONNABORTED
124+ case ECONNABORTED: return "software caused connection abort";
125+#endif
126+#ifdef ECONNREFUSED
127+ case ECONNREFUSED: return "connection refused";
128+#endif
129+#ifdef ECONNRESET
130+ case ECONNRESET: return "connection reset by peer";
131+#endif
132+#if defined(EDEADLK) && (!defined(EWOULDBLOCK) || (EDEADLK != EWOULDBLOCK))
133+ case EDEADLK: return "resource deadlock avoided";
134+#endif
135+#if defined(EDEADLOCK) && (!defined(EDEADLK) || (EDEADLOCK != EDEADLK))
136+ case EDEADLOCK: return "resource deadlock avoided";
137+#endif
138+#ifdef EDESTADDRREQ
139+ case EDESTADDRREQ: return "destination address required";
140+#endif
141+#ifdef EDIRTY
142+ case EDIRTY: return "mounting a dirty fs w/o force";
143+#endif
144+#ifdef EDOM
145+ case EDOM: return "math argument out of range";
146+#endif
147+#ifdef EDOTDOT
148+ case EDOTDOT: return "cross mount point";
149+#endif
150+#ifdef EDQUOT
151+ case EDQUOT: return "disk quota exceeded";
152+#endif
153+#ifdef EDUPPKG
154+ case EDUPPKG: return "duplicate package name";
155+#endif
156+#ifdef EEXIST
157+ case EEXIST: return "file already exists";
158+#endif
159+#ifdef EFAULT
160+ case EFAULT: return "bad address in system call argument";
161+#endif
162+#ifdef EFBIG
163+ case EFBIG: return "file too large";
164+#endif
165+#ifdef EHOSTDOWN
166+ case EHOSTDOWN: return "host is down";
167+#endif
168+#ifdef EHOSTUNREACH
169+ case EHOSTUNREACH: return "host is unreachable";
170+#endif
171+#if defined(EIDRM) && (!defined(EINPROGRESS) || (EIDRM != EINPROGRESS))
172+ case EIDRM: return "identifier removed";
173+#endif
174+#ifdef EINIT
175+ case EINIT: return "initialization error";
176+#endif
177+#ifdef EINPROGRESS
178+ case EINPROGRESS: return "operation now in progress";
179+#endif
180+#ifdef EINTR
181+ case EINTR: return "interrupted system call";
182+#endif
183+#ifdef EINVAL
184+ case EINVAL: return "invalid argument";
185+#endif
186+#ifdef EIO
187+ case EIO: return "I/O error";
188+#endif
189+#ifdef EISCONN
190+ case EISCONN: return "socket is already connected";
191+#endif
192+#ifdef EISDIR
193+ case EISDIR: return "illegal operation on a directory";
194+#endif
195+#ifdef EISNAME
196+ case EISNAM: return "is a name file";
197+#endif
198+#ifdef ELBIN
199+ case ELBIN: return "ELBIN";
200+#endif
201+#ifdef EL2HLT
202+ case EL2HLT: return "level 2 halted";
203+#endif
204+#ifdef EL2NSYNC
205+ case EL2NSYNC: return "level 2 not synchronized";
206+#endif
207+#ifdef EL3HLT
208+ case EL3HLT: return "level 3 halted";
209+#endif
210+#ifdef EL3RST
211+ case EL3RST: return "level 3 reset";
212+#endif
213+#ifdef ELIBACC
214+ case ELIBACC: return "can not access a needed shared library";
215+#endif
216+#ifdef ELIBBAD
217+ case ELIBBAD: return "accessing a corrupted shared library";
218+#endif
219+#ifdef ELIBEXEC
220+ case ELIBEXEC: return "can not exec a shared library directly";
221+#endif
222+#ifdef ELIBMAX
223+ case ELIBMAX: return
224+ "attempting to link in more shared libraries than system limit";
225+#endif
226+#ifdef ELIBSCN
227+ case ELIBSCN: return ".lib section in a.out corrupted";
228+#endif
229+#ifdef ELNRNG
230+ case ELNRNG: return "link number out of range";
231+#endif
232+#if defined(ELOOP) && (!defined(ENOENT) || (ELOOP != ENOENT))
233+ case ELOOP: return "too many levels of symbolic links";
234+#endif
235+#ifdef EMFILE
236+ case EMFILE: return "too many open files";
237+#endif
238+#ifdef EMLINK
239+ case EMLINK: return "too many links";
240+#endif
241+#ifdef EMSGSIZE
242+ case EMSGSIZE: return "message too long";
243+#endif
244+#ifdef EMULTIHOP
245+ case EMULTIHOP: return "multihop attempted";
246+#endif
247+#ifdef ENAMETOOLONG
248+ case ENAMETOOLONG: return "file name too long";
249+#endif
250+#ifdef ENAVAIL
251+ case ENAVAIL: return "not available";
252+#endif
253+#ifdef ENET
254+ case ENET: return "ENET";
255+#endif
256+#ifdef ENETDOWN
257+ case ENETDOWN: return "network is down";
258+#endif
259+#ifdef ENETRESET
260+ case ENETRESET: return "network dropped connection on reset";
261+#endif
262+#ifdef ENETUNREACH
263+ case ENETUNREACH: return "network is unreachable";
264+#endif
265+#ifdef ENFILE
266+ case ENFILE: return "file table overflow";
267+#endif
268+#ifdef ENOANO
269+ case ENOANO: return "anode table overflow";
270+#endif
271+#if defined(ENOBUFS) && (!defined(ENOSR) || (ENOBUFS != ENOSR))
272+ case ENOBUFS: return "no buffer space available";
273+#endif
274+#ifdef ENOCSI
275+ case ENOCSI: return "no CSI structure available";
276+#endif
277+#if defined(ENODATA) && (!defined(ECONNREFUSED) || (ENODATA != ECONNREFUSED))
278+ case ENODATA: return "no data available";
279+#endif
280+#ifdef ENODEV
281+ case ENODEV: return "no such device";
282+#endif
283+#ifdef ENOENT
284+ case ENOENT: return "no such file or directory";
285+#endif
286+#ifdef ENOEXEC
287+ case ENOEXEC: return "exec format error";
288+#endif
289+#ifdef ENOLCK
290+ case ENOLCK: return "no locks available";
291+#endif
292+#ifdef ENOLINK
293+ case ENOLINK: return "link has be severed";
294+#endif
295+#ifdef ENOMEM
296+ case ENOMEM: return "not enough memory";
297+#endif
298+#ifdef ENOMSG
299+ case ENOMSG: return "no message of desired type";
300+#endif
301+#ifdef ENONET
302+ case ENONET: return "machine is not on the network";
303+#endif
304+#ifdef ENOPKG
305+ case ENOPKG: return "package not installed";
306+#endif
307+#ifdef ENOPROTOOPT
308+ case ENOPROTOOPT: return "bad proocol option";
309+#endif
310+#ifdef ENOSPC
311+ case ENOSPC: return "no space left on device";
312+#endif
313+#if defined(ENOSR) && (!defined(ENAMETOOLONG) || (ENAMETOOLONG != ENOSR))
314+ case ENOSR: return "out of stream resources";
315+#endif
316+#if defined(ENOSTR) && (!defined(ENOTTY) || (ENOTTY != ENOSTR))
317+ case ENOSTR: return "not a stream device";
318+#endif
319+#ifdef ENOSYM
320+ case ENOSYM: return "unresolved symbol name";
321+#endif
322+#ifdef ENOSYS
323+ case ENOSYS: return "function not implemented";
324+#endif
325+#ifdef ENOTBLK
326+ case ENOTBLK: return "block device required";
327+#endif
328+#ifdef ENOTCONN
329+ case ENOTCONN: return "socket is not connected";
330+#endif
331+#ifdef ENOTDIR
332+ case ENOTDIR: return "not a directory";
333+#endif
334+#if defined(ENOTEMPTY) && (!defined(EEXIST) || (ENOTEMPTY != EEXIST))
335+ case ENOTEMPTY: return "directory not empty";
336+#endif
337+#ifdef ENOTNAM
338+ case ENOTNAM: return "not a name file";
339+#endif
340+#ifdef ENOTSOCK
341+ case ENOTSOCK: return "socket operation on non-socket";
342+#endif
343+#ifdef ENOTSUP
344+ case ENOTSUP: return "operation not supported";
345+#endif
346+#ifdef ENOTTY
347+ case ENOTTY: return "inappropriate device for ioctl";
348+#endif
349+#ifdef ENOTUNIQ
350+ case ENOTUNIQ: return "name not unique on network";
351+#endif
352+#ifdef ENXIO
353+ case ENXIO: return "no such device or address";
354+#endif
355+#if defined(EOPNOTSUPP) && (!defined(ENOTSUP) || (ENOTSUP != EOPNOTSUPP))
356+ case EOPNOTSUPP: return "operation not supported on socket";
357+#endif
358+#ifdef EPERM
359+ case EPERM: return "not owner";
360+#endif
361+#if defined(EPFNOSUPPORT) && (!defined(ENOLCK) || (ENOLCK != EPFNOSUPPORT))
362+ case EPFNOSUPPORT: return "protocol family not supported";
363+#endif
364+#ifdef EPIPE
365+ case EPIPE: return "broken pipe";
366+#endif
367+#ifdef EPROCLIM
368+ case EPROCLIM: return "too many processes";
369+#endif
370+#ifdef EPROCUNAVAIL
371+ case EPROCUNAVAIL: return "bad procedure for program";
372+#endif
373+#ifdef EPROGMISMATCH
374+ case EPROGMISMATCH: return "program version wrong";
375+#endif
376+#ifdef EPROGUNAVAIL
377+ case EPROGUNAVAIL: return "RPC program not available";
378+#endif
379+#ifdef EPROTO
380+ case EPROTO: return "protocol error";
381+#endif
382+#ifdef EPROTONOSUPPORT
383+ case EPROTONOSUPPORT: return "protocol not suppored";
384+#endif
385+#ifdef EPROTOTYPE
386+ case EPROTOTYPE: return "protocol wrong type for socket";
387+#endif
388+#ifdef ERANGE
389+ case ERANGE: return "math result unrepresentable";
390+#endif
391+#if defined(EREFUSED) && (!defined(ECONNREFUSED) || (EREFUSED != ECONNREFUSED))
392+ case EREFUSED: return "EREFUSED";
393+#endif
394+#ifdef EREMCHG
395+ case EREMCHG: return "remote address changed";
396+#endif
397+#ifdef EREMDEV
398+ case EREMDEV: return "remote device";
399+#endif
400+#ifdef EREMOTE
401+ case EREMOTE: return "pathname hit remote file system";
402+#endif
403+#ifdef EREMOTEIO
404+ case EREMOTEIO: return "remote i/o error";
405+#endif
406+#ifdef EREMOTERELEASE
407+ case EREMOTERELEASE: return "EREMOTERELEASE";
408+#endif
409+#ifdef EROFS
410+ case EROFS: return "read-only file system";
411+#endif
412+#ifdef ERPCMISMATCH
413+ case ERPCMISMATCH: return "RPC version is wrong";
414+#endif
415+#ifdef ERREMOTE
416+ case ERREMOTE: return "object is remote";
417+#endif
418+#ifdef ESHUTDOWN
419+ case ESHUTDOWN: return "can't send afer socket shutdown";
420+#endif
421+#ifdef ESOCKTNOSUPPORT
422+ case ESOCKTNOSUPPORT: return "socket type not supported";
423+#endif
424+#ifdef ESPIPE
425+ case ESPIPE: return "invalid seek";
426+#endif
427+#ifdef ESRCH
428+ case ESRCH: return "no such process";
429+#endif
430+#ifdef ESRMNT
431+ case ESRMNT: return "srmount error";
432+#endif
433+#ifdef ESTALE
434+ case ESTALE: return "stale remote file handle";
435+#endif
436+#ifdef ESUCCESS
437+ case ESUCCESS: return "Error 0";
438+#endif
439+#if defined(ETIME) && (!defined(ELOOP) || (ETIME != ELOOP))
440+ case ETIME: return "timer expired";
441+#endif
442+#if defined(ETIMEDOUT) && (!defined(ENOSTR) || (ETIMEDOUT != ENOSTR))
443+ case ETIMEDOUT: return "connection timed out";
444+#endif
445+#ifdef ETOOMANYREFS
446+ case ETOOMANYREFS: return "too many references: can't splice";
447+#endif
448+#ifdef ETXTBSY
449+ case ETXTBSY: return "text file or pseudo-device busy";
450+#endif
451+#ifdef EUCLEAN
452+ case EUCLEAN: return "structure needs cleaning";
453+#endif
454+#ifdef EUNATCH
455+ case EUNATCH: return "protocol driver not attached";
456+#endif
457+#ifdef EUSERS
458+ case EUSERS: return "too many users";
459+#endif
460+#ifdef EVERSION
461+ case EVERSION: return "version mismatch";
462+#endif
463+#if defined(EWOULDBLOCK) && (!defined(EAGAIN) || (EWOULDBLOCK != EAGAIN))
464+ case EWOULDBLOCK: return "operation would block";
465+#endif
466+#ifdef EXDEV
467+ case EXDEV: return "cross-domain link";
468+#endif
469+#ifdef EXFULL
470+ case EXFULL: return "message tables full";
471+#endif
472+ default:
473+#ifdef NO_STRERROR
474+ return "unknown POSIX error";
475+#else
476+ return strerror(errno);
477+#endif
478+ }
479+}
480+
481+/*
482+ * end of excerpt from tcl8.0.X/generic/tclPosixStr.c
483+ */
484+
485+/*
486 * stolen from exp_log.c - this function is called from the Expect library
487 * but the one that the library supplies calls Tcl functions. So we supply
488 * our own.
489diff -up expect5.45/expect.h.orig expect5.45/expect.h
490--- expect5.45/expect.h.orig 2010-09-01 00:20:27.000000000 +0200
491+++ expect5.45/expect.h 2015-05-19 12:00:58.674248152 +0200
492@@ -258,6 +258,46 @@ typedef long LONG;
493 typedef struct Tcl_RegExp_ *Tcl_RegExp;
494
495 /*
496+ * The following declarations either map ckalloc and ckfree to
497+ * malloc and free, or they map them to procedures with all sorts
498+ * of debugging hooks defined in tclCkalloc.c.
499+ */
500+
501+#ifdef TCL_MEM_DEBUG
502+
503+# define Tcl_Alloc(x) Tcl_DbCkalloc(x, __FILE__, __LINE__)
504+# define Tcl_Free(x) Tcl_DbCkfree(x, __FILE__, __LINE__)
505+# define Tcl_Realloc(x,y) Tcl_DbCkrealloc((x), (y),__FILE__, __LINE__)
506+# define ckalloc(x) Tcl_DbCkalloc(x, __FILE__, __LINE__)
507+# define ckfree(x) Tcl_DbCkfree(x, __FILE__, __LINE__)
508+# define ckrealloc(x,y) Tcl_DbCkrealloc((x), (y),__FILE__, __LINE__)
509+
510+#else
511+
512+/*
513+ * If USE_TCLALLOC is true, then we need to call Tcl_Alloc instead of
514+ * the native malloc/free. The only time USE_TCLALLOC should not be
515+ * true is when compiling the Tcl/Tk libraries on Unix systems. In this
516+ * case we can safely call the native malloc/free directly as a performance
517+ * optimization.
518+ */
519+
520+# if USE_TCLALLOC
521+# define ckalloc(x) Tcl_Alloc(x)
522+# define ckfree(x) Tcl_Free(x)
523+# define ckrealloc(x,y) Tcl_Realloc(x,y)
524+# else
525+# define ckalloc(x) malloc(x)
526+# define ckfree(x) free(x)
527+# define ckrealloc(x,y) realloc(x,y)
528+# endif
529+# define Tcl_DumpActiveMemory(x)
530+# define Tcl_ValidateAllMemory(x,y)
531+
532+#endif /* !TCL_MEM_DEBUG */
533+
534+
535+/*
536 * These function have been renamed. The old names are deprecated, but we
537 * define these macros for backwards compatibilty.
538 */
539@@ -268,6 +308,14 @@ typedef struct Tcl_RegExp_ *Tcl_RegExp;
540 #define Tcl_Return Tcl_SetResult
541 #define Tcl_TildeSubst Tcl_TranslateFileName
542
543+/*
544+ * In later releases, Tcl_Panic will be the correct name to use. For now
545+ * we leave it as panic to avoid breaking existing binaries.
546+ */
547+
548+#define Tcl_Panic panic
549+#define Tcl_PanicVA panicVA
550+
551 #endif /* RESOURCE_INCLUDED */
552
553 #undef TCL_STORAGE_CLASS
This page took 0.118224 seconds and 4 git commands to generate.