Commit 8b4377a6 authored by Sergei Golovan's avatar Sergei Golovan Committed by Sergei Golovan

* New upstream release.

  * Remove patches which are were taken from upstream.
  * Demote tk8.6 from recommended to suggested in the expect dependencies
    list (closes: #876018).
  * Apply patch by Helmut Grohne which replaces a few calls to AC_TRY_RUN
    in the configure.in script to make the package cross compilable
    (closes: #873730).
  * Bumped the debhelper compatibility version to 10.
  * Remove the now useless build-dependency on autotools-dev.
  * Bumped standards version to 4.1.1.
parent 701d8d97
expect (5.45-9) UNRELEASED; urgency=medium
expect (5.45.3-1) unstable; urgency=medium
* NOT RELEASED YET
-- Sergei Golovan <sgolovan@debian.org> Sat, 15 Jul 2017 08:37:32 +0300
* New upstream release.
* Remove patches which are were taken from upstream.
* Demote tk8.6 from recommended to suggested in the expect dependencies
list (closes: #876018).
* Apply patch by Helmut Grohne which replaces a few calls to AC_TRY_RUN
in the configure.in script to make the package cross compilable
(closes: #873730).
* Bumped the debhelper compatibility version to 10.
* Remove the now useless build-dependency on autotools-dev.
* Bumped standards version to 4.1.1.
-- Sergei Golovan <sgolovan@debian.org> Thu, 26 Oct 2017 11:14:59 +0300
expect (5.45-8) unstable; urgency=medium
......
......@@ -2,10 +2,9 @@ Source: expect
Section: interpreters
Priority: optional
Maintainer: Sergei Golovan <sgolovan@debian.org>
Build-Depends: debhelper (>= 9.0.0), dpkg-dev (>= 1.16.1~), autotools-dev,
autoconf, tcl8.6-dev
Build-Depends: debhelper (>= 10.0.0), dpkg-dev (>= 1.16.1~), autoconf, tcl8.6-dev
Build-Conflicts: autoconf2.13
Standards-Version: 4.0.0
Standards-Version: 4.1.1
Homepage: http://sourceforge.net/projects/expect/
Package: expect
......@@ -14,7 +13,8 @@ Depends: ${misc:Depends}, ${shlibs:Depends}
Conflicts: expect-dev
Provides: expect-dev
Replaces: expect-dev
Recommends: tcl8.6, tk8.6
Recommends: tcl8.6
Suggests: tk8.6
Multi-Arch: foreign
Description: Automates interactive applications
Expect is a tool for automating interactive applications according to a script.
......
This diff is collapsed.
......@@ -57,8 +57,8 @@ Description: Fix implicit definitions throughout (Closes: #441115).
+EXTERN void exp_ecmd_remove_state_direct_and_indirect _ANSI_ARGS_((Tcl_Interp *interp,ExpState *esPtr));
EXTERN void expChannelInit _ANSI_ARGS_((void));
EXTERN int expChannelCountGet _ANSI_ARGS_((void));
@@ -337,6 +341,8 @@
EXTERN int expChannelStillAlive _ANSI_ARGS_((ExpState *, char *));
@@ -338,6 +342,8 @@
EXTERN ExpState * expStdinoutGet _ANSI_ARGS_((void));
EXTERN ExpState * expDevttyGet _ANSI_ARGS_((void));
......@@ -67,7 +67,7 @@ Description: Fix implicit definitions throughout (Closes: #441115).
/* generic functions that really should be provided by Tcl */
#if 0 /* Redefined as macros. */
EXTERN int expSizeGet _ANSI_ARGS_((ExpState *));
@@ -348,6 +354,8 @@
@@ -349,6 +355,8 @@
#define EXP_CMDINFO_CLOSE "expect/cmdinfo/close"
#define EXP_CMDINFO_RETURN "expect/cmdinfo/return"
......
Author: Per Cederqvist <ceder@lysator.liu.se>
Description: Fix for copying overlapping memory area.
Last-Modified: Mon, 04 Nov 2013 08:23:51 +0400
Bug-Debian: http://bugs.debian.org/728663
Bug: https://sourceforge.net/p/expect/patches/16/
--- a/expect.c
+++ b/expect.c
@@ -1094,7 +1094,7 @@
/* shift remaining elements down */
/* but only if there are any left */
if (i+1 != ecmd->ecd.count) {
- memcpy(&ecmd->ecd.cases[i],
+ memmove(&ecmd->ecd.cases[i],
&ecmd->ecd.cases[i+1],
((ecmd->ecd.count - i) - 1) *
sizeof(struct exp_cmd_descriptor *));
Author: Upstream
Description: Report and fix by Mutsuhito Iikura. On finding a full buffer during
matching the sliding window mechanism slides too far, truncating
the whole buffer and preventing matches across the boundary. Fix
is shortening the slide distance (slide only one 1/3).
Last-Modified: Fri, 23 Oct 2015 11:07:19 +0300
Bug: http://sourceforge.net/p/expect/bugs/76/
--- a/expect.c
+++ b/expect.c
@@ -979,7 +979,7 @@
/* condition is (size >= max*2/3) <=> (size*3 >= max*2) */
if (((expSizeGet(esPtr)*3) >= (esPtr->input.max*2)) && (numchars > 0)) {
o->e = e;
- o->matchlen = numchars;
+ o->matchlen = numchars/3;
o->matchbuf = str;
o->esPtr = esPtr;
expDiagLogU(yes);
......@@ -8,26 +8,12 @@ See-Also: https://gcc.gnu.org/ml/gcc/2017-06/msg00000.html
--- a/expect.c
+++ b/expect.c
@@ -1860,19 +1860,11 @@
if (cc == EXP_DATA_NEW) {
@@ -1861,7 +1861,7 @@
/* try to read it */
cc = expIRead(interp,esPtr,timeout,tcl_set_flags);
-
- /* the meaning of 0 from i_read means eof. Muck with it a */
- /* little, so that from now on it means "no new data arrived */
- /* but it should be looked at again anyway". */
- if (cc == 0) {
+
- if (Tcl_Eof(esPtr->channel)) {
+ if (cc == 0 && Tcl_Eof(esPtr->channel)) {
cc = EXP_EOF;
- } else if (cc > 0) {
- /* successfully read data */
- } else {
- /* failed to read data - some sort of error was encountered such as
- * an interrupt with that forced an error return
- */
}
+
} else if (cc == EXP_DATA_OLD) {
cc = 0;
} else if (cc == EXP_RECONFIGURE) {
Author: Upstream
Description: Combination of 3 patches for unreleased Expect 5.45.1.
1) A patch sent in by Ogawa Hirofumi. The patch fixes a problem when
talking a tty where the writer has died. Some operating systems
report the condition as EIO with nothing read, while this
actually an EOF. Without the patch the returned data is
incomplete due to the error reported immediately and dropping
data in buffers.
2) A patch by Michael Cleverly fixing a problem with the
iteration over the expect channel list where the loop code may
modify the list, breaking the iterator.
3) A patch by Michael Cleverly fixing problem with an insufficient
test for a lost channel in exp_background_channelhandler().
Last-Modified: Fri, 23 Oct 2015 11:24:33 +0300
--- a/expect.c
+++ b/expect.c
@@ -2495,8 +2495,12 @@
*/
/* First check that the esPtr is even still valid! */
- /* This ought to be sufficient. */
- if (0 == Tcl_GetChannel(interp,backup,(int *)0)) {
+ /*
+ * It isn't sufficient to just check that 'Tcl_GetChannel' still knows about
+ * backup since it is possible that esPtr was lost in the background AND
+ * another process spawned and reassigned the same name.
+ */
+ if (!expChannelStillAlive(esPtr, backup)) {
expDiagLog("expect channel %s lost in background handler\n",backup);
return;
}
--- a/exp_chan.c
+++ b/exp_chan.c
@@ -218,6 +218,11 @@
bytesRead = read(esPtr->fdin, buf, (size_t) toRead);
/*printf("ExpInputProc: read(%d,,) = %d\r\n",esPtr->fdin,bytesRead);*/
+
+ /* Emulate EOF on tty for tcl */
+ if ((bytesRead == -1) && (errno == EIO) && isatty(esPtr->fdin)) {
+ bytesRead = 0;
+ }
if (bytesRead > -1) {
/* strip parity if requested */
if (esPtr->parity == 0) {
@@ -448,6 +453,34 @@
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
return tsdPtr->channelCount;
}
+
+int
+expChannelStillAlive(esBackupPtr, backupName)
+ ExpState *esBackupPtr;
+ char *backupName;
+{
+ ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
+ ExpState *esPtr;
+
+ /*
+ * This utility function is called from 'exp_background_channelhandler'
+ * and checks to make sure that backupName can still be found in the
+ * channels linked list at the same address as before.
+ *
+ * If it can't be (or if the memory address has changed) then it
+ * means that it was lost in the background (and possibly another
+ * channel was opened and reassigned the same name).
+ */
+
+ for (esPtr = tsdPtr->firstExpPtr; esPtr; esPtr = esPtr->nextPtr) {
+ if (0 == strcmp(esPtr->name, backupName))
+ return (esPtr == esBackupPtr);
+ }
+
+ /* not found; must have been lost in the background */
+ return 0;
+}
+
#if 0 /* Converted to macros */
int
expSizeGet(esPtr)
@@ -603,12 +636,38 @@
{
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
ExpState *esPtr;
+ ExpState *esNextPtr;
+ ExpState *esPriorPtr = 0;
/* kick off any that already have input waiting */
- for (esPtr = tsdPtr->firstExpPtr;esPtr;esPtr = esPtr->nextPtr) {
+ for (esPtr = tsdPtr->firstExpPtr;esPtr; esPriorPtr = esPtr, esPtr = esPtr->nextPtr) {
/* is bg_interp the best way to check if armed? */
if (esPtr->bg_interp && !expSizeZero(esPtr)) {
+ /*
+ * We save the nextPtr in a local variable before calling
+ * 'exp_background_channelhandler' since in some cases
+ * 'expStateFree' could end up getting called before it
+ * returns, leading to a likely segfault on the next
+ * interaction through the for loop.
+ */
+ esNextPtr = esPtr->nextPtr;
exp_background_channelhandler((ClientData)esPtr,0);
+ if (esNextPtr != esPtr->nextPtr) {
+ /*
+ * 'expStateFree' must have been called from
+ * underneath us so we know that esPtr->nextPtr is
+ * invalid. However, it is possible that either the
+ * original nextPtr and/or the priorPtr have been
+ * freed too. If the esPriorPtr->nextPtr is now
+ * esNextPtr it seems safe to proceed. Otherwise we
+ * break and end early for safety.
+ */
+ if (esPriorPtr && esPriorPtr->nextPtr == esNextPtr) {
+ esPtr = esPriorPtr;
+ } else {
+ break; /* maybe set esPtr = tsdPtr->firstExpPtr again? */
+ }
+ }
}
}
}
--- a/exp_command.h
+++ b/exp_command.h
@@ -248,6 +248,7 @@
EXTERN void exp_ecmd_remove_state_direct_and_indirect _ANSI_ARGS_((Tcl_Interp *interp,ExpState *esPtr));
EXTERN void expChannelInit _ANSI_ARGS_((void));
EXTERN int expChannelCountGet _ANSI_ARGS_((void));
+EXTERN int expChannelStillAlive _ANSI_ARGS_((ExpState *, char *));
EXTERN int exp_tcl2_returnvalue _ANSI_ARGS_((int));
EXTERN int exp_2tcl_returnvalue _ANSI_ARGS_((int));
From: Helmut Grohne <helmut@subdivi.de>
Subject: make cross compilation work
This patch essentially replaces most AC_TRY_RUN with something "better".
Dependening on the use case that may be AC_TRY_COMPILE, AC_COMPUTE_INT or even
AC_CHECK_TYPE. Uses beyond cross compilation:
* Significant simplification of the code.
* Some checks become cacheable.
Index: expect-5.45/configure.in
===================================================================
--- expect-5.45.orig/configure.in
+++ expect-5.45/configure.in
@@ -467,47 +467,32 @@
# and if so that WNOHANG is not defined. The only place I've
# seen this is ISC.
AC_MSG_CHECKING([if WNOHANG requires _POSIX_SOURCE])
-AC_TRY_RUN([
+AC_TRY_COMPILE([
#include <sys/wait.h>
-main() {
+],[
#ifndef WNOHANG
- return 0;
-#else
- return 1;
+#error WNOHANG missing
#endif
-}],
- AC_MSG_RESULT(yes)
- AC_DEFINE(WNOHANG_REQUIRES_POSIX_SOURCE)
-,
+],
AC_MSG_RESULT(no)
,
- AC_MSG_ERROR([Expect can't be cross compiled])
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(WNOHANG_REQUIRES_POSIX_SOURCE)
)
AC_MSG_CHECKING([if any value exists for WNOHANG])
rm -rf wnohang
-AC_TRY_RUN([
+AC_COMPUTE_INT(WNOHANG_BACKUP_VALUE, WNOHANG, [
#include <stdio.h>
#include <sys/wait.h>
-main() {
-#ifdef WNOHANG
- FILE *fp = fopen("wnohang","w");
- fprintf(fp,"%d",WNOHANG);
- fclose(fp);
- return 0;
-#else
- return 1;
-#endif
-}],
- AC_MSG_RESULT(yes)
- AC_DEFINE_UNQUOTED(WNOHANG_BACKUP_VALUE, `cat wnohang`)
- rm -f wnohang
-,
- AC_MSG_RESULT(no)
+],[WNOHANG_BACKUP_VALUE=no])
+if "$WNOHANG_BACKUP_VALUE" = "no"; then
AC_DEFINE(WNOHANG_BACKUP_VALUE, 1)
-,
- AC_MSG_ERROR([Expect can't be cross compiled])
-)
+ AC_MSG_RESULT(no)
+else
+ AC_DEFINE_UNQUOTED(WNOHANG_BACKUP_VALUE, [$WNOHANG_BACKUP_VALUE])
+ AC_MSG_RESULT(yes)
+fi
#
# check how signals work
@@ -711,22 +696,12 @@
fi
# first check for the pure bsd
-AC_MSG_CHECKING([for struct sgttyb])
-AC_TRY_RUN([
-#include <sgtty.h>
-main()
-{
- struct sgttyb tmp;
- exit(0);
-}],
- AC_MSG_RESULT(yes)
+AC_CHECK_TYPE([struct sgttyb],[
AC_DEFINE(HAVE_SGTTYB)
PTY_TYPE=sgttyb
-,
- AC_MSG_RESULT(no)
-,
- AC_MSG_ERROR([Expect can't be cross compiled])
-)
+],[],[
+#include <sgtty.h>
+])
# mach systems have include files for unimplemented features
# so avoid doing following test on those systems
@@ -736,109 +711,77 @@
# note that if we detect termio.h (only), we still set PTY_TYPE=termios
# since that just controls which of pty_XXXX.c file is use and
# pty_termios.c is set up to handle pty_termio.
- AC_MSG_CHECKING([for struct termio])
- AC_TRY_RUN([#include <termio.h>
- main()
- {
- struct termio tmp;
- exit(0);
- }],
+ AC_CHECK_TYPE([struct termio],[
AC_DEFINE(HAVE_TERMIO)
PTY_TYPE=termios
- AC_MSG_RESULT(yes)
-,
- AC_MSG_RESULT(no)
-,
- AC_MSG_ERROR([Expect can't be cross compiled])
-)
+],[],[
+#include <termio.h>
+])
# now check for the new style ttys (not yet posix)
- AC_MSG_CHECKING([for struct termios])
- AC_TRY_RUN([
+ AC_CHECK_TYPE([struct termios],[
+ AC_DEFINE(HAVE_TERMIOS)
+ PTY_TYPE=termios
+ ],[],[
/* including termios.h on Solaris 5.6 fails unless inttypes.h included */
# ifdef HAVE_INTTYPES_H
# include <inttypes.h>
# endif
# include <termios.h>
- main()
- {
- struct termios tmp;
- exit(0);
- }],
- AC_DEFINE(HAVE_TERMIOS)
- PTY_TYPE=termios
- AC_MSG_RESULT(yes)
- ,
- AC_MSG_RESULT(no)
- ,
- AC_MSG_ERROR([Expect can't be cross compiled])
- )
+ ])
fi
AC_MSG_CHECKING([if TCGETS or TCGETA in termios.h])
-AC_TRY_RUN([
+AC_TRY_COMPILE([
/* including termios.h on Solaris 5.6 fails unless inttypes.h included */
#ifdef HAVE_INTTYPES_H
#include <inttypes.h>
#endif
#include <termios.h>
-main() {
+],[
#if defined(TCGETS) || defined(TCGETA)
- return 0;
#else
- return 1;
+#error missing
#endif
-}],
+],[
AC_DEFINE(HAVE_TCGETS_OR_TCGETA_IN_TERMIOS_H)
AC_MSG_RESULT(yes)
-,
+],[
AC_MSG_RESULT(no)
-,
- AC_MSG_ERROR([Expect can't be cross compiled])
-)
+])
AC_MSG_CHECKING([if TIOCGWINSZ in termios.h])
-AC_TRY_RUN([
+AC_TRY_COMPILE([
/* including termios.h on Solaris 5.6 fails unless inttypes.h included */
#ifdef HAVE_INTTYPES_H
#include <inttypes.h>
#endif
#include <termios.h>
-main() {
-#ifdef TIOCGWINSZ
- return 0;
-#else
- return 1;
+],[
+#ifndef TIOCGWINSZ
+#error missing
#endif
-}],
+],[
AC_DEFINE(HAVE_TIOCGWINSZ_IN_TERMIOS_H)
AC_MSG_RESULT(yes)
-,
+],[
AC_MSG_RESULT(no)
-,
- AC_MSG_ERROR([Expect can't be cross compiled])
-)
+])
# finally check for Cray style ttys
AC_MSG_CHECKING([for Cray-style ptys])
SETUID=":"
-AC_TRY_RUN([
-main(){
-#ifdef CRAY
- return 0;
-#else
- return 1;
+AC_TRY_COMPILE([],[
+#ifndef CRAY
+#error missing
#endif
-}
-],
+],[
PTY_TYPE=unicos
SETUID="chmod u+s"
AC_MSG_RESULT(yes)
-,
+],[
AC_MSG_RESULT(no)
-,
- AC_MSG_ERROR([Expect can't be cross compiled])
-)
+])
#
# Check for select and/or poll. If both exist, we prefer select.
@@ -875,21 +818,16 @@
# check for timezones
#
AC_MSG_CHECKING([for SV-style timezone])
-AC_TRY_RUN([
+AC_TRY_COMPILE([
extern char *tzname[2];
extern int daylight;
-main()
-{
+],[
int *x = &daylight;
char **y = tzname;
-
- exit(0);
-}],
+],
AC_DEFINE(HAVE_SV_TIMEZONE)
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no)
-,
- AC_MSG_ERROR([Expect can't be cross compiled])
)
......@@ -11,8 +11,6 @@
16-logfile.patch
18-non-linux.patch
22-segfault-with-stubs.patch
23-memmove.patch
24-format.patch
25-matchlen.patch
26-eof-handling.patch
27-exp_chan.patch
28-cross.patch
#!/usr/bin/make -f
v = 5.45
vv = 5.45.3
tclv = 8.6
DPKG_EXPORT_BUILDFLAGS = 1
......@@ -14,7 +15,9 @@ CFLAGS += -Wall -g -D_BSD_SOURCE -ansi -D_SVID_SOURCE -D_POSIX_SOURCE
LINKS = debian/expect.links debian/tcl-expect.links debian/tcl-expect-dev.links
debian/%.links: debian/%.links.in
sed 's/@DEB_HOST_MULTIARCH@/$(DEB_HOST_MULTIARCH)/g' $< > $@
sed -e 's/@DEB_HOST_MULTIARCH@/$(DEB_HOST_MULTIARCH)/g' \
-e 's/@V@/$(v)/g' \
-e 's/@VV@/$(vv)/g' $< > $@
override_dh_auto_clean:
dh_auto_clean
......@@ -63,13 +66,13 @@ override_dh_auto_install:
cp debian/tmp/usr/share/man/man1/expect.1 debian/tmp/usr/share/man/man3/Expect.3tcl
sed -i -e's:\.TH EXPECT 1:.TH EXPECT 3tcl:' debian/tmp/usr/share/man/man3/Expect.3tcl
# Fix library name
mv debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/expect$(v)/libexpect$(v).so debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libexpect.so.$(v)
mv debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/expect$(vv)/libexpect$(vv).so debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libexpect.so.$(vv)
mkdir -p -m 755 debian/tmp/usr/lib/tcltk/$(DEB_HOST_MULTIARCH)
mv debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/expect$(v) debian/tmp/usr/lib/tcltk/$(DEB_HOST_MULTIARCH)
mv debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/expect$(vv) debian/tmp/usr/lib/tcltk/$(DEB_HOST_MULTIARCH)
# Fix pkgIndex.tcl
sed -i -e's:usr lib:usr lib $(DEB_HOST_MULTIARCH):' debian/tmp/usr/lib/tcltk/$(DEB_HOST_MULTIARCH)/expect$(v)/pkgIndex.tcl
sed -i -e's:usr lib:usr lib $(DEB_HOST_MULTIARCH):' debian/tmp/usr/lib/tcltk/$(DEB_HOST_MULTIARCH)/expect$(vv)/pkgIndex.tcl
# Fix permissions
chmod 0644 debian/tmp/usr/lib/tcltk/$(DEB_HOST_MULTIARCH)/expect$(v)/pkgIndex.tcl
chmod 0644 debian/tmp/usr/lib/tcltk/$(DEB_HOST_MULTIARCH)/expect$(vv)/pkgIndex.tcl
override_dh_link: $(LINKS)
dh_link
......@@ -78,8 +81,8 @@ override_dh_install:
dh_install --fail-missing
get-orig-source:
wget -O expect_$(v).orig.tar.gz \
http://prdownloads.sourceforge.net/expect/expect$(v).tar.gz
wget -O expect_$(vv).orig.tar.gz \
http://prdownloads.sourceforge.net/expect/expect$(vv).tar.gz
.PHONY: override_dh_auto_clean override_dh_auto_configure override_dh_auto_build \
override_dh_auto_install override_dh_install get-orig-source
/usr/lib/@DEB_HOST_MULTIARCH@/libexpect.so.5.45 /usr/lib/@DEB_HOST_MULTIARCH@/libexpect.so
/usr/lib/@DEB_HOST_MULTIARCH@/libexpect.so.@VV@ /usr/lib/@DEB_HOST_MULTIARCH@/libexpect.so
/usr/lib/@DEB_HOST_MULTIARCH@/libexpect.so.5.45 /usr/lib/@DEB_HOST_MULTIARCH@/libexpect.so.5
/usr/lib/@DEB_HOST_MULTIARCH@/libexpect.so.@VV@ /usr/lib/@DEB_HOST_MULTIARCH@/libexpect.so.@V@
/usr/lib/@DEB_HOST_MULTIARCH@/libexpect.so.@VV@ /usr/lib/@DEB_HOST_MULTIARCH@/libexpect.so.5
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment