From 166fb42c36ba616d9698b30dee6731e6b9edb625 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 20 Aug 2014 11:13:29 +0000 Subject: [74e073599e5e7c5eb535e2f60f1b06feb468eaae|74e073599e]: tclsh is using old style dialogs when Tk is loaded on Windows --- win/tclsh.exe.manifest.in | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/win/tclsh.exe.manifest.in b/win/tclsh.exe.manifest.in index aaa34e1..b7c4381 100644 --- a/win/tclsh.exe.manifest.in +++ b/win/tclsh.exe.manifest.in @@ -30,4 +30,22 @@ + + + true + + + + + + + -- cgit v0.12 From 8339de0c86602b9b9aeea1efb6245c4e47411884 Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 20 Aug 2014 17:50:41 +0000 Subject: Docs for Tcl_CreateChannelHandler() state that the registered handler proc will be called back with a mask value. "Mask is an integer mask indicating which of the requested conditions actually exists for the channel; it will contain ***a subset of the bits from the mask argument*** to Tcl_CreateChannelHandler when the handler was created." (emhpasis added). Tcl_NotifyChannel is not honoring this. It passes a mask value that may contain bits not in common with the mask argument to T_CCH(). This commit is a one-liner patch adding in the masking step to make things behave as documented. Thanks to apn for digging this out. (In combination with other questionable code, this led to a hang in test http-4.6 on Windows) Tcl_NotifyChannel() has had this error in all of recorded Tcl history. It's hard to imagine any code dependent on it though. If any exists, it can be revised to pass the mask value it truly needs to T_CCH() and end up with code suitable both before and after this change. If you concur, please merge to core-8-5-branch, and I'll take it from there. --- generic/tclIO.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generic/tclIO.c b/generic/tclIO.c index afffeb8..4452ae9 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -7716,7 +7716,7 @@ Tcl_NotifyChannel( if ((chPtr->mask & mask) != 0) { nh.nextHandlerPtr = chPtr->nextPtr; - (*(chPtr->proc))(chPtr->clientData, mask); + (*(chPtr->proc))(chPtr->clientData, chPtr->mask & mask); chPtr = nh.nextHandlerPtr; } else { chPtr = chPtr->nextPtr; -- cgit v0.12 From 12c37823c6a4f23e3d4692d06909143077af8493 Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 20 Aug 2014 18:40:07 +0000 Subject: Make test io-36.1.1 more portable. --- tests/io.test | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/io.test b/tests/io.test index 925f8c6..7698cea 100644 --- a/tests/io.test +++ b/tests/io.test @@ -4924,7 +4924,10 @@ test io-36.1 {Tcl_InputBlocked on nonblocking pipe} {stdio openpipe} { test io-36.1.1 {Tcl_InputBlocked on nonblocking binary pipe} {stdio openpipe} { set f1 [open "|[list [interpreter]]" r+] chan configure $f1 -encoding binary -translation lf -eofchar {} - puts $f1 {puts hello_from_pipe} + puts $f1 { + chan configure stdout -encoding binary -translation lf -eofchar {} + puts hello_from_pipe + } flush $f1 gets $f1 fconfigure $f1 -blocking off -buffering full -- cgit v0.12 From efe771bd6741517d20bc6260f4d3669d7a699b66 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 21 Aug 2014 23:07:34 +0000 Subject: Test fix for likely cause of reported I/O slowdown. In a DoRead() revision, it came to favor making every effort to fill buffers, in preference to a more sensible goal of favoring avoiding calls out to the driver if there's already enough data in the buffers to satisfy the read operation. Result is many more calls out to recv() than are a good idea. Ought to show up most glaringly when many Tcl_Read() calls asking for small numbers of bytes (compared to buffer size) each, and that matches the reported case. --- generic/tclIO.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/generic/tclIO.c b/generic/tclIO.c index 4452ae9..4f81770 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -8855,6 +8855,7 @@ DoRead( /* If there is no full buffer, attempt to create and/or fill one. */ +if (bufPtr == NULL || BytesLeft(bufPtr) < bytesToRead) { while (!IsBufferFull(bufPtr)) { int code; @@ -8880,6 +8881,7 @@ DoRead( } assert (bufPtr != NULL); +} bytesRead = BytesLeft(bufPtr); bytesWritten = bytesToRead; -- cgit v0.12 From caf6744b7571b6e56828b99073e32ad159a1ffa4 Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 22 Aug 2014 13:20:21 +0000 Subject: Same results; simpler logic. --- generic/tclIO.c | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/generic/tclIO.c b/generic/tclIO.c index 4f81770..93ac937 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -8853,36 +8853,22 @@ DoRead( break; } - /* If there is no full buffer, attempt to create and/or fill one. */ - -if (bufPtr == NULL || BytesLeft(bufPtr) < bytesToRead) { - while (!IsBufferFull(bufPtr)) { - int code; + /* + * If there is not enough data in the buffers to possibly + * complete the read, then go get more. + */ + if (bufPtr == NULL || BytesLeft(bufPtr) < bytesToRead) { moreData: - code = GetInput(chanPtr); - bufPtr = statePtr->inQueueHead; - - assert (bufPtr != NULL); - - if (GotFlag(statePtr, CHANNEL_EOF|CHANNEL_BLOCKED)) { - /* Further reads cannot do any more */ - break; - } - - if (code) { + if (GetInput(chanPtr)) { /* Read error */ UpdateInterest(chanPtr); TclChannelRelease((Tcl_Channel)chanPtr); return -1; } - - assert (IsBufferFull(bufPtr)); + bufPtr = statePtr->inQueueHead; } - assert (bufPtr != NULL); -} - bytesRead = BytesLeft(bufPtr); bytesWritten = bytesToRead; -- cgit v0.12