pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/lang/tcl-expect lang/tcl-expect: add workaround for de...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/a8b0ff46c360
branches:  trunk
changeset: 379325:a8b0ff46c360
user:      dholland <dholland%pkgsrc.org@localhost>
date:      Sun May 15 01:56:24 2022 +0000

description:
lang/tcl-expect: add workaround for deadlock seen on Linux and Solaris

Closes PR 34442.

diffstat:

 lang/tcl-expect/Makefile                  |   4 +-
 lang/tcl-expect/distinfo                  |   3 +-
 lang/tcl-expect/patches/patch-exp__chan.c |  49 +++++++++++++++++++++++++++++++
 3 files changed, 53 insertions(+), 3 deletions(-)

diffs (81 lines):

diff -r 1deefb9a7e25 -r a8b0ff46c360 lang/tcl-expect/Makefile
--- a/lang/tcl-expect/Makefile  Sun May 15 00:37:26 2022 +0000
+++ b/lang/tcl-expect/Makefile  Sun May 15 01:56:24 2022 +0000
@@ -1,9 +1,9 @@
-# $NetBSD: Makefile,v 1.34 2018/09/07 08:51:39 jperkin Exp $
+# $NetBSD: Makefile,v 1.35 2022/05/15 01:56:24 dholland Exp $
 
 .include "Makefile.common"
 
 PKGNAME=       tcl-expect-${EXPECT_VERSION}
-PKGREVISION=   4
+PKGREVISION=   5
 CATEGORIES=    lang
 
 MAINTAINER=    pkgsrc-users%NetBSD.org@localhost
diff -r 1deefb9a7e25 -r a8b0ff46c360 lang/tcl-expect/distinfo
--- a/lang/tcl-expect/distinfo  Sun May 15 00:37:26 2022 +0000
+++ b/lang/tcl-expect/distinfo  Sun May 15 01:56:24 2022 +0000
@@ -1,7 +1,8 @@
-$NetBSD: distinfo,v 1.22 2021/10/26 10:51:57 nia Exp $
+$NetBSD: distinfo,v 1.23 2022/05/15 01:56:24 dholland Exp $
 
 BLAKE2s (expect5.45.tar.gz) = 38c440ed0868322b6ec7438decaa036a636e7d700191b754c1e4a7dc0fdd0c46
 SHA512 (expect5.45.tar.gz) = be991c68241e607b3a689eae7e7966056dbfb577e857331d54a4911bd178c1816425217603b43918ad1b6d2e966271a0f01e79d7028a22e223562d59d10c8c51
 Size (expect5.45.tar.gz) = 628808 bytes
 SHA1 (patch-Makefile.in) = 24efcbdb0a21985cb8a0fb7812c5f45f67de7c30
 SHA1 (patch-configure) = a16c833e61d23f63abff1413522b99cd2251bc34
+SHA1 (patch-exp__chan.c) = 5af6bf31fa87a4d9951be6bc978ede5440380981
diff -r 1deefb9a7e25 -r a8b0ff46c360 lang/tcl-expect/patches/patch-exp__chan.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/tcl-expect/patches/patch-exp__chan.c Sun May 15 01:56:24 2022 +0000
@@ -0,0 +1,49 @@
+$NetBSD: patch-exp__chan.c,v 1.1 2022/05/15 01:56:24 dholland Exp $
+
+Add hack to work around deadlock situation that occurs on Solaris and
+Linux. See PR 34442.
+
+The problem apparently does not occur on BSD, but it doesn't seem to
+be clear why or whether that's really the case; the description of the
+problem as far as it's understood seems to be portable. So don't
+conditionalize it, as the check should be safe. If this turns out to
+cause problems, we can wrap it in ifdefs.
+
+--- exp_chan.c.orig    2010-07-01 00:53:49.000000000 +0000
++++ exp_chan.c
+@@ -7,6 +7,7 @@
+  */
+ 
+ #include <sys/types.h>
++#include <sys/poll.h>
+ #include <stdio.h>
+ #include <signal.h>
+ #include <errno.h>
+@@ -205,6 +206,8 @@ ExpInputProc(instanceData, buf, toRead, 
+     ExpState *esPtr = (ExpState *) instanceData;
+     int bytesRead;                    /* How many bytes were actually
+                                          * read from the input device? */
++    struct pollfd fds[1];
++    int pollResult;
+ 
+     *errorCodePtr = 0;
+     
+@@ -215,6 +218,18 @@ ExpInputProc(instanceData, buf, toRead, 
+      * nonblocking, the read will never block.
+      */
+ 
++    /* Update: there isn't always, which can lead to hangs. See PR 34442. */
++    fds[0].fd = esPtr->fdin;
++    fds[0].events = POLLIN | POLLERR | POLLHUP | POLLNVAL;
++    pollResult = poll(fds, 1, 0);
++    if (pollResult <= 0) {
++        *errorCodePtr = EWOULDBLOCK;
++      return -1;
++    } else if (fds[0].revents & (POLLERR | POLLHUP | POLLNVAL)) {
++        *errorCodePtr = EBADF;
++      return -1;
++    }
++
+     bytesRead = read(esPtr->fdin, buf, (size_t) toRead);
+     /*printf("ExpInputProc: read(%d,,) = %d\r\n",esPtr->fdin,bytesRead);*/
+     if (bytesRead > -1) {



Home | Main Index | Thread Index | Old Index