Search code examples
tclopenacs

How should one deal with a new Tcl assertion (introduced in 8.5.18) that fires upon an IO operation?


Our Tcl-based web application (OpenACS, NaviServer) provides the functionality for uploading and extracting ZIP Archives. After upgrading to the latest version of Tcl (8.5.18), the server now crashes when processing the contents of the extracted archive and spits out this error.

nsd: /usr/local/src/tcl/tcl8.5.18/unix/../generic/tclIO.c:5395: DoReadChars: Assertion `!((statePtr)->flags & ((1<<9))) || ((statePtr)->flags & ((1<<10))) || Tcl_InputBuffered((Tcl_Channel)chanPtr) == 0' failed.

This assertion has been introduced between Tcl 8.5.17 and 8.5.18. Is the assertion wrong or too rigorous, or does this hint at some form of error at the application level?


Solution

  • It turns out that I was running into a known bug that was fixed in April 2015 (http://core.tcl.tk/tcl/info/879a0747bee593e2). When Tcl 8.5.19 is released, using that will make my troubles go away. Before that, one can work from Tcl development sources, or try the patch in isolation (http://core.tcl.tk/tcl/info/4b964e7afb811898).