Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: e4e8d32166a7bfb1517e7072bba8267057452151835a8e4345e18ee6624d6ab5
Ticket: ea69b0258a9833cb61ada42d1fc742d90aec04d0
Crash when using a channel transformation on TCP client socket
User & Date: pooryorick on 2023-03-15 11:48:22
Changes

  1. icomment:
    The fix includes a test that, prior to the fix, reproduced the problem on a Linux system.  I would expect the following script to reproduce the issue on Windows as well.  Could someone try it out and report the results?
    
    <code><verbatim>
    #! /usr/bin/env tclsh
    
    namespace eval rchan {
    
    	proc initialize {chan mode} {
    		namespace eval $chan {
    			variable source "line one\nline two"
    		}
    		after 0 [list ::chan postevent $chan read]
    		return {initialize finalize watch read}
    	}
    
    
    	proc finalize chan {
    		namespace delete $chan
    	}
    
    
    	proc read {chan count} {
    		namespace upvar $chan counter counter source source
    		set res [string range $source 0 $count-1]
    		set source [string range $source $count end]
    		return $res
    	}
    
    
    	proc watch {chan events} {
    		after 0 [list chan postevent $chan read]
    		return read
    	}
    
    
    	namespace ensemble create
    	namespace export *
    }
    
    
    namespace eval filter {
    	proc initialize {chan mode} {
    		return {initialize finalize read}
    	}
    	
    	proc read {chan buffer} {
    		return $buffer
    	}
    
    	namespace ensemble create
    	namespace export *
    }
    
    
    proc read1 {chan args} {
    	variable read
    	catch {
    		set res [gets $chan]
    	}
    	incr  read
    }
    
    set chan [chan create read rchan]
    chan configure $chan -blocking 0
    chan push $chan filter
    chan event $chan read [list read1 $chan]
    vwait [namespace current]::read
    chan pop $chan
    vwait [namespace current]::read
    return
    </verbatim></code>
    
  2. login: "pooryorick"
  3. mimetype: "text/x-fossil-wiki"