Package init

This commit is contained in:
overweight 2019-09-30 10:38:44 -04:00
commit 9f6a5cc19d
16 changed files with 983 additions and 0 deletions

View File

@ -0,0 +1,19 @@
diff -up expect-5.44.1.15/example/mkpasswd.orig expect-5.44.1.15/example/mkpasswd
--- expect-5.44.1.15/example/mkpasswd.orig 2010-03-08 16:01:05.518378075 +0100
+++ expect-5.44.1.15/example/mkpasswd 2010-03-08 16:01:27.408388162 +0100
@@ -92,7 +92,14 @@ proc insert {pvar char} {
}
proc rand {m} {
- expr {int($m*rand())}
+ set device /dev/urandom ;# /dev/random can block
+ set fileId [open $device r]
+ binary scan [read $fileId 4] i1 number
+ set clipped [expr $number % $m]
+# puts "number is $number"
+# puts "clipped is $clipped"
+ close $fileId
+ return $clipped
}
# choose left or right starting hand

View File

@ -0,0 +1,12 @@
diff -up expect5.45.4/exp_log.c.orig expect5.45.4/exp_log.c
--- expect5.45.4/exp_log.c.orig 2018-02-02 20:15:52.000000000 +0100
+++ expect5.45.4/exp_log.c 2018-06-27 10:46:53.065655463 +0200
@@ -499,7 +499,7 @@ expLogChannelOpen(interp,filename,append
Tcl_DStringAppend(&tsdPtr->logFilename,filename,-1);
}
- tsdPtr->logChannel = Tcl_OpenFileChannel(interp,newfilename,mode,0777);
+ tsdPtr->logChannel = Tcl_OpenFileChannel(interp,newfilename,mode,0666);
if (!tsdPtr->logChannel) {
Tcl_DStringFree(&tsdPtr->logFilename);
return TCL_ERROR;

View File

@ -0,0 +1,46 @@
diff -up expect5.45/configure.in.orig expect5.45/configure.in
--- expect5.45/configure.in.orig 2011-01-18 16:58:14.860806442 +0100
+++ expect5.45/configure.in 2011-01-18 16:58:30.378753210 +0100
@@ -977,6 +977,7 @@ AC_SUBST(EXP_CC_SEARCH_FLAGS)
AC_SUBST(SETUID)
AC_SUBST(SETPGRP_VOID)
AC_SUBST(DEFAULT_STTY_ARGS)
+AC_SUBST(TCL_VERSION)
# Expect uses these from tclConfig.sh to make the main executable
AC_SUBST(TCL_DL_LIBS)
AC_SUBST(TCL_CC_SEARCH_FLAGS)
diff -up expect5.45/Makefile.in.orig expect5.45/Makefile.in
--- expect5.45/Makefile.in.orig 2011-01-18 16:58:37.787723824 +0100
+++ expect5.45/Makefile.in 2011-01-18 17:05:10.697636907 +0100
@@ -121,8 +121,8 @@ includedir = @includedir@
DESTDIR =
PKG_DIR = $(PACKAGE_NAME)$(PACKAGE_VERSION)
-pkgdatadir = $(datadir)/$(PKG_DIR)
-pkglibdir = $(libdir)/$(PKG_DIR)
+pkgdatadir = $(datadir)/tcl@TCL_VERSION@/$(PKG_DIR)
+pkglibdir = $(libdir)/tcl@TCL_VERSION@/$(PKG_DIR)
pkgincludedir = $(includedir)/$(PKG_DIR)
top_builddir = .
@@ -263,7 +263,7 @@ install-doc: doc
else true; fi ; \
done
-test: binaries libraries
+test: binaries libraries pkgIndex.tcl-test
$(TCLSH) `@CYGPATH@ $(srcdir)/tests/all.tcl` $(TESTFLAGS)
shell: binaries libraries
@@ -331,6 +331,11 @@ pkgIndex.tcl:
pkgIndex.tcl-hand:
(echo 'if {![package vsatisfies [package provide Tcl] @TCL_VERSION@]} {return}' ; \
echo 'package ifneeded Expect $(PACKAGE_VERSION) \
+ [list load [file join $$dir .. .. $(PKG_LIB_FILE)]]'\
+ ) > pkgIndex.tcl
+
+pkgIndex.tcl-test:
+ (echo 'package ifneeded Expect $(PACKAGE_VERSION) \
[list load [file join $$dir $(PKG_LIB_FILE)]]'\
) > pkgIndex.tcl

View File

@ -0,0 +1,29 @@
diff -up expect5.45/example/passmass.orig expect5.45/example/passmass
--- expect5.45/example/passmass.orig 2011-07-27 16:09:31.013843393 +0200
+++ expect5.45/example/passmass 2011-07-27 16:10:55.667843578 +0200
@@ -107,6 +107,10 @@ for {set i 0} {$i<$argc} {incr i} {
set login "ssh"
continue
} "-telnet" {
+ if {[file executable /usr/bin/telnet] == 0} {
+ send_user "It seems that telnet is not installed. Please install telnet in order to use the script with this option.\n"
+ exit 1
+ }
set login "telnet"
continue
} "-program" {
diff -up expect5.45/example/weather.orig expect5.45/example/weather
--- expect5.45/example/weather.orig 2011-07-27 15:49:57.878843862 +0200
+++ expect5.45/example/weather 2011-07-27 16:08:48.067843491 +0200
@@ -33,6 +33,11 @@ set timeout 60
set env(TERM) vt100 ;# actual value doesn't matter, just has to be set
+if {[file executable /usr/bin/telnet] == 0} {
+ send_user "It seems that telnet is not installed. Please install telnet in order to use this script.\n"
+ exit 1
+}
+
spawn telnet rainmaker.wunderground.com 3000
while {1} {
expect timeout {

View File

@ -0,0 +1,39 @@
diff -up expect5.45/exp_log.c.orig expect5.45/exp_log.c
--- expect5.45/exp_log.c.orig 2013-12-12 12:43:38.527854189 +0100
+++ expect5.45/exp_log.c 2013-12-12 12:49:26.866576387 +0100
@@ -176,7 +176,7 @@ expStdoutLog TCL_VARARGS_DEF(int,arg1)
if ((!tsdPtr->logUser) && (!force_stdout) && (!tsdPtr->logAll)) return;
- (void) vsprintf(bigbuf,fmt,args);
+ (void) vsnprintf(bigbuf,sizeof(bigbuf),fmt,args);
expDiagWriteBytes(bigbuf,-1);
if (tsdPtr->logAll || (LOGUSER && tsdPtr->logChannel)) Tcl_WriteChars(tsdPtr->logChannel,bigbuf,-1);
if (LOGUSER) fprintf(stdout,"%s",bigbuf);
@@ -222,7 +222,7 @@ expErrorLog TCL_VARARGS_DEF(char *,arg1)
va_list args;
fmt = TCL_VARARGS_START(char *,arg1,args);
- (void) vsprintf(bigbuf,fmt,args);
+ (void) vsnprintf(bigbuf,sizeof(bigbuf),fmt,args);
expDiagWriteChars(bigbuf,-1);
fprintf(stderr,"%s",bigbuf);
@@ -264,7 +264,7 @@ expDiagLog TCL_VARARGS_DEF(char *,arg1)
fmt = TCL_VARARGS_START(char *,arg1,args);
- (void) vsprintf(bigbuf,fmt,args);
+ (void) vsnprintf(bigbuf,sizeof(bigbuf),fmt,args);
expDiagWriteBytes(bigbuf,-1);
if (tsdPtr->diagToStderr) {
@@ -307,7 +307,7 @@ expPrintf TCL_VARARGS_DEF(char *,arg1)
int len, rc;
fmt = TCL_VARARGS_START(char *,arg1,args);
- len = vsprintf(bigbuf,arg1,args);
+ len = vsnprintf(bigbuf,sizeof(bigbuf),arg1,args);
retry:
rc = write(2,bigbuf,len);
if ((rc == -1) && (errno == EAGAIN)) goto retry;

12
expect-5.45-fd-leak.patch Normal file
View File

@ -0,0 +1,12 @@
diff -up expect5.45/exp_clib.c.orig expect5.45/exp_clib.c
--- expect5.45/exp_command.c.orig 2014-09-04 12:12:21.075837835 +0200
+++ expect5.45/exp_command.c 2014-09-04 12:13:39.098593465 +0200
@@ -1161,7 +1161,7 @@ Exp_SpawnObjCmd(
/* if stty finds dev(stderr) != dev(stdout) */
/* save error fd while we're setting up new one */
- errorfd = fcntl(2,F_DUPFD,3);
+ errorfd = fcntl(2,F_DUPFD_CLOEXEC,3);
/* and here is the macro to restore it */
#define restore_error_fd {close(2);fcntl(errorfd,F_DUPFD,2);}

View File

@ -0,0 +1,13 @@
--- exp_clib.c.orig 2017-03-24 10:34:37.269183513 -0400
+++ exp_clib.c 2017-03-24 10:34:41.171117943 -0400
@@ -1938,8 +1938,8 @@
char *str;
{
if (exp_is_debugging) {
- fprintf(stderr,str);
- if (exp_logfile) fprintf(exp_logfile,str);
+ fprintf(stderr, "%s", str);
+ if (exp_logfile) fprintf(exp_logfile, "%s", str);
}
}

View File

@ -0,0 +1,39 @@
diff --git a/example/autoexpect.man b/example/autoexpect.man
index 45f24a4..79fc059 100644
--- a/example/autoexpect.man
+++ b/example/autoexpect.man
@@ -136,7 +136,7 @@ using the date command while running autoexpect is a sure way to
produce a script that will require editing in order for it to work.
The \-p flag puts autoexpect into "prompt mode". In this mode,
-autoexpect will only look for the the last line of program output \-
+autoexpect will only look for the last line of program output \-
which is usually the prompt. This handles the date problem (see
above) and most others.
diff --git a/example/tknewsbiff.man b/example/tknewsbiff.man
index dc5d4ad..63aec9f 100644
--- a/example/tknewsbiff.man
+++ b/example/tknewsbiff.man
@@ -177,7 +177,7 @@ The "server" variable names an NNTP news-server.
The default is "news". The "server" variable is
only used if the "active_file" variable is not set.
-The "server_timeout" variable describes how how many seconds to wait
+The "server_timeout" variable describes how many seconds to wait
for a response from the server before giving up. -1 means wait
forever or until the server itself times out. The default is 60
seconds.
diff --git a/expect.man b/expect.man
index 1edff14..10352b6 100644
--- a/expect.man
+++ b/expect.man
@@ -623,7 +623,7 @@ patterns are specified as with Tcl's
command. (Such patterns are also similar to C-shell regular expressions
usually referred to as "glob" patterns). The
.B \-gl
-flag may may
+flag may
be used to protect patterns that might otherwise match
.B expect
flags from doing so.

View File

@ -0,0 +1,17 @@
diff -up expect5.45/expect.c.orig expect5.45/expect.c
--- expect5.45/expect.c.orig 2012-02-06 14:15:13.469490744 +0100
+++ expect5.45/expect.c 2012-02-06 14:16:23.596837896 +0100
@@ -2363,7 +2363,12 @@ expMatchProcess(
/* "!e" means no case matched - transfer by default */
if (!e || e->transfer) {
- int remainder = numchars-match;
+ int remainder;
+ if (match > numchars) {
+ match = numchars;
+ eo->matchlen = match;
+ }
+ remainder = numchars-match;
/* delete matched chars from input buffer */
esPtr->printed -= match;
if (numchars != 0) {

View File

@ -0,0 +1,13 @@
diff -up expect5.45/example/mkpasswd.orig expect5.45/example/mkpasswd
--- expect5.45/example/mkpasswd.orig 2011-03-16 13:23:23.125480017 +0100
+++ expect5.45/example/mkpasswd 2011-03-16 13:24:08.739353139 +0100
@@ -202,7 +202,8 @@ if {[info exists user]} {
expect {
"assword*:" {
# some systems say "Password (again):"
- send "$password\r"
+ send -- "$password\r"
+ # "--" because of passwords beginning with dash
exp_continue
}
}

View File

@ -0,0 +1,38 @@
diff -up expect5.45/example/mkpasswd.man.mkpasswd-man expect5.45/example/mkpasswd.man
--- expect5.45/example/mkpasswd.man.mkpasswd-man 2000-08-04 20:01:56.000000000 +0200
+++ expect5.45/example/mkpasswd.man 2013-08-13 16:36:26.860711972 +0200
@@ -40,8 +40,8 @@ The following example creates a 20 chara
The
.B \-d
-flag defines the minimum number of digits that must be in the password.
-The default is 2. The following example creates a password with at least
+flag defines the number of digits that must be in the password.
+The default is 2. The following example creates a password with
3 digits.
mkpasswd -d 3
@@ -53,12 +53,12 @@ The default is 2.
The
.B \-C
-flag defines the minimum number of uppercase alphabetic characters that must be in the password.
+flag defines the number of uppercase alphabetic characters that must be in the password.
The default is 2.
The
.B \-s
-flag defines the minimum number of special characters that must be in the password.
+flag defines the number of special characters that must be in the password.
The default is 1.
The
@@ -80,7 +80,7 @@ By default, it is suppressed.
.SH EXAMPLE
The following example creates a 15-character password
-that contains at least 3 digits and 5 uppercase characters.
+that contains 3 digits and 5 uppercase characters.
mkpasswd -l 15 -d 3 -C 5

View File

@ -0,0 +1,12 @@
diff -up expect5.45/example/passmass.orig expect5.45/example/passmass
--- expect5.45/example/passmass.orig 2011-09-06 13:04:41.439875491 +0200
+++ expect5.45/example/passmass 2011-09-06 13:04:54.663874571 +0200
@@ -178,7 +178,7 @@ for {set i 0} {$i<$argc} {incr i} {
}
if ($su) {
- send "su -\r"
+ send "/bin/su -\r"
expect -nocase "password:"
send "$password(old)\r"
expect "# "

View File

@ -0,0 +1,14 @@
diff -up expect5.45/expect.c.orig expect5.45/expect.c
--- expect5.45/expect.c.orig 2013-10-02 13:16:31.462430482 +0200
+++ expect5.45/expect.c 2013-10-02 13:17:18.420599495 +0200
@@ -185,9 +185,9 @@ free_ecase(
{
if (ec->i_list->duration == EXP_PERMANENT) {
if (ec->pat) { Tcl_DecrRefCount(ec->pat); }
- if (ec->gate) { Tcl_DecrRefCount(ec->gate); }
if (ec->body) { Tcl_DecrRefCount(ec->body); }
}
+ if (ec->gate) { Tcl_DecrRefCount(ec->gate); }
if (free_ilist) {
ec->i_list->ecount--;

View File

@ -0,0 +1,553 @@
diff -up expect5.45/exp_clib.c.orig expect5.45/exp_clib.c
--- expect5.45/exp_clib.c.orig 2010-09-01 00:20:27.000000000 +0200
+++ expect5.45/exp_clib.c 2015-05-19 12:01:22.413349423 +0200
@@ -84,6 +84,8 @@ would appreciate credit if this program
#ifndef _STDLIB
#define _STDLIB
+#include <tcl.h>
+
extern void abort _ANSI_ARGS_((void));
extern double atof _ANSI_ARGS_((CONST char *string));
extern int atoi _ANSI_ARGS_((CONST char *string));
@@ -114,7 +116,6 @@ extern unsigned long strtoul _ANSI_ARGS_
#include <stdlib.h> /* for malloc */
#endif
-#include <tcl.h>
#include "expect.h"
#define TclRegError exp_TclRegError
@@ -1465,6 +1466,467 @@ TclGetRegError()
*/
/*
+ * following stolen from tcl8.0.4/generic/tclPosixStr.c
+ */
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * Tcl_ErrnoMsg --
+ *
+ * Return a human-readable message corresponding to a given
+ * errno value.
+ *
+ * Results:
+ * The return value is the standard POSIX error message for
+ * errno. This procedure is used instead of strerror because
+ * strerror returns slightly different values on different
+ * machines (e.g. different capitalizations), which cause
+ * problems for things such as regression tests. This procedure
+ * provides messages for most standard errors, then it calls
+ * strerror for things it doesn't understand.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static
+char *
+Tcl_ErrnoMsg(err)
+ int err; /* Error number (such as in errno variable). */
+{
+ switch (err) {
+#ifdef E2BIG
+ case E2BIG: return "argument list too long";
+#endif
+#ifdef EACCES
+ case EACCES: return "permission denied";
+#endif
+#ifdef EADDRINUSE
+ case EADDRINUSE: return "address already in use";
+#endif
+#ifdef EADDRNOTAVAIL
+ case EADDRNOTAVAIL: return "can't assign requested address";
+#endif
+#ifdef EADV
+ case EADV: return "advertise error";
+#endif
+#ifdef EAFNOSUPPORT
+ case EAFNOSUPPORT: return "address family not supported by protocol family";
+#endif
+#ifdef EAGAIN
+ case EAGAIN: return "resource temporarily unavailable";
+#endif
+#ifdef EALIGN
+ case EALIGN: return "EALIGN";
+#endif
+#if defined(EALREADY) && (!defined(EBUSY) || (EALREADY != EBUSY ))
+ case EALREADY: return "operation already in progress";
+#endif
+#ifdef EBADE
+ case EBADE: return "bad exchange descriptor";
+#endif
+#ifdef EBADF
+ case EBADF: return "bad file number";
+#endif
+#ifdef EBADFD
+ case EBADFD: return "file descriptor in bad state";
+#endif
+#ifdef EBADMSG
+ case EBADMSG: return "not a data message";
+#endif
+#ifdef EBADR
+ case EBADR: return "bad request descriptor";
+#endif
+#ifdef EBADRPC
+ case EBADRPC: return "RPC structure is bad";
+#endif
+#ifdef EBADRQC
+ case EBADRQC: return "bad request code";
+#endif
+#ifdef EBADSLT
+ case EBADSLT: return "invalid slot";
+#endif
+#ifdef EBFONT
+ case EBFONT: return "bad font file format";
+#endif
+#ifdef EBUSY
+ case EBUSY: return "file busy";
+#endif
+#ifdef ECHILD
+ case ECHILD: return "no children";
+#endif
+#ifdef ECHRNG
+ case ECHRNG: return "channel number out of range";
+#endif
+#ifdef ECOMM
+ case ECOMM: return "communication error on send";
+#endif
+#ifdef ECONNABORTED
+ case ECONNABORTED: return "software caused connection abort";
+#endif
+#ifdef ECONNREFUSED
+ case ECONNREFUSED: return "connection refused";
+#endif
+#ifdef ECONNRESET
+ case ECONNRESET: return "connection reset by peer";
+#endif
+#if defined(EDEADLK) && (!defined(EWOULDBLOCK) || (EDEADLK != EWOULDBLOCK))
+ case EDEADLK: return "resource deadlock avoided";
+#endif
+#if defined(EDEADLOCK) && (!defined(EDEADLK) || (EDEADLOCK != EDEADLK))
+ case EDEADLOCK: return "resource deadlock avoided";
+#endif
+#ifdef EDESTADDRREQ
+ case EDESTADDRREQ: return "destination address required";
+#endif
+#ifdef EDIRTY
+ case EDIRTY: return "mounting a dirty fs w/o force";
+#endif
+#ifdef EDOM
+ case EDOM: return "math argument out of range";
+#endif
+#ifdef EDOTDOT
+ case EDOTDOT: return "cross mount point";
+#endif
+#ifdef EDQUOT
+ case EDQUOT: return "disk quota exceeded";
+#endif
+#ifdef EDUPPKG
+ case EDUPPKG: return "duplicate package name";
+#endif
+#ifdef EEXIST
+ case EEXIST: return "file already exists";
+#endif
+#ifdef EFAULT
+ case EFAULT: return "bad address in system call argument";
+#endif
+#ifdef EFBIG
+ case EFBIG: return "file too large";
+#endif
+#ifdef EHOSTDOWN
+ case EHOSTDOWN: return "host is down";
+#endif
+#ifdef EHOSTUNREACH
+ case EHOSTUNREACH: return "host is unreachable";
+#endif
+#if defined(EIDRM) && (!defined(EINPROGRESS) || (EIDRM != EINPROGRESS))
+ case EIDRM: return "identifier removed";
+#endif
+#ifdef EINIT
+ case EINIT: return "initialization error";
+#endif
+#ifdef EINPROGRESS
+ case EINPROGRESS: return "operation now in progress";
+#endif
+#ifdef EINTR
+ case EINTR: return "interrupted system call";
+#endif
+#ifdef EINVAL
+ case EINVAL: return "invalid argument";
+#endif
+#ifdef EIO
+ case EIO: return "I/O error";
+#endif
+#ifdef EISCONN
+ case EISCONN: return "socket is already connected";
+#endif
+#ifdef EISDIR
+ case EISDIR: return "illegal operation on a directory";
+#endif
+#ifdef EISNAME
+ case EISNAM: return "is a name file";
+#endif
+#ifdef ELBIN
+ case ELBIN: return "ELBIN";
+#endif
+#ifdef EL2HLT
+ case EL2HLT: return "level 2 halted";
+#endif
+#ifdef EL2NSYNC
+ case EL2NSYNC: return "level 2 not synchronized";
+#endif
+#ifdef EL3HLT
+ case EL3HLT: return "level 3 halted";
+#endif
+#ifdef EL3RST
+ case EL3RST: return "level 3 reset";
+#endif
+#ifdef ELIBACC
+ case ELIBACC: return "can not access a needed shared library";
+#endif
+#ifdef ELIBBAD
+ case ELIBBAD: return "accessing a corrupted shared library";
+#endif
+#ifdef ELIBEXEC
+ case ELIBEXEC: return "can not exec a shared library directly";
+#endif
+#ifdef ELIBMAX
+ case ELIBMAX: return
+ "attempting to link in more shared libraries than system limit";
+#endif
+#ifdef ELIBSCN
+ case ELIBSCN: return ".lib section in a.out corrupted";
+#endif
+#ifdef ELNRNG
+ case ELNRNG: return "link number out of range";
+#endif
+#if defined(ELOOP) && (!defined(ENOENT) || (ELOOP != ENOENT))
+ case ELOOP: return "too many levels of symbolic links";
+#endif
+#ifdef EMFILE
+ case EMFILE: return "too many open files";
+#endif
+#ifdef EMLINK
+ case EMLINK: return "too many links";
+#endif
+#ifdef EMSGSIZE
+ case EMSGSIZE: return "message too long";
+#endif
+#ifdef EMULTIHOP
+ case EMULTIHOP: return "multihop attempted";
+#endif
+#ifdef ENAMETOOLONG
+ case ENAMETOOLONG: return "file name too long";
+#endif
+#ifdef ENAVAIL
+ case ENAVAIL: return "not available";
+#endif
+#ifdef ENET
+ case ENET: return "ENET";
+#endif
+#ifdef ENETDOWN
+ case ENETDOWN: return "network is down";
+#endif
+#ifdef ENETRESET
+ case ENETRESET: return "network dropped connection on reset";
+#endif
+#ifdef ENETUNREACH
+ case ENETUNREACH: return "network is unreachable";
+#endif
+#ifdef ENFILE
+ case ENFILE: return "file table overflow";
+#endif
+#ifdef ENOANO
+ case ENOANO: return "anode table overflow";
+#endif
+#if defined(ENOBUFS) && (!defined(ENOSR) || (ENOBUFS != ENOSR))
+ case ENOBUFS: return "no buffer space available";
+#endif
+#ifdef ENOCSI
+ case ENOCSI: return "no CSI structure available";
+#endif
+#if defined(ENODATA) && (!defined(ECONNREFUSED) || (ENODATA != ECONNREFUSED))
+ case ENODATA: return "no data available";
+#endif
+#ifdef ENODEV
+ case ENODEV: return "no such device";
+#endif
+#ifdef ENOENT
+ case ENOENT: return "no such file or directory";
+#endif
+#ifdef ENOEXEC
+ case ENOEXEC: return "exec format error";
+#endif
+#ifdef ENOLCK
+ case ENOLCK: return "no locks available";
+#endif
+#ifdef ENOLINK
+ case ENOLINK: return "link has be severed";
+#endif
+#ifdef ENOMEM
+ case ENOMEM: return "not enough memory";
+#endif
+#ifdef ENOMSG
+ case ENOMSG: return "no message of desired type";
+#endif
+#ifdef ENONET
+ case ENONET: return "machine is not on the network";
+#endif
+#ifdef ENOPKG
+ case ENOPKG: return "package not installed";
+#endif
+#ifdef ENOPROTOOPT
+ case ENOPROTOOPT: return "bad proocol option";
+#endif
+#ifdef ENOSPC
+ case ENOSPC: return "no space left on device";
+#endif
+#if defined(ENOSR) && (!defined(ENAMETOOLONG) || (ENAMETOOLONG != ENOSR))
+ case ENOSR: return "out of stream resources";
+#endif
+#if defined(ENOSTR) && (!defined(ENOTTY) || (ENOTTY != ENOSTR))
+ case ENOSTR: return "not a stream device";
+#endif
+#ifdef ENOSYM
+ case ENOSYM: return "unresolved symbol name";
+#endif
+#ifdef ENOSYS
+ case ENOSYS: return "function not implemented";
+#endif
+#ifdef ENOTBLK
+ case ENOTBLK: return "block device required";
+#endif
+#ifdef ENOTCONN
+ case ENOTCONN: return "socket is not connected";
+#endif
+#ifdef ENOTDIR
+ case ENOTDIR: return "not a directory";
+#endif
+#if defined(ENOTEMPTY) && (!defined(EEXIST) || (ENOTEMPTY != EEXIST))
+ case ENOTEMPTY: return "directory not empty";
+#endif
+#ifdef ENOTNAM
+ case ENOTNAM: return "not a name file";
+#endif
+#ifdef ENOTSOCK
+ case ENOTSOCK: return "socket operation on non-socket";
+#endif
+#ifdef ENOTSUP
+ case ENOTSUP: return "operation not supported";
+#endif
+#ifdef ENOTTY
+ case ENOTTY: return "inappropriate device for ioctl";
+#endif
+#ifdef ENOTUNIQ
+ case ENOTUNIQ: return "name not unique on network";
+#endif
+#ifdef ENXIO
+ case ENXIO: return "no such device or address";
+#endif
+#if defined(EOPNOTSUPP) && (!defined(ENOTSUP) || (ENOTSUP != EOPNOTSUPP))
+ case EOPNOTSUPP: return "operation not supported on socket";
+#endif
+#ifdef EPERM
+ case EPERM: return "not owner";
+#endif
+#if defined(EPFNOSUPPORT) && (!defined(ENOLCK) || (ENOLCK != EPFNOSUPPORT))
+ case EPFNOSUPPORT: return "protocol family not supported";
+#endif
+#ifdef EPIPE
+ case EPIPE: return "broken pipe";
+#endif
+#ifdef EPROCLIM
+ case EPROCLIM: return "too many processes";
+#endif
+#ifdef EPROCUNAVAIL
+ case EPROCUNAVAIL: return "bad procedure for program";
+#endif
+#ifdef EPROGMISMATCH
+ case EPROGMISMATCH: return "program version wrong";
+#endif
+#ifdef EPROGUNAVAIL
+ case EPROGUNAVAIL: return "RPC program not available";
+#endif
+#ifdef EPROTO
+ case EPROTO: return "protocol error";
+#endif
+#ifdef EPROTONOSUPPORT
+ case EPROTONOSUPPORT: return "protocol not suppored";
+#endif
+#ifdef EPROTOTYPE
+ case EPROTOTYPE: return "protocol wrong type for socket";
+#endif
+#ifdef ERANGE
+ case ERANGE: return "math result unrepresentable";
+#endif
+#if defined(EREFUSED) && (!defined(ECONNREFUSED) || (EREFUSED != ECONNREFUSED))
+ case EREFUSED: return "EREFUSED";
+#endif
+#ifdef EREMCHG
+ case EREMCHG: return "remote address changed";
+#endif
+#ifdef EREMDEV
+ case EREMDEV: return "remote device";
+#endif
+#ifdef EREMOTE
+ case EREMOTE: return "pathname hit remote file system";
+#endif
+#ifdef EREMOTEIO
+ case EREMOTEIO: return "remote i/o error";
+#endif
+#ifdef EREMOTERELEASE
+ case EREMOTERELEASE: return "EREMOTERELEASE";
+#endif
+#ifdef EROFS
+ case EROFS: return "read-only file system";
+#endif
+#ifdef ERPCMISMATCH
+ case ERPCMISMATCH: return "RPC version is wrong";
+#endif
+#ifdef ERREMOTE
+ case ERREMOTE: return "object is remote";
+#endif
+#ifdef ESHUTDOWN
+ case ESHUTDOWN: return "can't send afer socket shutdown";
+#endif
+#ifdef ESOCKTNOSUPPORT
+ case ESOCKTNOSUPPORT: return "socket type not supported";
+#endif
+#ifdef ESPIPE
+ case ESPIPE: return "invalid seek";
+#endif
+#ifdef ESRCH
+ case ESRCH: return "no such process";
+#endif
+#ifdef ESRMNT
+ case ESRMNT: return "srmount error";
+#endif
+#ifdef ESTALE
+ case ESTALE: return "stale remote file handle";
+#endif
+#ifdef ESUCCESS
+ case ESUCCESS: return "Error 0";
+#endif
+#if defined(ETIME) && (!defined(ELOOP) || (ETIME != ELOOP))
+ case ETIME: return "timer expired";
+#endif
+#if defined(ETIMEDOUT) && (!defined(ENOSTR) || (ETIMEDOUT != ENOSTR))
+ case ETIMEDOUT: return "connection timed out";
+#endif
+#ifdef ETOOMANYREFS
+ case ETOOMANYREFS: return "too many references: can't splice";
+#endif
+#ifdef ETXTBSY
+ case ETXTBSY: return "text file or pseudo-device busy";
+#endif
+#ifdef EUCLEAN
+ case EUCLEAN: return "structure needs cleaning";
+#endif
+#ifdef EUNATCH
+ case EUNATCH: return "protocol driver not attached";
+#endif
+#ifdef EUSERS
+ case EUSERS: return "too many users";
+#endif
+#ifdef EVERSION
+ case EVERSION: return "version mismatch";
+#endif
+#if defined(EWOULDBLOCK) && (!defined(EAGAIN) || (EWOULDBLOCK != EAGAIN))
+ case EWOULDBLOCK: return "operation would block";
+#endif
+#ifdef EXDEV
+ case EXDEV: return "cross-domain link";
+#endif
+#ifdef EXFULL
+ case EXFULL: return "message tables full";
+#endif
+ default:
+#ifdef NO_STRERROR
+ return "unknown POSIX error";
+#else
+ return strerror(errno);
+#endif
+ }
+}
+
+/*
+ * end of excerpt from tcl8.0.X/generic/tclPosixStr.c
+ */
+
+/*
* stolen from exp_log.c - this function is called from the Expect library
* but the one that the library supplies calls Tcl functions. So we supply
* our own.
diff -up expect5.45/expect.h.orig expect5.45/expect.h
--- expect5.45/expect.h.orig 2010-09-01 00:20:27.000000000 +0200
+++ expect5.45/expect.h 2015-05-19 12:00:58.674248152 +0200
@@ -258,6 +258,46 @@ typedef long LONG;
typedef struct Tcl_RegExp_ *Tcl_RegExp;
/*
+ * The following declarations either map ckalloc and ckfree to
+ * malloc and free, or they map them to procedures with all sorts
+ * of debugging hooks defined in tclCkalloc.c.
+ */
+
+#ifdef TCL_MEM_DEBUG
+
+# define Tcl_Alloc(x) Tcl_DbCkalloc(x, __FILE__, __LINE__)
+# define Tcl_Free(x) Tcl_DbCkfree(x, __FILE__, __LINE__)
+# define Tcl_Realloc(x,y) Tcl_DbCkrealloc((x), (y),__FILE__, __LINE__)
+# define ckalloc(x) Tcl_DbCkalloc(x, __FILE__, __LINE__)
+# define ckfree(x) Tcl_DbCkfree(x, __FILE__, __LINE__)
+# define ckrealloc(x,y) Tcl_DbCkrealloc((x), (y),__FILE__, __LINE__)
+
+#else
+
+/*
+ * If USE_TCLALLOC is true, then we need to call Tcl_Alloc instead of
+ * the native malloc/free. The only time USE_TCLALLOC should not be
+ * true is when compiling the Tcl/Tk libraries on Unix systems. In this
+ * case we can safely call the native malloc/free directly as a performance
+ * optimization.
+ */
+
+# if USE_TCLALLOC
+# define ckalloc(x) Tcl_Alloc(x)
+# define ckfree(x) Tcl_Free(x)
+# define ckrealloc(x,y) Tcl_Realloc(x,y)
+# else
+# define ckalloc(x) malloc(x)
+# define ckfree(x) free(x)
+# define ckrealloc(x,y) realloc(x,y)
+# endif
+# define Tcl_DumpActiveMemory(x)
+# define Tcl_ValidateAllMemory(x,y)
+
+#endif /* !TCL_MEM_DEBUG */
+
+
+/*
* These function have been renamed. The old names are deprecated, but we
* define these macros for backwards compatibilty.
*/
@@ -268,6 +308,14 @@ typedef struct Tcl_RegExp_ *Tcl_RegExp;
#define Tcl_Return Tcl_SetResult
#define Tcl_TildeSubst Tcl_TranslateFileName
+/*
+ * In later releases, Tcl_Panic will be the correct name to use. For now
+ * we leave it as panic to avoid breaking existing binaries.
+ */
+
+#define Tcl_Panic panic
+#define Tcl_PanicVA panicVA
+
#endif /* RESOURCE_INCLUDED */
#undef TCL_STORAGE_CLASS

127
expect.spec Normal file
View File

@ -0,0 +1,127 @@
%{!?tcl_version: %global tcl_version %(echo 'puts $tcl_version' | tclsh)}
%{!?tcl_sitearch: %global tcl_sitearch %{_libdir}/tcl%{tcl_version}}
Name: expect
Epoch: 1
Version: 5.45.4
Release: 2
Summary: A tool for automating interactive applications
License: Public Domain
URL: https://core.tcl.tk/expect/index
Source0: http://downloads.sourceforge.net/%{name}/%{name}%{version}.tar.gz
Buildrequires: gcc tcl-devel autoconf automake chrpath
Provides: expectk
Obsoletes: expectk
# Patch0: fixes change log file permissions
Patch0: expect-5.43.0-log_file.patch
# Patch1: fixes install location, change pkgIndex
Patch1: expect-5.43.0-pkgpath.patch
# Patch2: fixes minor man page formatting issue
Patch2: expect-5.45-man-page.patch
# Patch3: fixes segmentation fault during matching characters
Patch3: expect-5.45-match-gt-numchars-segfault.patch
# Patch4: fixes memory leak when using -re, http://sourceforge.net/p/expect/patches/13/
Patch4: expect-5.45-re-memleak.patch
# Patch5: use vsnprintf instead of vsprintf to avoid buffer overflow
Patch5: expect-5.45-exp-log-buf-overflow.patch
# Patch6: fixes segfaults if Tcl is built with stubs and Expect is used directly
# from C program rhbz#1091060
Patch6: expect-5.45-segfault-with-stubs.patch
# Patch7: fixes leaked fd, patch by Matej Mužila, rhbz#1001220
Patch7: expect-5.45-fd-leak.patch
# examples patches
# Patch100: changes random function
Patch100: expect-5.32.2-random.patch
# Patch101: fixes bz674184 - mkpasswd fails randomly
Patch101: expect-5.45-mkpasswd-dash.patch
# Patch102: fixes bz703702 - let user know that telnet is needed for
# running some examples
Patch102: expect-5.45-check-telnet.patch
# Patch103: use full path to 'su', it's safer
Patch103: expect-5.45-passmass-su-full-path.patch
# Patch104: rhbz 963889, fixes inaccuracy in mkpasswd man page
Patch104: expect-5.45-mkpasswd-man.patch
# Patch105: Fix error with -Werror=format-security
Patch105: expect-5.45-format-security.patch
%description
Expect is a tool for automating interactive applications
such as telnet, ftp, passwd, fsck, rlogin, tip, etc.
Expect is also useful for testing these same applications.
This package contains expect utility.
%package devel
Summary: Header files for expect library
Requires: %{name} = %{epoch}:%{version}-%{release}
%description devel
Expect is a tool for automating interactive applications
such as telnet, ftp, passwd, fsck, rlogin, tip, etc.
Expect is also useful for testing these same applications.
This package contains header files for the expect library.
%package help
Summary: Man pages and other related documents for expect
BuildArch: noarch
%description help
Expect is a tool for automating interactive applications
such as telnet, ftp, passwd, fsck, rlogin, tip, etc.
Expect is also useful for testing these same applications.
This package contains man pages and other related documents for expect.
%prep
%autosetup -n %{name}%{version} -S git
%build
%configure \
--with-tcl=%{_libdir} \
--with-tk=%{_libdir} --enable-shared \
--with-tclinclude=%{_includedir}/tcl-private/generic
%make_build
%check
make test
%install
%make_install
# move
mv "$RPM_BUILD_ROOT"%{tcl_sitearch}/expect%{version}/libexpect%{version}.so "$RPM_BUILD_ROOT"%{_libdir}
# for linking with -lexpect
ln -s libexpect%{majorver}.so "$RPM_BUILD_ROOT"%{_libdir}/libexpect.so
# remove cryptdir/decryptdir, as Linux has no crypt command (bug 6668).
rm -f "$RPM_BUILD_ROOT"%{_bindir}/{cryptdir,decryptdir,autopasswd}
rm -f "$RPM_BUILD_ROOT"%{_mandir}/man1/{cryptdir,decryptdir}.1*
# remove rpath
chrpath --delete $RPM_BUILD_ROOT%{_libdir}/libexpect%{version}.so
%files
%doc ChangeLog FAQ HISTORY NEWS README
%{_bindir}/*
%dir %{tcl_sitearch}/expect%{version}
%{tcl_sitearch}/expect%{version}/pkgIndex.tcl
%{_libdir}/libexpect*.so
%files devel
%{_includedir}/*
%files help
%{_mandir}/man1/*
%{_mandir}/man3/libexpect.3*
%changelog
* Fri Sep 20 2019 openEuler Buildteam <buildteam@openeuler.org> - 1:5.45.4-2
- Delete redundant information
* Thu Aug 29 2019 openEuler Buildteam <buildteam@openeuler.org> - 1:5.45.4-1
- Package init

BIN
expect5.45.4.tar.gz Normal file

Binary file not shown.