[Bug 191285] lang/expect segfault in exp_spawnv
    bugzilla-noreply at freebsd.org 
    bugzilla-noreply at freebsd.org
       
    Wed Jun 25 08:30:55 UTC 2014
    
    
  
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=191285
Pietro Cerutti <gahr at FreeBSD.org> changed:
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gahr at FreeBSD.org
--- Comment #2 from Pietro Cerutti <gahr at FreeBSD.org> ---
I don't think it's related to ckalloc / ckfree. The problem is the definition
of Tcl_ErrnoMsg:
#define Tcl_ErrnoMsg (tclStubsPtr->tcl_ErrnoMsg)
I fear you don't have a properly setup interp.
Please try this sample program:
#include <sys/types.h>
#include <unistd.h>
#include <tcl.h>
#include <expect.h>
#include <expect_tcl.h>
int main(void)
{
    Tcl_Interp * interp = Tcl_CreateInterp();
    Expect_Init(interp);
    char * date = "/bin/date";
    char * args[] = {date, NULL};
    int fd = exp_spawnv(date, args);
    char buf[64];
    read(fd, buf, sizeof(buf));
    puts(buf);
    close(fd);
    return (0);
}
Compile with something like this:
cc -o test-spawn test-spawn.c -I/usr/local/include/tcl8.6 -I/usr/local/include
-L/usr/local/lib -lexpect -ltcl86
It works as expected here. However, if you remove the assignment to interp and
just leave the variable uninitialized or NULL-initialized, it will segfault
exactly as you described.
-- 
You are receiving this mail because:
You are the assignee for the bug.
    
    
More information about the freebsd-tcltk
mailing list