summaryrefslogtreecommitdiff
path: root/debian/patches/term-for-tcl.patch
blob: fb63037a2fdd5c089886268346901a6989e4940a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
See discussion in http://bugs.debian.org/755295
and bug report on comp.lang.tcl on July 1st 2015
(“'expect' losing data due to tcl buffering”)

--- a/term/ptyio.c
+++ b/term/ptyio.c
@@ -350,6 +350,16 @@ pty_io_read (struct trivfs_protid *cred,
 	size++;
     }
 
+  /*
+   * Linux never returns more than this, and at least TCL happens to depend on
+   * this behavior. This was discussed in http://bugs.debian.org/755295 and
+   * raised to TCL, with no answer so far.
+   */
+#define LINUXISH_READ_MAX 4095
+  if (cred->po->openmodes & O_NONBLOCK)
+    if (amount > LINUXISH_READ_MAX)
+      amount = LINUXISH_READ_MAX;
+
   if (size > amount)
     size = amount;
   if (size > *datalen)