Tcl Source Code

Check-in [f520790052]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment: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.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | aku-review
Files: files | file ages | folders
SHA1: f520790052df3ae19e70cf65582436e4644b5800
User & Date: dgp 2014-08-20 17:50:41
Context
2014-08-20
18:59
Fix reviewed and accepted. check-in: ff52fbb4ac user: andreask tags: core-8-5-branch
17:50
Docs for Tcl_CreateChannelHandler() state that the registered handler proc will be called back with ... Closed-Leaf check-in: f520790052 user: dgp tags: aku-review
11:13
[74e073599e]: tclsh is using old style dialogs when Tk is l... check-in: a2a1fe34e9 user: jan.nijtmans tags: core-8-5-branch
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to generic/tclIO.c.

7712
7713
7714
7715
7716
7717
7718
7719
7720
7721
7722
7723
7724
7725
7726
	/*
	 * If this channel handler is interested in any of the events that
	 * have occurred on the channel, invoke its procedure.
	 */

	if ((chPtr->mask & mask) != 0) {
	    nh.nextHandlerPtr = chPtr->nextPtr;
	    (*(chPtr->proc))(chPtr->clientData, mask);
	    chPtr = nh.nextHandlerPtr;
	} else {
	    chPtr = chPtr->nextPtr;
	}
    }

    /*







|







7712
7713
7714
7715
7716
7717
7718
7719
7720
7721
7722
7723
7724
7725
7726
	/*
	 * If this channel handler is interested in any of the events that
	 * have occurred on the channel, invoke its procedure.
	 */

	if ((chPtr->mask & mask) != 0) {
	    nh.nextHandlerPtr = chPtr->nextPtr;
	    (*(chPtr->proc))(chPtr->clientData, chPtr->mask & mask);
	    chPtr = nh.nextHandlerPtr;
	} else {
	    chPtr = chPtr->nextPtr;
	}
    }

    /*