Date: Wed, 25 Jun 2014 08:30:55 +0000 From: bugzilla-noreply@freebsd.org To: tcltk@FreeBSD.org Subject: [Bug 191285] lang/expect segfault in exp_spawnv Message-ID: <bug-191285-30738-UZQUAGx9ss@https.bugs.freebsd.org/bugzilla/> In-Reply-To: <bug-191285-30738@https.bugs.freebsd.org/bugzilla/> References: <bug-191285-30738@https.bugs.freebsd.org/bugzilla/>
next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=191285 Pietro Cerutti <gahr@FreeBSD.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |gahr@FreeBSD.org --- Comment #2 from Pietro Cerutti <gahr@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.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-191285-30738-UZQUAGx9ss>