Initial commit

This commit is contained in:
Your Name
2026-04-23 17:07:55 +08:00
commit b7e39e063b
16725 changed files with 1625565 additions and 0 deletions
@@ -0,0 +1,113 @@
From 904c7cf6647594939ce1e398468bca3c885f0622 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Mon, 15 Aug 2022 18:25:23 -0700
Subject: [PATCH] Add prototype to function definitions
Compilers like clang has started erroring out on implicit-function-declaration
therefore arrange the relevant include files where needed.
Upstream-Status: Submitted [https://sourceforge.net/p/expect/patches/24/]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
exp_chan.c | 5 +++--
exp_clib.c | 4 +++-
exp_main_sub.c | 5 +++++
pty_termios.c | 4 ++++
4 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/exp_chan.c b/exp_chan.c
index 79f486c..50375d3 100644
--- a/exp_chan.c
+++ b/exp_chan.c
@@ -35,6 +35,7 @@
#include "exp_prog.h"
#include "exp_command.h"
#include "exp_log.h"
+#include "exp_event.h" /* exp_background_channelhandler */
#include "tcldbg.h" /* Dbg_StdinMode */
extern int expSetBlockModeProc _ANSI_ARGS_((int fd, int mode));
@@ -631,7 +632,7 @@ expWaitOnOne() {
}
void
-exp_background_channelhandlers_run_all()
+exp_background_channelhandlers_run_all(void)
{
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
ExpState *esPtr;
@@ -760,7 +761,7 @@ expCreateChannel(interp,fdin,fdout,pid)
}
void
-expChannelInit() {
+expChannelInit(void) {
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
tsdPtr->channelCount = 0;
diff --git a/exp_clib.c b/exp_clib.c
index b21fb5d..8f31fc3 100644
--- a/exp_clib.c
+++ b/exp_clib.c
@@ -9,13 +9,14 @@ would appreciate credit if this program or parts of it are used.
#include "expect_cf.h"
#include <stdio.h>
+#include <unistd.h>
#include <setjmp.h>
#ifdef HAVE_INTTYPES_H
# include <inttypes.h>
#endif
#include <sys/types.h>
#include <sys/ioctl.h>
-
+#include <sys/wait.h>
#ifdef TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
@@ -1738,6 +1739,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
diff --git a/exp_main_sub.c b/exp_main_sub.c
index bf6c4be..f53b89e 100644
--- a/exp_main_sub.c
+++ b/exp_main_sub.c
@@ -61,6 +61,11 @@ 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 --git a/pty_termios.c b/pty_termios.c
index c605b23..80ed5e7 100644
--- a/pty_termios.c
+++ b/pty_termios.c
@@ -7,6 +7,7 @@ would appreciate credit if you use this file or parts of it.
*/
+#include <pty.h> /* openpty */
#include <stdio.h>
#include <signal.h>
@@ -15,6 +16,9 @@ would appreciate credit if you use this file or parts of it.
#endif
#include "expect_cf.h"
+#include "tclInt.h"
+
+extern char * expErrnoMsg _ANSI_ARGS_((int));
/*
The following functions are linked from the Tcl library. They
@@ -0,0 +1,29 @@
From 107cc370705d8520ba42f1416d89ed3544277c83 Mon Sep 17 00:00:00 2001
From: Alexander Kanavin <alex.kanavin@gmail.com>
Date: Thu, 23 Mar 2017 13:44:41 +0200
Subject: [PATCH] Resolve string formatting issues.
Upstream-Status: Inappropriate [upstream seems dead]
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
---
exp_clib.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/exp_clib.c b/exp_clib.c
index 172c05e..809200e 100644
--- a/exp_clib.c
+++ b/exp_clib.c
@@ -1476,8 +1476,8 @@ expDiagLogU(str)
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);
}
}
--
2.11.0
@@ -0,0 +1,108 @@
Allow cross compiling.
Signed-off-by: Anders Roxell <anders.roxell@enea.com>
Upstream-Status: Pending
---
diff -uNr a/configure.in b/configure.in
--- a/configure.in 2012-12-14 15:31:32.623180450 +0100
+++ b/configure.in 2012-12-14 15:53:34.518233519 +0100
@@ -481,7 +481,7 @@
,
AC_MSG_RESULT(no)
,
- AC_MSG_ERROR([Expect can't be cross compiled])
+ AC_MSG_RESULT(no)
)
AC_MSG_CHECKING([if any value exists for WNOHANG])
@@ -506,7 +506,9 @@
AC_MSG_RESULT(no)
AC_DEFINE(WNOHANG_BACKUP_VALUE, 1)
,
- AC_MSG_ERROR([Expect can't be cross compiled])
+ AC_MSG_RESULT(yes)
+ AC_DEFINE_UNQUOTED(WNOHANG_BACKUP_VALUE, `cat wnohang`)
+ rm -f wnohang
)
#
@@ -574,7 +576,8 @@
AC_DEFINE(REARM_SIG)
,
AC_MSG_RESULT(no)
-, AC_MSG_WARN([Expect can't be cross compiled])
+,
+ AC_MSG_RESULT(no)
)
# HPUX7 has trouble with the big cat so split it
@@ -725,7 +728,9 @@
,
AC_MSG_RESULT(no)
,
- AC_MSG_ERROR([Expect can't be cross compiled])
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_SGTTYB)
+ PTY_TYPE=sgttyb
)
# mach systems have include files for unimplemented features
@@ -749,7 +754,9 @@
,
AC_MSG_RESULT(no)
,
- AC_MSG_ERROR([Expect can't be cross compiled])
+ AC_DEFINE(HAVE_TERMIO)
+ PTY_TYPE=termios
+ AC_MSG_RESULT(yes)
)
# now check for the new style ttys (not yet posix)
@@ -771,7 +778,9 @@
,
AC_MSG_RESULT(no)
,
- AC_MSG_ERROR([Expect can't be cross compiled])
+ AC_DEFINE(HAVE_TERMIOS)
+ PTY_TYPE=termios
+ AC_MSG_RESULT(yes)
)
fi
@@ -794,7 +803,7 @@
,
AC_MSG_RESULT(no)
,
- AC_MSG_ERROR([Expect can't be cross compiled])
+ AC_MSG_RESULT(no)
)
AC_MSG_CHECKING([if TIOCGWINSZ in termios.h])
@@ -816,7 +825,7 @@
,
AC_MSG_RESULT(no)
,
- AC_MSG_ERROR([Expect can't be cross compiled])
+ AC_MSG_RESULT(no)
)
# finally check for Cray style ttys
@@ -837,7 +846,7 @@
,
AC_MSG_RESULT(no)
,
- AC_MSG_ERROR([Expect can't be cross compiled])
+ AC_MSG_RESULT(no)
)
#
@@ -889,7 +898,8 @@
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no)
,
- AC_MSG_ERROR([Expect can't be cross compiled])
+ AC_DEFINE(HAVE_SV_TIMEZONE)
+ AC_MSG_RESULT(yes),
)
@@ -0,0 +1,55 @@
From 1407fcad6f1dac0a4efe8041660bf6139c1cd16a Mon Sep 17 00:00:00 2001
From: Robert Yang <liezhi.yang@windriver.com>
Date: Tue, 24 Sep 2019 13:40:10 +0800
Subject: [PATCH] exp_main_sub.c: Use PATH_MAX for path
If expect was built from a long path whose length > 200, then it couldn't run:
$ expect -c 'puts yes'
*** buffer overflow detected ***: expect terminated
Aborted (core dumped)
Use PATH_MAX to fix the problem.
Upstream-Status: Pending [Upstream seems dead]
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
---
exp_main_sub.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/exp_main_sub.c b/exp_main_sub.c
index fcfaa6e..bf6c4be 100644
--- a/exp_main_sub.c
+++ b/exp_main_sub.c
@@ -48,6 +48,10 @@ char exp_version[] = PACKAGE_VERSION;
#define NEED_TCL_MAJOR 7
#define NEED_TCL_MINOR 5
+#ifndef PATH_MAX
+#define PATH_MAX 4096
+#endif
+
char *exp_argv0 = "this program"; /* default program name */
void (*exp_app_exit)() = 0;
void (*exp_event_exit)() = 0;
@@ -901,7 +905,7 @@ int sys_rc;
int rc;
if (sys_rc) {
- char file[200];
+ char file[PATH_MAX];
int fd;
sprintf(file,"%s/expect.rc",SCRIPTDIR);
@@ -917,7 +921,7 @@ int sys_rc;
}
}
if (my_rc) {
- char file[200];
+ char file[PATH_MAX];
char *home;
int fd;
char *getenv();
--
2.7.4
@@ -0,0 +1,91 @@
From f0049b4b2ea55b3b3c53bf6f0275654801c755d2 Mon Sep 17 00:00:00 2001
From: Li Zhou <li.zhou@windriver.com>
Date: Thu, 28 Sep 2017 15:54:55 +0800
Subject: [PATCH] expect: Fix segfaults if Tcl is built with stubs and Expect
is used directly from C program
Description: This dirty hack fixes segfaults if Tcl is built with stubs
and Expect is used directly from C program.
Bug: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=588817
Example:
#include <stdio.h>
#include <tcl8.5/expect.h>
int main()
{
FILE *pipe;
char *some_command = "uname";
char datum;
pipe = exp_popen(some_command);
if (pipe == NULL) return 1;
while ((datum = getc (pipe)) != EOF)
printf("%c",datum);
}
Example:
#include <stdio.h>
#include "expect.h"
main()
{
int fd = 0;
fd = exp_spawnl("echo", "echo", "Hello User: Whats up?", (char*) 0);
switch (exp_expectl(fd, exp_regexp, "ser:", 1, exp_end)) {
case 1: {
printf("GOT ser:\n");
break;
}
default: {
printf("DEFAULT\n");
return 1;
}
}
printf("Normal Exit\n");
return 0;
}
Author: Sergei Golovan <sgolovan@debian.org>
Upstream-Status: Pending
This patch is backported from fedora changes for expect:
http://pkgs.fedoraproject.org/cgit/rpms/expect.git/commit/
?h=master&id=b6737eed550be93182f2ed194e836a6cbbcf4fa3
Signed-off-by: Li Zhou <li.zhou@windriver.com>
---
exp_clib.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/exp_clib.c b/exp_clib.c
index 172c05e..19341d5 100644
--- a/exp_clib.c
+++ b/exp_clib.c
@@ -114,7 +114,11 @@ extern unsigned long strtoul _ANSI_ARGS_((CONST char *string,
#include <stdlib.h> /* for malloc */
#endif
-#include <tcl.h>
+#define ckalloc(x) Tcl_Alloc(x)
+#define ckfree(x) Tcl_Free(x)
+extern char *Tcl_ErrnoMsg(int err);
+extern char *Tcl_Alloc(unsigned int size);
+extern void Tcl_Free(char *ptr);
#include "expect.h"
#define TclRegError exp_TclRegError
@@ -389,7 +393,7 @@ char *exp;
FAIL("regexp too big");
/* Allocate space. */
- r = (regexp *)ckalloc(sizeof(regexp) + (unsigned)rcstate->regsize);
+ r = (regexp *)malloc(sizeof(regexp) + (unsigned)rcstate->regsize);
if (r == NULL)
FAIL("out of space");
@@ -399,7 +403,7 @@ char *exp;
rcstate->regcode = r->program;
regc(MAGIC, rcstate);
if (reg(0, &flags, rcstate) == NULL) {
- ckfree ((char*) r);
+ free((char*) r);
return(NULL);
}
--
1.9.1
@@ -0,0 +1,34 @@
Upstream-Status: Inappropriate [wrlinux specific]
Subject: expect: install scripts without using the fixline1 tcl script
On older machines like SLED11.2, we are encountering do_install failures
complaining that 'GLIBC_2.14' is not found in /lib64/libc.so.6 but is required
by libtcl8.6.so.0.
This is because that we're executing the fixline1 tcl script which requires
libtcl8.6.so.0 in sysroot. However, all commands in SCRIPTS already have got
the correct first line, that is '#!/bin/sh'. We don't need to modify anything.
That's why we could just copy them.
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
Makefile.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile.in b/Makefile.in
index c05c880..f1394ff 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -380,7 +380,7 @@ dist: dist-clean doc
cp $(DIST_ROOT)/$(PKG_DIR).tar.gz $(top_builddir)
$(SCRIPTS):
- $(TCLSH) $(srcdir)/fixline1 $(SHORT_BINDIR) < $(srcdir)/example/$@ > $@
+ cp $(srcdir)/example/$@ $@
## We cannot use TCL_LIBS below (after TCL_LIB_SPEC) because its
## expansion references the contents of LIBS, which contains linker
--
1.7.10.4
@@ -0,0 +1,31 @@
From eef7c44c10de32ba399ab162cb5799fafdce3fa5 Mon Sep 17 00:00:00 2001
From: Joe Slater <joe.slater@windriver.com>
Date: Tue, 15 Mar 2022 22:00:04 +0000
Subject: [PATCH] fixline1: fix line 1
Ironically, fixline1 needs its first line modified by
fixline1. We do that, manually.
Upstream-Status: Inappropriate [OE specific cross build setup]
Signed-off-by: Joe Slater <joe.slater@windriver.com>
---
fixline1 | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/fixline1 b/fixline1
index 113e9bb..8a38e96 100755
--- a/fixline1
+++ b/fixline1
@@ -1,4 +1,7 @@
-#!expect --
+#!/bin/sh
+# expect won't see the exec \
+exec expect -- "$0" ${1+"$@"}
+
# Synopsis: fixline1 newpath < input > output
# Author: Don Libes
--
2.32.0
@@ -0,0 +1,17 @@
Use proper -L path when cross compiling.
Signed-off-by: Anders Roxell <anders.roxell@enea.com>
Upstream-Status: Pending
---
diff -uNr a/tclconfig/tcl.m4 b/tclconfig/tcl.m4
--- a/tclconfig/tcl.m4 2012-12-14 09:16:58.789861281 +0100
+++ b/tclconfig/tcl.m4 2012-12-14 10:55:43.542297010 +0100
@@ -371,7 +371,7 @@
# of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC
# instead of TCL_BUILD_LIB_SPEC since it will work with both an
# installed and uninstalled version of Tcl.
- if test -f "${TCL_BIN_DIR}/Makefile" ; then
+ if test -f "${TCL_BIN_DIR}/Makefile" || test "$cross_compiling" = yes; then
TCL_LIB_SPEC="${TCL_BUILD_LIB_SPEC}"
TCL_STUB_LIB_SPEC="${TCL_BUILD_STUB_LIB_SPEC}"
TCL_STUB_LIB_PATH="${TCL_BUILD_STUB_LIB_PATH}"
+6
View File
@@ -0,0 +1,6 @@
#!/bin/sh
out_put=`tclsh tests/all.tcl -verbose bpse`
echo
echo "${out_put}" | awk '/PASSED|FAILED|SKIPPED/{gsub(/PASSED/,"PASS"); gsub(/FAILED/,"FAIL"); gsub(/SKIPPED/,"SKIP"); if ($NF=="PASS"){print $NF": "$(NF-1)}else{print $NF": "$2}}' | uniq
@@ -0,0 +1,83 @@
SUMMARY = "tool for automating interactive applications according to a script"
DESCRIPTION = "Expect is a tool for automating interactive applications according to a script. \
Following the script, Expect knows what can be expected from a program and what \
the correct response should be. Expect is also useful for testing these same \
applications. And by adding Tk, you can also wrap interactive applications in \
X11 GUIs. An interpreted language provides branching and high-level control \
structures to direct the dialogue. In addition, the user can take control and \
interact directly when desired, afterward returning control to the script. \
"
HOMEPAGE = "http://sourceforge.net/projects/expect/"
LICENSE = "PD"
SECTION = "devel"
LIC_FILES_CHKSUM = "file://license.terms;md5=fbf2de7e9102505b1439db06fc36ce5c"
DEPENDS += "tcl"
RDEPENDS:${PN} = "tcl"
inherit autotools update-alternatives ptest
SRC_URI = "${SOURCEFORGE_MIRROR}/expect/Expect/${PV}/${BPN}${PV}.tar.gz \
file://0001-configure.in.patch \
file://0002-tcl.m4.patch \
file://0001-expect-install-scripts-without-using-the-fixline1-tc.patch \
file://0001-Resolve-string-formatting-issues.patch \
file://0001-expect-Fix-segfaults-if-Tcl-is-built-with-stubs-and-.patch \
file://0001-exp_main_sub.c-Use-PATH_MAX-for-path.patch \
file://0001-fixline1-fix-line-1.patch \
file://0001-Add-prototype-to-function-definitions.patch \
file://run-ptest \
"
SRC_URI[md5sum] = "00fce8de158422f5ccd2666512329bd2"
SRC_URI[sha256sum] = "49a7da83b0bdd9f46d04a04deec19c7767bb9a323e40c4781f89caf760b92c34"
UPSTREAM_CHECK_URI = "http://sourceforge.net/projects/expect/files/Expect/"
UPSTREAM_CHECK_REGEX = "/Expect/(?P<pver>(\d+[\.\-_]*)+)/"
S = "${WORKDIR}/${BPN}${PV}"
do_install:append() {
install -d ${D}${libdir}
install -m 0755 ${D}${libdir}/expect${PV}/libexpect*.so ${D}${libdir}/
install -m 0755 ${S}/fixline1 ${D}${libdir}/expect${PV}/
rm ${D}${libdir}/expect${PV}/libexpect*.so
sed -e 's|$dir|${libdir}|' -i ${D}${libdir}/expect${PV}/pkgIndex.tcl
}
do_install_ptest() {
install -d ${D}${PTEST_PATH}
cp -r ${S}/tests ${D}${PTEST_PATH}
}
# Apparently the public Tcl headers are only in /usr/include/tcl8.6
# when building for the target and nativesdk.
TCL_INCLUDE_PATH = "--with-tclinclude=${STAGING_INCDIR}/tcl8.6"
TCL_INCLUDE_PATH:class-native = ""
EXTRA_OECONF += "--with-tcl=${STAGING_LIBDIR} \
--enable-shared \
--enable-threads \
--disable-rpath \
${TCL_INCLUDE_PATH} \
"
EXTRA_OEMAKE_install = " 'SCRIPTS=' "
ALTERNATIVE:${PN} = "mkpasswd"
ALTERNATIVE_LINK_NAME[mkpasswd] = "${bindir}/mkpasswd"
# Use lower priority than busybox's mkpasswd (created when built with CONFIG_CRYPTPW)
ALTERNATIVE_PRIORITY[mkpasswd] = "40"
FILES:${PN}-dev = "${libdir_native}/expect${PV}/libexpect*.so \
${includedir}/expect.h \
${includedir}/expect_tcl.h \
${includedir}/expect_comm.h \
${includedir}/tcldbg.h \
${includedir}/*.h \
"
FILES:${PN} += "${libdir}/libexpect${PV}.so \
${libdir}/expect${PV}/* \
"
BBCLASSEXTEND = "native nativesdk"