[WINTCL] TclpObjNormalizePath() crashes under cygwin
by Alexander Zschach other posts by this author
Jan 10 2007 4:13AM messages near this date
Re: [WINTCL] [TCLCORE] Package require
|
Re: [WINTCL] my sophis
Hi all,
I am facing a problem with tcl 8.4.1 under cygwin:
CYGWIN_NT-5.2 cygtest 1.5.21(0.156/4/2) 2006-07-30 14:21 i686 Cygwin
gcc (GCC) 3.4.4 (cygming special) (gdc 0.12, using dmd 0.125)
cygwin package: tcltk/tcltk-20060202-1
Test program compile: gcc -Wall -O0 -g -o test test.c -ltcl
The implicit call of TclpObjNormalizePath() produces a segmentation
fault. For example, this can be reproduced by the following peace of code:
==========================================================================
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <tcl.h>
int main (int argc, char **argv) {
Tcl_Interp *interp = NULL;
char *path = argv[1];
char cmd[255];
int tclReturnCode = 0;
const char *tclStringResult = malloc (255);
// -------------------------------------------------------------
if ((interp = Tcl_CreateInterp ()) == NULL) {
fprintf (stderr, "failed to create TCL interpreter\n");
exit (1);
}
// -------------------------------------------------------------
// call of Tcl_Init (interp) crashes ...
if ((tclReturnCode = Tcl_Init (interp)) != TCL_OK) {
tclStringResult = Tcl_GetStringResult (interp);
fprintf (stderr,
"failed to initialize TCL interpreter: %s\n",
tclStringResult);
Tcl_DeleteInterp (interp);
exit (1);
}
// -------------------------------------------------------------
sprintf (cmd, "puts \"hello world\"");
Tcl_Eval (interp, cmd);
// -------------------------------------------------------------
Tcl_DeleteInterp (interp);
return 0;
}
==========================================================================
Tcl_Init, which implicitly calls TclpObjNormalizePath() crashes with a
segmentation fault due to - at least for me - unknown reasons. The stack
trace is as follows:
==========================================================================
GNU gdb 6.5.50.20060706-cvs (cygwin-special)
[...]
(gdb) set args ./source.tcl
(gdb) r
Starting program: /home/Administrator/az/test.exe ./source.tcl
Loaded symbols for /cygdrive/c/WINDOWS/system32/ntdll.dll
Loaded symbols for /cygdrive/c/WINDOWS/system32/kernel32.dll
Loaded symbols for /usr/bin/cygwin1.dll
Loaded symbols for /cygdrive/c/WINDOWS/system32/advapi32.dll
Loaded symbols for /cygdrive/c/WINDOWS/system32/rpcrt4.dll
Loaded symbols for /usr/bin/tcl84.dll
Loaded symbols for /cygdrive/c/WINDOWS/system32/user32.dll
Loaded symbols for /cygdrive/c/WINDOWS/system32/gdi32.dll
Program received signal SIGSEGV, Segmentation fault.
0x00000000 in ?? ()
(gdb) bt
#0 0x00000000 in ?? ()
#1 0x100740a1 in tcl84!TclpObjNormalizePath () from /usr/bin/tcl84.dll
#2 0x1004b840 in tcl84!Tcl_FSSplitPath () from /usr/bin/tcl84.dll
#3 0x1004c4c5 in tcl84!Tcl_FSGetNormalizedPath () from /usr/bin/tcl84.dll
#4 0x1004bd5f in tcl84!Tcl_FSGetFileSystemForPath () from /usr/bin/tcl84.dll
#5 0x1004cc54 in tcl84!Tcl_FSAccess () from /usr/bin/tcl84.dll
#6 0x100131a7 in tcl84!Tcl_ExprObjCmd () from /usr/bin/tcl84.dll
#7 0x100137ea in tcl84!Tcl_FileObjCmd () from /usr/bin/tcl84.dll
#8 0x1000d71f in tcl84!TclEvalObjvInternal () from /usr/bin/tcl84.dll
#9 0x10033e6d in tcl84!TclExprFloatError () from /usr/bin/tcl84.dll
#10 0x10037bef in tcl84!TclCompEvalObj () from /usr/bin/tcl84.dll
#11 0x1005ea8f in tcl84!TclObjInterpProc () from /usr/bin/tcl84.dll
#12 0x1000d71f in tcl84!TclEvalObjvInternal () from /usr/bin/tcl84.dll
#13 0x1000ecfa in tcl84!Tcl_EvalEx () from /usr/bin/tcl84.dll
#14 0x1000f119 in tcl84!Tcl_Eval () from /usr/bin/tcl84.dll
#15 0x10075405 in tcl84!Tcl_Init () from /usr/bin/tcl84.dll
#16 0x004010ee in main (argc=2, argv=0x100b27c8) at test.c:23
==========================================================================
The same behavior, when calling Tcl_EvalFile() on an existent tcl file or
when executing the tcl command line `file normalize <path> ' with
Tcl_Eval().
Calling "file normalize <path> " or sourcing a tcl file from within a tclsh
there is no problem at all.
Calling other tcl functions or evaluating tcl code with Tcl_Eval like
`Tcl_Eval (interp, "puts \"hello world\"")'
or even
`Tcl_Eval (interp, "file native \"<path> \"")'
is executed correct and returns a correct result and the programm
terminates as expected without any error.
I have tested this in a production cygwin environment on Windows Server
2003 as well as in a maiden cygwin setup on Windows 2000 and faced the
same result (crash). Also a downgrade to cygwin package:
tcltk/tcltk-20030901-1 did not solve this.
Investigation in Mailing Lists, Usenet or Web did not light this
up. Nobody else seems to have this problem. :-/
Does anybody has any ideas?
Regards,
Alex
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Tcl-win mailing list
Tcl-win@[...].net
https://lists.sourceforge.net/lists/listinfo/tcl-win
|