diff --git a/.expect.metadata b/.expect.metadata new file mode 100644 index 0000000..cf917f6 --- /dev/null +++ b/.expect.metadata @@ -0,0 +1 @@ +a97b2f377c6a799928d6728c2ada55beb7f57d96 SOURCES/expect5.45.4.tar.gz diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..cf7dcd7 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/expect5.45.4.tar.gz diff --git a/SOURCES/expect-5.32.2-random.patch b/SOURCES/expect-5.32.2-random.patch new file mode 100644 index 0000000..0cac294 --- /dev/null +++ b/SOURCES/expect-5.32.2-random.patch @@ -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 diff --git a/SOURCES/expect-5.43.0-log_file.patch b/SOURCES/expect-5.43.0-log_file.patch new file mode 100644 index 0000000..521a7ab --- /dev/null +++ b/SOURCES/expect-5.43.0-log_file.patch @@ -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; diff --git a/SOURCES/expect-5.43.0-pkgpath.patch b/SOURCES/expect-5.43.0-pkgpath.patch new file mode 100644 index 0000000..0c32a1f --- /dev/null +++ b/SOURCES/expect-5.43.0-pkgpath.patch @@ -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 + diff --git a/SOURCES/expect-5.45-check-telnet.patch b/SOURCES/expect-5.45-check-telnet.patch new file mode 100644 index 0000000..0b67dc6 --- /dev/null +++ b/SOURCES/expect-5.45-check-telnet.patch @@ -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 { diff --git a/SOURCES/expect-5.45-exp-log-buf-overflow.patch b/SOURCES/expect-5.45-exp-log-buf-overflow.patch new file mode 100644 index 0000000..162db80 --- /dev/null +++ b/SOURCES/expect-5.45-exp-log-buf-overflow.patch @@ -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; diff --git a/SOURCES/expect-5.45-fd-leak.patch b/SOURCES/expect-5.45-fd-leak.patch new file mode 100644 index 0000000..459a1f6 --- /dev/null +++ b/SOURCES/expect-5.45-fd-leak.patch @@ -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);} + diff --git a/SOURCES/expect-5.45-format-security.patch b/SOURCES/expect-5.45-format-security.patch new file mode 100644 index 0000000..24bd353 --- /dev/null +++ b/SOURCES/expect-5.45-format-security.patch @@ -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); + } + } + diff --git a/SOURCES/expect-5.45-man-page.patch b/SOURCES/expect-5.45-man-page.patch new file mode 100644 index 0000000..661958f --- /dev/null +++ b/SOURCES/expect-5.45-man-page.patch @@ -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. diff --git a/SOURCES/expect-5.45-match-gt-numchars-segfault.patch b/SOURCES/expect-5.45-match-gt-numchars-segfault.patch new file mode 100644 index 0000000..1abd424 --- /dev/null +++ b/SOURCES/expect-5.45-match-gt-numchars-segfault.patch @@ -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) { diff --git a/SOURCES/expect-5.45-mkpasswd-dash.patch b/SOURCES/expect-5.45-mkpasswd-dash.patch new file mode 100644 index 0000000..fbdecde --- /dev/null +++ b/SOURCES/expect-5.45-mkpasswd-dash.patch @@ -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 + } + } diff --git a/SOURCES/expect-5.45-mkpasswd-man.patch b/SOURCES/expect-5.45-mkpasswd-man.patch new file mode 100644 index 0000000..901117d --- /dev/null +++ b/SOURCES/expect-5.45-mkpasswd-man.patch @@ -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 + diff --git a/SOURCES/expect-5.45-passmass-su-full-path.patch b/SOURCES/expect-5.45-passmass-su-full-path.patch new file mode 100644 index 0000000..6febf94 --- /dev/null +++ b/SOURCES/expect-5.45-passmass-su-full-path.patch @@ -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 "# " diff --git a/SOURCES/expect-5.45-re-memleak.patch b/SOURCES/expect-5.45-re-memleak.patch new file mode 100644 index 0000000..182f596 --- /dev/null +++ b/SOURCES/expect-5.45-re-memleak.patch @@ -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--; diff --git a/SOURCES/expect-5.45-segfault-with-stubs.patch b/SOURCES/expect-5.45-segfault-with-stubs.patch new file mode 100644 index 0000000..eb02fe3 --- /dev/null +++ b/SOURCES/expect-5.45-segfault-with-stubs.patch @@ -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 ++ + 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 /* for malloc */ + #endif + +-#include + #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 diff --git a/SOURCES/expect-5.45.4-covscan-fixes.patch b/SOURCES/expect-5.45.4-covscan-fixes.patch new file mode 100644 index 0000000..4ee299b --- /dev/null +++ b/SOURCES/expect-5.45.4-covscan-fixes.patch @@ -0,0 +1,107 @@ +diff -up expect5.45.4/exp_chan.c.orig expect5.45.4/exp_chan.c +--- expect5.45.4/exp_chan.c.orig 2018-02-02 20:15:52.000000000 +0100 ++++ expect5.45.4/exp_chan.c 2018-10-10 09:29:44.702617967 +0200 +@@ -51,6 +51,8 @@ static void ExpWatchProc _ANSI_ARGS_((C + int mask)); + static int ExpGetHandleProc _ANSI_ARGS_((ClientData instanceData, + int direction, ClientData *handlePtr)); ++void exp_background_channelhandler _ANSI_ARGS_((ClientData, ++ int)); + + /* + * This structure describes the channel type structure for Expect-based IO: +diff -up expect5.45.4/exp_clib.c.orig expect5.45.4/exp_clib.c +--- expect5.45.4/exp_clib.c.orig 2018-10-10 09:29:44.695617962 +0200 ++++ expect5.45.4/exp_clib.c 2018-10-10 09:29:44.723617980 +0200 +@@ -37,6 +37,14 @@ would appreciate credit if this program + # endif + #endif + ++#ifdef HAVE_UNISTD_H ++# include ++#endif ++ ++//#ifdef HAVE_SYS_WAIT_H ++# include ++//#endif ++ + #ifdef HAVE_SYS_FCNTL_H + # include + #else +@@ -2196,6 +2204,7 @@ int exp_getptyslave(); + #define sysreturn(x) return(errno = x, -1) + + void exp_init_pty(); ++void exp_init_tty(); + + /* + The following functions are linked from the Tcl library. They +@@ -2715,6 +2724,7 @@ exp_spawnl TCL_VARARGS_DEF(char *,arg1) + argv[i] = va_arg(args,char *); + if (!argv[i]) break; + } ++ va_end(args); + i = exp_spawnv(argv[0],argv+1); + free((char *)argv); + return(i); +@@ -3188,6 +3198,7 @@ exp_expectl TCL_VARARGS_DEF(int,arg1) + /* Ultrix 4.2 compiler refuses enumerations comparison!? */ + if ((int)type < 0 || (int)type >= (int)exp_bogus) { + fprintf(stderr,"bad type (set %d) in exp_expectl\n",i); ++ va_end(args); + sysreturn(EINVAL); + } + +@@ -3253,6 +3264,7 @@ exp_fexpectl TCL_VARARGS_DEF(FILE *,arg1 + /* Ultrix 4.2 compiler refuses enumerations comparison!? */ + if ((int)type < 0 || (int)type >= (int)exp_bogus) { + fprintf(stderr,"bad type (set %d) in exp_expectl\n",i); ++ va_end(args); + sysreturn(EINVAL); + } + +diff -up expect5.45.4/exp_log.c.orig expect5.45.4/exp_log.c +--- expect5.45.4/exp_log.c.orig 2018-10-10 09:29:44.691617960 +0200 ++++ expect5.45.4/exp_log.c 2018-10-10 09:29:44.703617967 +0200 +@@ -174,7 +174,10 @@ expStdoutLog TCL_VARARGS_DEF(int,arg1) + force_stdout = TCL_VARARGS_START(int,arg1,args); + fmt = va_arg(args,char *); + +- if ((!tsdPtr->logUser) && (!force_stdout) && (!tsdPtr->logAll)) return; ++ if ((!tsdPtr->logUser) && (!force_stdout) && (!tsdPtr->logAll)) { ++ va_end(args); ++ return; ++ } + + (void) vsnprintf(bigbuf,sizeof(bigbuf),fmt,args); + expDiagWriteBytes(bigbuf,-1); +diff -up expect5.45.4/exp_main_sub.c.orig expect5.45.4/exp_main_sub.c +--- expect5.45.4/exp_main_sub.c.orig 2018-02-04 11:43:58.000000000 +0100 ++++ expect5.45.4/exp_main_sub.c 2018-10-10 09:29:44.703617967 +0200 +@@ -57,6 +57,7 @@ int exp_cmdlinecmds = FALSE; + int exp_interactive = FALSE; + int exp_buffer_command_input = FALSE;/* read in entire cmdfile at once */ + int exp_fgets(); ++int exp_tty_cooked_echo(Tcl_Interp *interp, exp_tty *tty_old, int *was_raw, int *was_echo); + + Tcl_Interp *exp_interp; /* for use by signal handlers who can't figure out */ + /* the interpreter directly */ +diff -up expect5.45.4/pty_termios.c.orig expect5.45.4/pty_termios.c +--- expect5.45.4/pty_termios.c.orig 2018-02-02 20:15:52.000000000 +0100 ++++ expect5.45.4/pty_termios.c 2018-10-10 09:29:44.703617967 +0200 +@@ -105,6 +105,7 @@ with openpty which supports 4000 while p + + void expDiagLog(); + void expDiagLogPtr(); ++char *expErrnoMsg(int errorNo); + + #include + /*extern char *sys_errlist[];*/ +@@ -189,6 +190,7 @@ static char slave_name[MAXPTYNAMELEN]; + #endif /* HAVE_SCO_CLIST_PTYS */ + + #ifdef HAVE_OPENPTY ++#include + static char master_name[64]; + static char slave_name[64]; + #endif diff --git a/SOURCES/expect-5.45.4-unification-of-usage-and-man-page.patch b/SOURCES/expect-5.45.4-unification-of-usage-and-man-page.patch new file mode 100644 index 0000000..479b49e --- /dev/null +++ b/SOURCES/expect-5.45.4-unification-of-usage-and-man-page.patch @@ -0,0 +1,67 @@ +diff -up expect5.45.4/expect.man.orig expect5.45.4/expect.man +--- expect5.45.4/expect.man.orig 2018-08-29 10:43:24.112949065 +0200 ++++ expect5.45.4/expect.man 2018-08-29 10:45:47.652044587 +0200 +@@ -4,7 +4,7 @@ expect \- programmed dialogue with inter + .SH SYNOPSIS + .B expect + [ +-.B \-dDinN ++.B \-dDhinNv + ] + [ + .B \-c +@@ -180,6 +180,9 @@ problems when reading from a fifo or std + If the string "\-" is supplied as a filename, standard input is read instead. + (Use "./\-" to read from a file actually named "\-".) + .PP ++.B \-h ++causes Expect to print its usage message and exit. ++.PP + The + .B \-i + flag causes +diff -up expect5.45.4/exp_main_sub.c.orig expect5.45.4/exp_main_sub.c +--- expect5.45.4/exp_main_sub.c.orig 2018-02-04 11:43:58.000000000 +0100 ++++ expect5.45.4/exp_main_sub.c 2018-08-29 11:04:44.307916140 +0200 +@@ -72,7 +72,21 @@ usage(interp) + Tcl_Interp *interp; + { + char buffer [] = "exit 1"; +- expErrorLog("usage: expect [-div] [-c cmds] [[-f] cmdfile] [args]\r\n"); ++ expErrorLog("usage: expect [-dDhinNv] [-c cmds] [[-[f|b]] cmdfile] [args]\r\n" ++ " Flags are as follows:\r\n" ++ " -b prefaces a file from which to read commands from\r\n" ++ " (expect reads one line at a timei from the file)\r\n" ++ " -c prefaces a command to be executed before any in the script,\r\n" ++ " may be used multiple times\r\n" ++ " -d enables diagnostic output\r\n" ++ " -D enables interactive debugger\r\n" ++ " -f prefaces a file from which to read commands from\r\n" ++ " (expect reads the whole file at once)\r\n" ++ " -h prints this usage message and exits\r\n" ++ " -i interactively prompts for commands\r\n" ++ " -n expect doesn't read personal rc file\r\n" ++ " -N expect doesn't read system-wide rc file\r\n" ++ " -v prints version and exits\r\n"); + + /* SF #439042 -- Allow overide of "exit" by user / script + */ +@@ -700,7 +714,7 @@ char **argv; + * and generate a usage message. + */ + +- while ((c = getopt(argc, argv, "+b:c:dD:f:inN-v")) != EOF) { ++ while ((c = getopt(argc, argv, "+b:c:dD:f:inN-vh")) != EOF) { + switch(c) { + case '-': + /* getopt already handles -- internally, however */ +@@ -768,6 +782,9 @@ char **argv; + Tcl_Eval(interp, buffer); + } + break; ++ case 'h': ++ usage(interp); ++ break; + default: usage(interp); + } + } diff --git a/SPECS/expect.spec b/SPECS/expect.spec new file mode 100644 index 0000000..b4c4d23 --- /dev/null +++ b/SPECS/expect.spec @@ -0,0 +1,643 @@ +%{!?tcl_version: %global tcl_version %(echo 'puts $tcl_version' | tclsh)} +%{!?tcl_sitearch: %global tcl_sitearch %{_libdir}/tcl%{tcl_version}} +%global majorver 5.45.4 + +Summary: A program-script interaction and testing utility +Name: expect +Version: %{majorver} +Release: 5%{?dist} +License: Public Domain +URL: https://core.tcl.tk/expect/index +Source: http://downloads.sourceforge.net/%{name}/%{name}%{version}.tar.gz +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +Buildrequires: tcl-devel autoconf automake chrpath +# 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 +# Patch8: unificates usage message of expect binary and man page, adds -h flag +Patch8: expect-5.45.4-unification-of-usage-and-man-page.patch +# Patch9: fixes issues detected by static analysis +Patch9: expect-5.45.4-covscan-fixes.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 tcl application for automating and testing +interactive applications such as telnet, ftp, passwd, fsck, +rlogin, tip, etc. Expect makes it easy for a script to +control another program and interact with it. + +This package contains expect and some scripts that use it. + +%package devel +Summary: A program-script interaction and testing utility +Requires: expect = %{version}-%{release} + +%description devel +Expect is a tcl application for automating and testing +interactive applications such as telnet, ftp, passwd, fsck, +rlogin, tip, etc. Expect makes it easy for a script to +control another program and interact with it. + +This package contains development files for the expect library. + +%package -n expectk +Summary: A program-script interaction and testing utility +Requires: expect = %{version}-%{release} + +%description -n expectk +Expect is a tcl application for automating and testing +interactive applications such as telnet, ftp, passwd, fsck, +rlogin, tip, etc. Expect makes it easy for a script to +control another program and interact with it. + +This package originally contained expectk and some scripts +that used it. As expectk was removed from upstream tarball +in expect-5.45, now the package contains just these scripts. +Please use tclsh with package require Tk and Expect instead +of expectk. + +%prep +%setup -q -n expect%{version} +%patch0 -p1 -b .log_file +%patch1 -p1 -b .pkgpath +%patch2 -p1 -b .man-page +%patch3 -p1 -b .match-gt-numchars-segfault +%patch4 -p1 -b .re-memleak +%patch5 -p1 -b .exp-log-buf-overflow +%patch6 -p1 -b .segfault-with-stubs +%patch7 -p1 -b .fd-leak +%patch8 -p1 -b .unification-of-usage-and-man-page +%patch9 -p1 -b .covscan-fixes +# examples fixes +%patch100 -p1 -b .random +%patch101 -p1 -b .mkpasswd-dash +%patch102 -p1 -b .check-telnet +%patch103 -p1 -b .passmass-su-full-path +%patch104 -p1 -b .mkpasswd-man +%patch105 -p0 -b .format-security +# -pkgpath.patch touch configure.in +aclocal +autoconf +( cd testsuite + autoconf -I.. ) + +%build +%configure --with-tcl=%{_libdir} --with-tk=%{_libdir} --enable-shared \ + --with-tclinclude=%{_includedir}/tcl-private/generic +make %{?_smp_mflags} + +%check +make test + +%install +rm -rf "$RPM_BUILD_ROOT" +make install DESTDIR="$RPM_BUILD_ROOT" + +# 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} +rm -f "$RPM_BUILD_ROOT"%{_mandir}/man1/{cryptdir,decryptdir}.1* +rm -f "$RPM_BUILD_ROOT"%{_bindir}/autopasswd + +# remove rpath +chrpath --delete $RPM_BUILD_ROOT%{_libdir}/libexpect%{version}.so + +%clean +rm -rf "$RPM_BUILD_ROOT" + + +%files +%defattr(-,root,root,-) +%doc FAQ HISTORY NEWS README +%{_bindir}/expect +%{_bindir}/autoexpect +%{_bindir}/dislocate +%{_bindir}/ftp-rfc +%{_bindir}/kibitz +%{_bindir}/lpunlock +%{_bindir}/mkpasswd +%{_bindir}/passmass +%{_bindir}/rftp +%{_bindir}/rlogin-cwd +%{_bindir}/timed-read +%{_bindir}/timed-run +%{_bindir}/unbuffer +%{_bindir}/weather +%{_bindir}/xkibitz +%dir %{tcl_sitearch}/expect%{version} +%{tcl_sitearch}/expect%{version}/pkgIndex.tcl +%{_libdir}/libexpect%{version}.so +%{_libdir}/libexpect.so +%{_mandir}/man1/autoexpect.1.gz +%{_mandir}/man1/dislocate.1.gz +%{_mandir}/man1/expect.1.gz +%{_mandir}/man1/kibitz.1.gz +%{_mandir}/man1/mkpasswd.1.gz +%{_mandir}/man1/passmass.1.gz +%{_mandir}/man1/unbuffer.1.gz +%{_mandir}/man1/xkibitz.1.gz + +%files devel +%defattr(-,root,root,-) +%{_mandir}/man3/libexpect.3* +%{_includedir}/* + +%files -n expectk +%defattr(-,root,root,-) +%{_bindir}/multixterm +%{_bindir}/tknewsbiff +%{_bindir}/tkpasswd +%{_bindir}/xpstat +%{_mandir}/man1/multixterm.1* +%{_mandir}/man1/tknewsbiff.1* + +%changelog +* Thu Nov 29 2018 Vitezslav Crhonek - 5.45.4-5 +- Fix issues detected by static analysis + Resolves: #1602490 + +* Thu Oct 18 2018 Vitezslav Crhonek - 5.45.4-4 +- Unificate and improve both man page and usage message of expect + Resolves: #1612588 + +* Wed Jun 27 2018 Vitezslav Crhonek - 5.45.4-3 +- Fix wrong log file permissions + +* Wed Jun 20 2018 Vitezslav Crhonek - 5.45.4-2 +- Fix upstream URL + +* Tue Feb 06 2018 Vitezslav Crhonek - 5.45.4-1 +- New upstream release 5.45.4 + Resolves: #1541735 + +* Mon Oct 23 2017 Vitezslav Crhonek - 5.45.3-1 +- New upstream release 5.45.3 + Resolves: #1503372 +- Removed 'Group' tag from spec file + +* Wed Aug 02 2017 Fedora Release Engineering - 5.45-28 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild + +* Wed Jul 26 2017 Fedora Release Engineering - 5.45-27 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Mon Apr 24 2017 Nils Philippsen - 5.45-26 +- remove unnecessary tk-devel and libXft-devel build dependencies + +* Tue Mar 28 2017 Vitezslav Crhonek - 5.45-25 +- tknewsbiff man page should be only in expectk - removed its duplicate + from expect package + +* Fri Mar 24 2017 Stephen Gallagher - 5.45-24 +- Fix build failures with -Werror=format-security + +* Fri Feb 10 2017 Fedora Release Engineering - 5.45-23 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + +* Wed Feb 03 2016 Fedora Release Engineering - 5.45-22 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Tue Jan 05 2016 Vitezslav Crhonek - 5.45-21 +- Replace 'define' with 'global' + +* Wed Jun 17 2015 Fedora Release Engineering - 5.45-20 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Wed May 20 2015 Vitezslav Crhonek - 5.45-19 +- Use different and probably better approach of fixing segfaults if Tcl is + built with stubs and Expect is used directly from C program + +* Tue Sep 09 2014 Vitezslav Crhonek - 5.45-18 +- Fix leaked fd (patch by Matej Mužila) + Resolves: #1001220 + +* Sat Aug 16 2014 Fedora Release Engineering - 5.45-17 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild + +* Sat Jun 07 2014 Fedora Release Engineering - 5.45-16 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild + +* Wed May 21 2014 Jaroslav Škarvada - 5.45-15 +- Rebuilt for https://fedoraproject.org/wiki/Changes/f21tcl86 + +* Mon Apr 28 2014 Vitezslav Crhonek - 5.45-14 +- Fix segfaults if Tcl is built with stubs and Expect is used directly from C program + (patch taken from Debian project, written by Sergei Golovan) + +* Thu Dec 12 2013 Vitezslav Crhonek - 5.45-13 +- Use vsnprintf instead of vsprintf to avoid buffer overflow + (it happens e.g. when running systemtap testsuite) + +* Wed Oct 02 2013 Vitezslav Crhonek - 5.45-12 +- Fix memory leak when using -re option + +* Tue Aug 27 2013 Vitezslav Crhonek - 5.45-11 +- Fix inaccuracy in mkpasswd man page + Resolves: #963889 + +* Sat Aug 03 2013 Fedora Release Engineering - 5.45-10 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild + +* Thu Apr 04 2013 Vitezslav Crhonek - 5.45-9 +- Fix repeated words in man pages + +* Wed Feb 13 2013 Fedora Release Engineering - 5.45-8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Thu Jul 19 2012 Fedora Release Engineering - 5.45-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Mon Feb 06 2012 Vitezslav Crhonek - 5.45-6 +- Fix character matching to avoid segmentation fault +- Move libexpect link out of -devel subpackage + +* Fri Jan 13 2012 Fedora Release Engineering - 5.45-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + +* Tue Sep 06 2011 Vitezslav Crhonek - 5.45-4 +- Let user know when expample script needs telnet and it is missing + Resolves: #703702 +- Use full path to 'su' in passmass example, it's safer +- Fix expect man page minor formatting issue + +* Wed Mar 16 2011 Vitezslav Crhonek - 5.45-3 +- Fix mkpasswd fails randomly + Resolves: #674184 + +* Tue Feb 08 2011 Fedora Release Engineering - 5.45-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Tue Jan 18 2011 Vitezslav Crhonek - 5.45-1 +- Update to expect-5.45 + +* Wed Mar 10 2010 Vitezslav Crhonek - 5.44.1.15-1 +- Update to 5.44.1.15 from upstream CVS + Resolves: #528654, Resolves: #501820 +- Remove config.sub (no longer needed), remove unused patches (few are + upstream now, few are pointless with new version), comment patches +- Fix unbuffer to return exit code of ubuffered program + Resolves: #547686 +- Fix Tk initialization + Resolves: #456738 + +* Mon Aug 10 2009 Ville Skyttä - 5.43.0-19 +- Use bzipped upstream tarball. + +* Fri Jul 24 2009 Fedora Release Engineering - 5.43.0-18 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Tue Feb 24 2009 Fedora Release Engineering - 5.43.0-17 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + +* Wed Feb 11 2009 Vitezslav Crhonek - 5:43.0-16 +- Modify and rebuild for new Tcl + +* Thu Sep 25 2008 Vitezslav Crhonek - 5:43.0-15 +- Rediff all patches to work with patch --fuzz=0 + +* Mon Jun 9 2008 Vitezslav Crhonek - 5:43.0-14 +- Use latest config.sub file for package build + Resolves: #449560 + +* Mon Feb 11 2008 Vitezslav Crhonek - 5:43.0-13 +- Rebuild + +* Mon Jan 14 2008 Wart - 5.43.0-12 +- Update install locations to reflect updated auto_path in the tcl 8.5 package + +* Mon Jan 07 2008 Adam Tkac - 5.43.0-11 +- updated "tcl8.5" patch + +* Sat Jan 5 2008 Alex Lancaster - 5.43.0-10 +- Rebuild for new Tcl 8.5 + +* Thu Aug 23 2007 Vitezslav Crhonek - 5.43.0-9 +- rebuild + +* Sat Feb 10 2007 Jakub Jelinek - 5.43.0-8 +- Update to build this time with Tcl 8.4 + +* Thu Feb 8 2007 Miloslav Trmac - 5.43.0-7 +- s/%%{buildroot}/"$RPM_BUILD_ROOT"/g +- s,/usr/share/man,%%{_mandir},g +- Use the Fedora-specified Buildroot: +- Remove BuildRequires: libX11-devel +- Don't install pkgIndex.tcl as an executable file +- Drop the incorrect expect-5.32.2-fixcat.patch +- Remove comments from *.h.in because they confuse config.status; this makes + the workaround expect-5.43.0-cfg-setpgrp.patch unnecesary. + +* Sat Feb 3 2007 Miloslav Trmac - 5.43.0-6 +- Update to build with Tcl 8.5 +- Drop static libraries +- Ship more documentation +- Use %%check for (make test), remove the conditional + +* Wed Jul 12 2006 Jesse Keating - 5.43.0-5.1 +- rebuild + +* Mon May 15 2006 David Cantrell - 5.43.0-5 +- BuildRequires libX11-devel + +* Fri Feb 24 2006 David Cantrell - 5.43.0-4 +- Patch expLogChannelOpen() to create files with 0666 permissions (#182724) + +* Fri Feb 10 2006 Jesse Keating - 5.43.0-3.1 +- bump again for double-long bug on ppc(64) + +* Tue Feb 07 2006 David Cantrell - 5.43.0-3 +- Rebuilt + +* Fri Dec 09 2005 Jesse Keating +- rebuilt + +* Tue May 31 2005 Jens Petersen - 5.43.0-2 +- fix flushing of unbuffer script (Charles Sullivan, #143963) + with unbuffer-child-flush-143963.patch (Don Libes) +- make autoconf include parent dir in testsuite to avoid error + (Robert Scheck, 150369) +- separate the examples scripts patches from the rest + +* Mon Mar 7 2005 Jens Petersen +- replace expect-5.32.2-setpgrp.patch by expect-5.43.0-cfg-setpgrp.patch + to set SETPGRP_VOID correctly + +* Mon Mar 7 2005 Jens Petersen - 5.43.0-1 +- run test make target by default + - can be turned off with --without check + +* Sat Mar 05 2005 Robert Scheck +- update to 5.43.0 (150369) + - no longer need expect-5.39.0-64bit-82547.patch, + expect-5.38.0-autopasswd-9917.patch + and expect-5.42-mkpasswd-verbose-user-141454.patch +- run aclocal and configure with current autoconf (116777) + - buildrequire autoconf and automake instead of autoconf213 + +* Fri Dec 3 2004 Jens Petersen - 5.42.1-2 +- fix "mkpasswd -v" failure when user not specified with + expect-5.42-mkpasswd-verbose-user-141454.patch (J F Wheeler, 141454) + +* Thu Aug 5 2004 Jens Petersen - 5.42.1-1 +- update to 5.42.1 (Robert Scheck, 126536) + - no longer need expect-5.32.2-kibitz.patch + - update expect-5.38.0-autopasswd-9917.patch +- drop explicit tcl and tk requires + +* Mon Jun 21 2004 Alan Cox +- Autopasswd doesnt work and isnt ever going to work with pam around + since password setting depends on the modules in use (think "fingerprint" + or "smartcard"..). Remove it. + +* Tue Jun 15 2004 Elliot Lee +- rebuilt + +* Tue Mar 02 2004 Elliot Lee +- rebuilt + +* Fri Feb 13 2004 Elliot Lee +- rebuilt + +* Fri Nov 28 2003 Jens Petersen - 5.39.0-95 +- new package split out from tcltk +- build against installed tcl and tk +- filtered changelog for expect +- buildrequire autoconf213 (#110583) [mvd@mylinux.com.ua] + +* Mon Nov 17 2003 Thomas Woerner 8.3.5-94 +- fixed RPATH for expect and expectk: expect-5.39.0-libdir.patch + +* Wed Oct 15 2003 Jens Petersen - 8.3.5-93 +- update expect to 5.39.0 (fixes #58317) +- drop first hunk of 64bit patch and rename to expect-5.39.0-64bit-82547.patch +- expect-5.32.2-weather.patch and expect-5.32.2-expectk.patch no longer needed + +* Wed Sep 17 2003 Matt Wilson 8.3.5-92 +- rebuild again for #91211 + +* Wed Sep 17 2003 Matt Wilson 8.3.5-91 +- rebuild to fix gzipped file md5sums (#91211) + +* Fri Jul 04 2003 Jens Petersen - 8.3.5-90 +- make sure expect and itcl are linked against buildroot not installroot libs + +* Tue Jan 28 2003 Jens Petersen - 8.3.5-87 +- bring back expect alpha patch, renamed to 64bit patch (#82547) + +* Fri Jan 17 2003 Jens Petersen - 8.3.5-85 +- add some requires + +* Tue Jan 14 2003 Jens Petersen - 8.3.5-84 +- drop synthetic lib provides +- remove obsolete patches from srpm +- update buildrequires +- use buildroot instead of RPM_BUILD_ROOT +- install all man pages under mandir, instead of moving some from /usr/man +- introduce _genfilelist macro for clean single-sweep find filelist generation + for each package +- use perl to remove buildroot prefix from filelists + +* Tue Jan 7 2003 Jeff Johnson 8.3.5-80 +- rebuild to generate deps for4 DSO's w/o DT_SONAME correctly. + +* Sat Jan 4 2003 Jeff Johnson 8.3.5-79 +- set execute bits on library so that requires are generated. + +* Tue Dec 10 2002 Jens Petersen 8.3.5-78 +- make lib symlinks to .so not .so.0 + +* Mon Dec 9 2002 Jens Petersen 8.3.5-76 +- make it build on x86_64 (details below) +- add 100 to expect patches +- patch expect configure to get EXP_LIB_SPEC to use libdir +- don't explicitly update config.{guess,sub} since %%configure does it for us +- added "--without check" rpmbuild option to disable running tests in future +- generate filelists from datadir and not from mandir from now on + +* Tue Dec 3 2002 Jens Petersen +- build without all makecfg patches for now + - in particular use upstream versioned library name convention +- add backward compatible lib symlinks for now +- add unversioned symlinks for versioned bindir files +- use make's -C option rather than jumping in and out of source dirs + during install +- use INSTALL_ROOT destdir-like make variable instead of makeinstall + for all subpackages except tix and itcl + +* Mon Oct 21 2002 Jens Petersen +- move expectk and expect-devel files out of expect into separate packages + (#9832) +- drop the crud compat dir symlinks in libdir +- correct expect license +- don't explicitly provide 64bit libs on ia64 and sparc64 + +* Tue Aug 20 2002 Jens Petersen 8.3.3-74 +- fix compat symlink from /usr/lib/expect (#71606) + +* Wed Aug 14 2002 Jens Petersen 8.3.3-73 +- update to expect spawn patch from hjl@gnu.org (bug 43310) + +* Tue Aug 13 2002 Jens Petersen 8.3.3-72 +- update expect to 5.38.0 +- fixes #71113 (reported by yarnall@lvc.edu) + +* Mon Jan 07 2002 Florian La Roche +- quick hack to have a correct setpgrp() call in expect +- fix config.guess and config.sub to newer versions + +* Tue Aug 28 2001 Adrian Havill +- expect's fixline1 busted for expectk scripts (tkpasswd/tknewsbiff/tkterm) + +* Wed Aug 8 2001 Adrian Havill +- re-enable glibc string and math inlines; recent gcc is a-ok. +- optimize at -O2 instead of -O +- rename "soname" patches related to makefile/autoconf changes + +* Wed Jul 25 2001 Adrian Havill +- fixed 64 bit RPM provides for dependencies + +* Thu Jul 19 2001 Adrian Havill +- used %%makeinstall to brute force fix any remaining unflexible makefile dirs +- improved randomness of expect's mkpasswd script via /dev/random (bug 9507) +- revert --enable-threads, linux is (still) not ready (yet) (bug 49251) + +* Sun Jul 8 2001 Adrian Havill +- refresh all sources to latest stable (TODO: separate expect/expectk) +- massage out some build stuff to patches (TODO: libtoolize hacked constants) +- remove patches already rolled into the upstream +- removed RPATH (bugs 45569, 46085, 46086), added SONAMEs to ELFs +- changed shared object filenames to something less gross +- reenable threads which seem to work now +- fixed spawn/eof read problem with expect (bug 43310) +- made compile-friendly for IA64 + +* Fri Mar 23 2001 Bill Nottingham +- bzip2 sources + +* Mon Mar 19 2001 Bill Nottingham +- build with -D_GNU_SOURCE - fixes expect on ia64 + +* Mon Mar 19 2001 Preston Brown +- build fix from ahavill. + +* Wed Feb 21 2001 Tim Powers +- fixed weather expect script using wrong server (#28505) + +* Tue Feb 13 2001 Adrian Havill +- rebuild so make check passes + +* Fri Oct 20 2000 Than Ngo +- rebuild with -O0 on alpha (bug #19461) + +* Thu Aug 17 2000 Jeff Johnson +- summaries from specspo. + +* Thu Jul 27 2000 Jeff Johnson +- rebuild against "working" util-linux col. + +* Fri Jun 16 2000 Jeff Johnson +- don't mess with %%{_libdir}, it's gonna be a FHS pita. + +* Fri Jun 2 2000 Jeff Johnson +- FHS packaging changes. +- revert --enable-threads, linux is not ready (yet) (#11789). +- expect: update to 5.31.7+ (#11595). + +* Sat Mar 18 2000 Jeff Johnson +- update to (tcl,tk}-8.2.3, expect-5.31, and itcl-3.1.0, URL's as well. +- use perl to drill out pre-pended RPM_BUILD_ROOT. +- configure with --enable-threads (experimental). +- autopasswd needs to handle password starting with hyphen (#9917). +- handle 553 ftp status in rftp expect script (#7869). +- remove cryptdir/decryptdir, as Linux has not crypt command (#6668). +- correct hierarchy spelling (#7082). +- fix "expect -d ...", format string had int printed as string (#7775). + +* Tue Mar 7 2000 Jeff Johnson +- rebuild for sparc baud rates > 38400. + +* Mon Feb 7 2000 Bill Nottingham +- handle compressed manpages + +* Thu Feb 03 2000 Elliot Lee +- Make changes from bug number 7602 +- Apply patch from bug number 7537 +- Apply fix from bug number 7157 +- Add fixes from bug #7601 to the runtcl patch + +* Wed Feb 02 2000 Cristian Gafton +- fix descriptions +- man pages are compressed (whatapain) + +* Tue Nov 30 1999 Jakub Jelinek +- compile on systems where SIGPWR == SIGLOST. + +* Thu Apr 8 1999 Jeff Johnson +- use /usr/bin/write in kibitz (#1320). +- use cirrus.sprl.umich.edu in weather (#1926). + +* Tue Feb 16 1999 Jeff Johnson +- expect does unaligned access on alpha (#989) +- upgrade expect to 5.28. + +* Tue Jan 12 1999 Cristian Gafton +- call libtoolize to allow building on the arm +- build for glibc 2.1 +- strip binaries + +* Thu Sep 10 1998 Jeff Johnson +- update tcl/tk/tclX to 8.0.3, expect is updated also. + +* Mon Jun 29 1998 Jeff Johnson +- expect: mkpasswd needs delay before sending password (problem #576) + +* Thu May 07 1998 Prospector System +- translations modified for de, fr, tr + +* Sat May 02 1998 Cristian Gafton +- fixed expect binaries exec permissions + +* Wed Oct 22 1997 Otto Hammersmith +- fixed src urls + +* Mon Oct 06 1997 Erik Troan +- removed version numbers from descriptions + +* Mon Sep 22 1997 Erik Troan +- updated to tcl/tk 8.0 and related versions of packages + +* Tue Jun 17 1997 Erik Troan +- built against glibc +- fixed dangling tclx/tkx symlinks