[packages/expect] Rel 2; fix build - patches from FC

arekm arekm at pld-linux.org
Thu Feb 19 12:59:56 CET 2026


commit 1d18f1b30345fdfef9253f88e5036b0c55f43ea4
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Thu Feb 19 12:59:47 2026 +0100

    Rel 2; fix build - patches from FC

 expect-5.45.4-covscan-fixes.patch | 107 ++++++++++++++++++++
 expect-c99.patch                  |  24 +++++
 expect-configure-c99.patch        | 200 ++++++++++++++++++++++++++++++++++++++
 expect-pty.patch                  |  11 ++-
 expect.spec                       |  10 +-
 5 files changed, 345 insertions(+), 7 deletions(-)
---
diff --git a/expect.spec b/expect.spec
index 96505ca..40f339b 100644
--- a/expect.spec
+++ b/expect.spec
@@ -12,7 +12,7 @@ Summary(tr.UTF-8):	Programlar arası etkileşimi mümkün kılan Tcl genişletme
 Summary(uk.UTF-8):	Розширення Tcl для керування програмами зі скриптів
 Name:		expect
 Version:	5.45.4
-Release:	1
+Release:	2
 License:	BSD
 Group:		Development/Languages/Tcl
 Source0:	http://downloads.sourceforge.net/expect/%{name}%{version}.tar.gz
@@ -31,6 +31,9 @@ Patch10:	%{name}-5.32.2-random.patch
 Patch11:	%{name}-5.45-mkpasswd-dash.patch
 Patch12:	%{name}-5.45-check-telnet.patch
 Patch13:	%{name}-5.45-passmass-su-full-path.patch
+Patch14:	expect-c99.patch
+Patch15:	expect-configure-c99.patch
+Patch16:	expect-5.45.4-covscan-fixes.patch
 URL:		http://expect.nist.gov/
 BuildRequires:	autoconf
 BuildRequires:	automake
@@ -126,6 +129,9 @@ Pliki nagłówkowe i dokumentacja do rozszerzenia expect języka Tcl.
 %patch -P11 -p1
 %patch -P12 -p1
 %patch -P13 -p1
+%patch -P14 -p1
+%patch -P15 -p1
+%patch -P16 -p1
 
 chmod +w {.,testsuite}/configure
 
@@ -136,7 +142,7 @@ install /usr/share/automake/config.* .
 cd testsuite
 %{__autoconf} -I ..
 cd ..
-CFLAGS="%{rpmcflags} -I%{_includedir}/tcl-private/unix"
+CFLAGS="%{rpmcflags} -I%{_includedir}/tcl-private/unix -std=gnu17"
 %configure \
 %if "%{_lib}" == "lib64"
 	--enable-64bit \
