From: Jim Barton <j...@network-age.com>
Subject: BUG in Tcl 8.0b1 fileevent handling
Date: 1997/06/09
Message-ID: <339C51E4.6FF1@network-age.com>#1/1
X-Deja-AN: 247300833
Organization: Network Age Software, Inc.
Newsgroups: comp.lang.tcl


The specific example:

	create a server on a socket
	connect to it from another process
	create a read fileevent handler in the server for the socket
	create a write filevent handler in the server for the socket
	cancel the write filevent handler for the socket
	close the socket in the server
	server enters an infinite loop!

What happened? When the writable event handler is deleted,
the select bit in the writable mask kept in the notifier
structure is never cleared. However, the file descriptor is
closed. Like a good OS call, select notes that the descriptor
matching the select bit is not open, and returns EBADF. TCL,
however, basically ignores the error return from select, and tries
again, and again, and again ...

-- jmb

From: Jim Barton <j...@network-age.com>
Subject: Problem with fcopy?
Date: 1997/06/11
Message-ID: <339F0B26.7FA2@network-age.com>#1/1
X-Deja-AN: 247726867
Organization: Network Age Software, Inc.
Newsgroups: comp.lang.tcl


I'm running Tcl8.0b1 under IRIX, but I assume this is true for
most UNIX-family operating systems.

In certain circumstances, fcopy drops the last four bytes
of the input file. I haven't been fully able to ascertain
why, or what the condition is, but it can be faithfully
reproduced with the right file of sufficient size.

I have an fcopy-like command (it does some other things I
need) that has the same problem. Thinking it was my bug,
I spent many hours honing the code. But the fact is, my
home-brew fcopy and TCL's fcopy both fail the same way
on the same file, so it is likely the bug is underneath
somewhere.

Tracing what happens, it is apparent that the TCL file
mechanism has decided to return 0 bytes with Tcl_Eof returning
true, even though those last four bytes haven't been presented
to the caller. Reading again still returns 0 bytes.

Anybody seen anything like this?

-- jmb