Tech Insider					   Technology and Trends


			   USENET Archives

From: Jim Barton <j...@network-age.com>
Subject: Bug in TCL 7.6 on Windows Sockets
Date: 1996/10/28
Message-ID: <32754000.3241@network-age.com>#1/1
X-Deja-AN: 192887544
cc: maydw...@bayarea.net
content-type: text/plain; charset=us-ascii
organization: Network Age Software, Inc.
mime-version: 1.0
reply-to: j...@network-age.com
newsgroups: comp.lang.tcl
x-mailer: Mozilla 3.0Gold (Win95; I)


In file win/tclWinSock.c, routine TcpAccept(). Function is
called when a connection attempt is made on a server socket
in order to accept the connection and open a new socket.

Near the beginning of the routine, after calling the Windows
hook for accepting the socket, he wants to clear the TCL_READABLE
condition for the accepting socket. Code reads:

	infoPtr->flags= (~(TCL_READABLE));

This certainly clears the flag, but sets every other bit in the word.

The manifestation of this problem is that once a program accepts it's
first connection, the accept socket flags indicate various
strange conditions which never get cleared. The TCL program
never blocks, as higher level code thinks there
is an event to handle, while low-level code doesn't. A very nice
CPU cycle soaker indeed.

The fix is trivial:

	infoPtr->flags &= ~TCL_READABLE;

which is probably what was meant in the first place.

-- Jim Barton

From: Jim Barton <j...@network-age.com>
Subject: BUG in tk4.2 on Windows - bad library search path
Date: 1996/11/14
Message-ID: <328BA3D2.9B6@network-age.com>#1/1
X-Deja-AN: 196524572
content-type: text/plain; charset=us-ascii
organization: Network Age Software, Inc.
mime-version: 1.0
reply-to: j...@network-age.com
newsgroups: comp.lang.tcl
x-mailer: Mozilla 3.0Gold (Win95; I)


There is a bug in tk4.2 under Windows in finding the path for the
library
scripts. Consider the following fragment from the file win/tkWinInit.c:

| static char *initScript =
| "proc init {} {\n\
|     global tk_library tk_version tk_patchLevel env\n\
|     rename init {}\n\
|     set dirs {}\n\
|     if [info exists env(TK_LIBRARY)] {\n\
|       lappend dirs $env(TK_LIBRARY)\n\
|     }\n\
|     lappend dirs $tk_library\n\
|     lappend dirs [file dirname [info library]]/lib/tk$tk_version\n\
                                                ^^^^
                This code is wrong; the 'lib' will be left on the end
                after stripping the terminal tcl7.6 library off, and
thus
                the script will look in .../lib/lib/tk$tkversion.

|     lappend dirs [file dirname [file dirname [info
nameofexecutable]]]/lib/tk$tk_version\n\
|     if [string match {*[ab]*} $tk_patchLevel] {\n\
|       set lib tk$tk_patchLevel\n\
|     } else {\n\
|       set lib tk$tk_version\n\
| ...

The search works because the next element strips the executable path
*and*
the 'bin' directory first, so you never see the bug if you run wish42
out
of the standard place ... but if you, for instance, copy it and run it
from somewhere else, blammo. This is a pain if you roll your own wish's.

-- jmb

			   USENET Archives


The materials and information included in this website may only be used
for purposes such as criticism, review, private study, scholarship, or 
research.


Electronic mail:			      WorldWideWeb:
   tech-insider@outlook.com		         http://tech-insider.org/