diff --git a/expect-5.45.4-covscan-fixes.patch b/expect-5.45.4-covscan-fixes.patch
new file mode 100644
index 0000000..f5f8d0b
--- /dev/null
+++ b/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-09 14:14:44.851965292 +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-09 14:14:44.841965281 +0200
++++ expect5.45.4/exp_clib.c	2018-10-09 14:14:44.873965319 +0200
+@@ -37,6 +37,14 @@ would appreciate credit if this program
+ # endif
+ #endif
+ 
++#ifdef HAVE_UNISTD_H
++# include <unistd.h>
++#endif
++
++//#ifdef HAVE_SYS_WAIT_H
++# include <sys/wait.h>
++//#endif
++
+ #ifdef HAVE_SYS_FCNTL_H
+ #  include <sys/fcntl.h>
+ #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-09 14:14:44.838965277 +0200
++++ expect5.45.4/exp_log.c	2018-10-09 14:14:44.852965294 +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-10-09 14:14:44.848965289 +0200
++++ expect5.45.4/exp_main_sub.c	2018-10-09 14:14:44.852965294 +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-10-09 14:17:00.132127498 +0200
++++ expect5.45.4/pty_termios.c	2018-10-09 14:33:59.393315570 +0200
+@@ -105,6 +105,7 @@ with openpty which supports 4000 while p
+ 
+ void expDiagLog();
+ void expDiagLogPtr();
++char *expErrnoMsg(int errorNo);
+ 
+ #include <errno.h>
+ /*extern char *sys_errlist[];*/
+@@ -189,6 +190,7 @@ static char slave_name[MAXPTYNAMELEN];
+ #endif /* HAVE_SCO_CLIST_PTYS */
+ 
+ #ifdef HAVE_OPENPTY
++#include <pty.h>
+ static char master_name[64];
+ static char slave_name[64];
+ #endif
diff --git a/expect-c99.patch b/expect-c99.patch
new file mode 100644
index 0000000..94dc2ed
--- /dev/null
+++ b/expect-c99.patch
@@ -0,0 +1,24 @@
+Adjustments for compatibility with the currrent (Tcl 8.4.0+) channel
+implementation.
+
+diff --git a/exp_chan.c b/exp_chan.c
+index c92e26b6fbd02305..944200a63b102672 100644
+--- a/exp_chan.c
++++ b/exp_chan.c
+@@ -60,7 +60,7 @@ void			exp_background_channelhandler _ANSI_ARGS_((ClientData,
+ 
+ Tcl_ChannelType expChannelType = {
+     "exp",				/* Type name. */
+-    ExpBlockModeProc,			/* Set blocking/nonblocking mode.*/
++    TCL_CHANNEL_VERSION_2,
+     ExpCloseProc,			/* Close proc. */
+     ExpInputProc,			/* Input proc. */
+     ExpOutputProc,			/* Output proc. */
+@@ -70,6 +70,7 @@ Tcl_ChannelType expChannelType = {
+     ExpWatchProc,			/* Initialize notifier. */
+     ExpGetHandleProc,			/* Get OS handles out of channel. */
+     NULL,				/* Close2 proc */
++    ExpBlockModeProc,			/* Set blocking/nonblocking mode.*/
+ };
+ 
+ typedef struct ThreadSpecificData {
diff --git a/expect-configure-c99.patch b/expect-configure-c99.patch
new file mode 100644
index 0000000..7e5f345
--- /dev/null
+++ b/expect-configure-c99.patch
@@ -0,0 +1,200 @@
+Avoid calling exit without declaring the function.
+
+Add missing <string.h> include for memcpy.
+
+Use AC_TYPE_SIGNAL to fix REARM_SIG check.  Add missing includes.
+
+Fix various implicit int return types of main.
+
+Submitted upstream here: <https://sourceforge.net/p/expect/patches/24/#6759>
+
+diff --git a/configure.in b/configure.in
+index 51558fa14d2bcf7e..055c88fbd8797eaa 100755
+--- a/configure.in
++++ b/configure.in
+@@ -452,7 +452,11 @@ AC_CHECK_FUNC(siglongjmp, AC_DEFINE(HAVE_SIGLONGJMP))
+ # because Unixware 2.0 handles it specially and refuses to compile
+ # autoconf's automatic test that is a call with no arguments
+ AC_MSG_CHECKING([for memcpy])
+-AC_TRY_LINK(,[
++AC_TRY_LINK([
++#ifdef HAVE_STRING_H
++#include <string.h>
++#endif
++],[
+ char *s1, *s2;
+ memcpy(s1,s2,0);
+ ],
+@@ -469,6 +473,7 @@ memcpy(s1,s2,0);
+ AC_MSG_CHECKING([if WNOHANG requires _POSIX_SOURCE])
+ AC_TRY_RUN([
+ #include <sys/wait.h>
++int
+ main() {
+ #ifndef WNOHANG
+ 	return 0;
+@@ -489,6 +494,7 @@ rm -rf wnohang
+ AC_TRY_RUN([
+ #include <stdio.h>
+ #include <sys/wait.h>
++int
+ main() {
+ #ifdef WNOHANG
+ 	FILE *fp = fopen("wnohang","w");
+@@ -527,16 +533,21 @@ else
+   AC_DEFINE(SELECT_MASK_TYPE, fd_set)
+ fi
+ 
+-dnl # Check for the data type of the function used in signal(). This
+-dnl # must be before the test for rearming.
+-dnl # echo checking return type of signal handlers
+-dnl AC_HEADER_EGREP([(void|sighandler_t).*signal], signal.h, retsigtype=void,AC_DEFINE(RETSIGTYPE, int) retsigtype=int)
++AC_TYPE_SIGNAL
+ 
+ # FIXME: check if alarm exists
+ AC_MSG_CHECKING([if signals need to be re-armed])
+ AC_TRY_RUN([
+ #include <signal.h>
+-#define RETSIGTYPE $retsigtype
++#ifdef HAVE_STDLIB_H
++# include <stdlib.h>
++#endif
++#ifdef HAVE_UNISTD_H
++# include <unistd.h>
++#endif
++#ifndef NO_SYS_WAIT_H
++# include <sys/wait.h>
++#endif
+ 
+ int signal_rearms = 0;
+ 
+@@ -553,6 +564,7 @@ int n;
+ signal_rearms++;
+ }
+ 
++int
+ main()
+ {
+ 	signal(SIGINT,parent_sigint_handler);
+@@ -714,10 +726,11 @@ fi
+ AC_MSG_CHECKING([for struct sgttyb])
+ AC_TRY_RUN([
+ #include <sgtty.h>
++int
+ main()
+ {
+   struct sgttyb tmp;
+-  exit(0);
++  return 0;
+ }],
+         AC_MSG_RESULT(yes)
+         AC_DEFINE(HAVE_SGTTYB)
+@@ -738,10 +751,11 @@ if test $mach -eq 0 ; then
+   # pty_termios.c is set up to handle pty_termio.
+   AC_MSG_CHECKING([for struct termio])
+   AC_TRY_RUN([#include <termio.h>
++  int
+   main()
+   {
+     struct termio tmp;
+-    exit(0);
++    return 0;
+   }],
+         AC_DEFINE(HAVE_TERMIO)
+         PTY_TYPE=termios
+@@ -760,10 +774,11 @@ if test $mach -eq 0 ; then
+ #  include <inttypes.h>
+ #  endif
+ #  include <termios.h>
++  int
+   main()
+   {
+     struct termios tmp;
+-    exit(0);
++    return 0;
+   }],
+         AC_DEFINE(HAVE_TERMIOS)
+         PTY_TYPE=termios
+@@ -782,6 +797,7 @@ AC_TRY_RUN([
+ #include <inttypes.h>
+ #endif
+ #include <termios.h>
++int
+ main() {
+ #if defined(TCGETS) || defined(TCGETA)
+ 	return 0;
+@@ -804,6 +820,7 @@ AC_TRY_RUN([
+ #include <inttypes.h>
+ #endif
+ #include <termios.h>
++int
+ main() {
+ #ifdef TIOCGWINSZ
+ 	return 0;
+@@ -823,6 +840,7 @@ main() {
+ AC_MSG_CHECKING([for Cray-style ptys])
+ SETUID=":"
+ AC_TRY_RUN([
++int
+ main(){
+ #ifdef CRAY
+ 	return 0;
+@@ -878,12 +896,13 @@ AC_MSG_CHECKING([for SV-style timezone])
+ AC_TRY_RUN([
+ extern char *tzname[2];
+ extern int daylight;
++int
+ main()
+ {
+   int *x = &daylight;
+   char **y = tzname;
+ 
+-  exit(0);
++  return 0;
+ }],
+ 	AC_DEFINE(HAVE_SV_TIMEZONE)
+ 	AC_MSG_RESULT(yes),
+diff --git a/tclconfig/tcl.m4 b/tclconfig/tcl.m4
+index 0689cab3da994068..ebe839e5553ba520 100644
+--- a/tclconfig/tcl.m4
++++ b/tclconfig/tcl.m4
+@@ -2400,7 +2400,7 @@ AC_DEFUN([TEA_TIME_HANDLER], [
+ 	AC_TRY_COMPILE([#include <time.h>],
+ 	    [extern long timezone;
+ 	    timezone += 1;
+-	    exit (0);],
++	    return 0;],
+ 	    tcl_cv_timezone_long=yes, tcl_cv_timezone_long=no)])
+     if test $tcl_cv_timezone_long = yes ; then
+ 	AC_DEFINE(HAVE_TIMEZONE_VAR, 1, [Should we use the global timezone variable?])
+@@ -2412,7 +2412,7 @@ AC_DEFUN([TEA_TIME_HANDLER], [
+ 	    AC_TRY_COMPILE([#include <time.h>],
+ 		[extern time_t timezone;
+ 		timezone += 1;
+-		exit (0);],
++		return 0;],
+ 		tcl_cv_timezone_time=yes, tcl_cv_timezone_time=no)])
+ 	if test $tcl_cv_timezone_time = yes ; then
+ 	    AC_DEFINE(HAVE_TIMEZONE_VAR, 1, [Should we use the global timezone variable?])
+@@ -2452,17 +2452,17 @@ AC_DEFUN([TEA_BUGGY_STRTOD], [
+ 		    double value;
+ 		    value = strtod(infString, &term);
+ 		    if ((term != infString) && (term[-1] == 0)) {
+-			exit(1);
++			return 1;
+ 		    }
+ 		    value = strtod(nanString, &term);
+ 		    if ((term != nanString) && (term[-1] == 0)) {
+-			exit(1);
++			return 1;
+ 		    }
+ 		    value = strtod(spaceString, &term);
+ 		    if (term == (spaceString+1)) {
+-			exit(1);
++			return 1;
+ 		    }
+-		    exit(0);
++		    return 0;
+ 		}], tcl_cv_strtod_buggy=ok, tcl_cv_strtod_buggy=buggy,
+ 		    tcl_cv_strtod_buggy=buggy)])
+ 	if test "$tcl_cv_strtod_buggy" = buggy; then
diff --git a/expect-pty.patch b/expect-pty.patch
index 655f3a1..e5ceebc 100644
--- a/expect-pty.patch
+++ b/expect-pty.patch
@@ -1,6 +1,7 @@
---- expect-5.26/pty_termios.c	Mon Mar 16 19:53:41 1998
-+++ expect-5.26.orig/pty_termios.c	Thu Oct  8 09:51:36 1998
-@@ -131,7 +131,11 @@
+diff -urNp -x '*.orig' expect5.45.4.org/pty_termios.c expect5.45.4/pty_termios.c
+--- expect5.45.4.org/pty_termios.c	2018-02-02 20:15:52.000000000 +0100
++++ expect5.45.4/pty_termios.c	2026-02-19 12:56:33.141279095 +0100
+@@ -151,7 +151,11 @@ static char slave_name[] = "/dev/ttyqXXX
  #endif
  
  #if defined(HAVE__GETPTY) || defined(HAVE_PTC_PTS) || defined(HAVE_PTMX)
@@ -12,7 +13,7 @@
  #endif
  
  #if defined(HAVE_GETPTY)
-@@ -369,7 +373,7 @@
+@@ -389,7 +393,7 @@ exp_getptymaster()
  #else
  	if ((master = open("/dev/ptmx", O_RDWR)) == -1) return(-1);
  #endif
@@ -20,4 +21,4 @@
 +	if (slave_name ==  NULL) {
  		close(master);
  		return(-1);
- 	} else if (grantpt(master)) {
+ 	}
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/expect.git/commitdiff/1d18f1b30345fdfef9253f88e5036b0c55f43ea4



More information about the pld-cvs-commit mailing list