Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 1622194e55cb4fc4d7c915e5864a545a515273044bbdea27916bd348ac6aab7d
Ticket: 79474c58800cdf94559a2c01230b4536aa416016
refchan segfault
User & Date: sebres on 2019-07-31 19:59:35
Changes

  1. comment changed to:
    The following script causes a segfault in DoRead:
    <verbatim>
    proc nexec {cmd in out stderr} {
        lassign [chan pipe] in1 out1
        lassign [chan pipe] in2 out2
        lassign [chan pipe] in3 out3
        puts [exec {*}$cmd >@ $out2 2>@ $out3 <@ $in1 &] 
        fileevent $in2 readable [list chan copy $in2 $out]
        fileevent $in3 readable [list chan copy $in3 $stderr]
        fileevent $out1 writable [list chan copy $in $out1]
    }
    
    proc test {args} {
      puts $args 
      set rest [lassign $args mode chan]
      switch -exact $mode {
        read {puts $chan "Test" ; close $chan}
        initialize {return "initialize watch finalize read write"}
        finalize {}
      }
    }
    
    set c [chan create "read write" test]
    
    if {$::tcl_platform(platform) ne "windows"} {
      nexec {sh -c "echo test"} $c $c $c
    } else {
      nexec {cmd /c "echo test"} $c $c $c
    }
    
    vwait forever
    
    </verbatim>
    
    Gives with a debug build:
    
    <verbatim>
    % source exec-test.tcl
    initialize rc0 {read write}
    36514
    read rc0 4096
    write rc0 {Test
    }
    finalize rc0
    Assertion failed: (bufPtr != NULL), function DoRead, file /Users/mpcjanssen/Src/tcltk/tcl/generic/tclIO.c, line 9815.
    </verbatim>
    
  2. icomment:
    Same on windows (I updated the ticket) - segfaulting too.
    
    Because it may be affected by buffer is still in use, [32ae34e63a] could be related issue (then it affects 8.5 in the same manner).
    
  3. login: "sebres"
  4. mimetype: "text/x-fossil-wiki"