Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2009-08-28
04:30 • Closed ticket [2843166fff]: replacing stdin with refchan causes segfault in inte... artifact: 40c019e03a user: andreas_kupries
04:30 • Ticket [2843166fff]: 4 changes artifact: 93f41f1263 user: andreas_kupries
2009-08-25
02:40 • Ticket [2843166fff]: 4 changes artifact: 100ebf713b user: andreas_kupries
2009-08-24
10:47 • Ticket [2843166fff]: 4 changes artifact: 04f6293405 user: afaupell
06:10 • Ticket [2843166fff]: 4 changes artifact: 09f5cc2d7c user: andreas_kupries
04:30 • Ticket [2843166fff]: 4 changes artifact: 6a863b4153 user: afaupell
02:53 • Ticket [2843166fff]: 1 change artifact: 4e4a97c6bc user: dkf
2009-08-23
18:03 • New ticket [2843166fff]. artifact: fc9b0d9b9d user: afaupell

replacing stdin with refchan causes segfault in interp

Closed / Out of Date2843166fffffffffffffffffffffffffffffffffCreated 17 years agoUpdated 17 years ago
Descriptionplain2009-08-23 18:03:57
test script:

proc stdin {args} {
    switch -exact -- [lindex $args 0] {
        initialize { return {initialize finalize watch read} }
        read {
            return read
        }
    }
}
close stdin
chan create read stdin
interp create
puts hi


causes segfault at interp create on AS build 8.5.7 on linux. commenting the chan create line fixes the problem.

source built 8.5.6 on bsd and tclkit 8.5.2 on windows work fine.
dkf Ticket [2843166fff]: 1 change [History diff]2009-08-24 02:53:42
afaupellplain2009-08-24 04:30:30
stack trace

#0  0x00000000 in ?? ()
#1  0xb8016b9b in TclpMakeFile () from /usr/local/lib/libtcl8.5.so
#2  0xb7fece03 in TclCreatePipeline () from /usr/local/lib/libtcl8.5.so
#3  0xb7fecec0 in Tcl_OpenCommandChannel () from /usr/local/lib/libtcl8.5.so
#4  0xb7fcad8f in Tcl_ExecObjCmd () from /usr/local/lib/libtcl8.5.so
#5  0xb7f652ba in TclEvalObjvInternal () from /usr/local/lib/libtcl8.5.so
#6  0xb7faaa57 in TclExecuteByteCode () from /usr/local/lib/libtcl8.5.so
#7  0xb7ff273c in TclObjInterpProcCore () from /usr/local/lib/libtcl8.5.so
#8  0xb7ff26a0 in TclObjInterpProc () from /usr/local/lib/libtcl8.5.so
#9  0xb7f652ba in TclEvalObjvInternal () from /usr/local/lib/libtcl8.5.so
#10 0xb7faaa57 in TclExecuteByteCode () from /usr/local/lib/libtcl8.5.so
andreas_kupriesplain2009-08-24 06:10:31
From the stacktrace this might be a duplicate of 18262248 per

2009-07-24  Andreas Kupries  <[email protected]>

        * generic/tclIO.c (Tcl_GetChannelHandle): [Bug 2826248]: Do not crash
        * generic/tclPipe.c (FileForRedirect): for getHandleProc == NULL, this
        is allowed. Provide a nice error message in the bypass area. Updated
        caller to check the bypass for a mesage. Bug reported by Andy
        Sonnenburg <[email protected]>. Backported from CVS
        head.

A limitation of reflected channels, they cannot be used as redirection in command pipelines. On the other hand, it is not clear where in 'interp create' it would run [exec]. Maybe somewhere in "init.tcl" ?

It might be useful to try this with the CVS head of the 8.5 branch. Note that this will not fix the limitation itself, only convert the crash into a proper Tcl error message.
afaupellplain2009-08-24 10:47:44
i dont think its related to command pipelines, and i dont think it should be a limitation (throw an error) since everything works as expected in the 2 different versions/builds i have available.
andreas_kupriesplain2009-08-25 02:40:26
Ok. 8.5/8.6 Head, plain build - No crash, output is 'hi'.

Next up, try most current AT 8.5.7, 8.6 builds made this weekend, this also the CVS heads of Tcl as of Friday afternoon.
    ActiveTcl8.5.7.0.291058-linux-ix86-threaded
    ActiveTcl8.6.0.0b1.291058-linux-ix86-threaded

Ditto. No crash. Output is 'hi'.

For comparison, use the 8.5.7.290198 release ...
Seg.fault.

Ok. This seems to be something which is fixed in the latest core sources, relative to April 14 (last AT 8.5.7 release).
andreas_kupriesplain2009-08-28 04:30:15
Was found to be ok in head. Closing as out-of-date.
andreas_kupriesplain2009-08-28 04:30:18
allow_comments - 1
Log in (anonymous is fine) to add a comment.