Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: bd5e1fa57b58b31d565a234beaba6dead0e9ef9d
Ticket: 599376ffffffffffffffffffffffffffffffffff
Tcl_FindExecutable documentation
User & Date: nobody on 2002-08-31 07:12:59
Changes

  1. icomment:
    Logged In: NO 
    
    Test case setup..............
    
    Prerequisite for building tcl84.lib and tcl84.dll binaries.
    Otherwise, program crashes due to NULL function pointer. Another bug in TCL code.
    
    1. Replace line# 86 -> NULL, by following line in ...\win\tclWin32Dll.cpp
        (BOOL (WINAPI *)(CONST TCHAR *, GET_FILEEX_INFO_LEVELS, LPVOID)) GetFileAttributesExA,
    
    2. Replace line# 125 -> NULL, by following line in ...\win\tclWin32Dll.cpp
        (BOOL (WINAPI *)(CONST TCHAR *, GET_FILEEX_INFO_LEVELS, LPVOID)) GetFileAttributesExW,
    
    3. Build TCL lib binaries.
    
    
    Test program begins here 
    --------------------------------------BEGIN----------------------------------
    // TclTest.cpp : Test program to demonstrate the Tcl_EvalFile() bug.
    //
    #include "stdafx.h"
    #include "direct.h"
    #include <tcl.h>
    #define SCTIPT_FILE"tclTest.tcl"
    #define SCTIPT_DIR"c:\\some\\dir"
    #define SCTIPT_FPATH"c:\\some\\dir\\tclTest.tcl"
    
    int main(int argc, char* argv[])
    {
    Tcl_Interp*interp = Tcl_CreateInterp();
    if (!interp) {
    fprintf(stderr, "Tcl_CreateInterp failed\n"); return 1;
    }
    if(chdir(SCTIPT_DIR)) {
    fprintf(stderr, "chdir failed\n"); return 2;
    }
    //////////////// Tcl_EvalFile() fails.......
    if (Tcl_EvalFile(interp, SCTIPT_FILE) != TCL_OK) {
    fprintf(stderr, "1: Tcl_EvalFile failed\n\tERROR: %s\n", interp->result);
    }
    //////////////// Tcl_EvalFile() fails.......here too!!!!!
    if (Tcl_EvalFile(interp, SCTIPT_FPATH) != TCL_OK) {
    fprintf(stderr, "2: Tcl_EvalFile failed\n\tERROR: %s\n", interp->result);
    }
    Tcl_DeleteInterp(interp);
    return 0;
    }
    --------------------------------------END----------------------------------
    
    Output of the test program :
    ----------------------------BEGIN OUTPUT---------------------------
    1: Tcl_EvalFile failed
            ERROR: couldn't read file "tclTest.tcl": no such file or directory
    2: Tcl_EvalFile failed
            ERROR: couldn't read file "c:\some\dir\tclTest.tcl": permission denied
    ----------------------------------END OUTPUT------------------------
    
    Step through the Tcl_EvalFile() call .......see following stack....
    
    TclpObjNormalizePath(Tcl_Interp * 0x00000000, Tcl_Obj * 0x007d7198, int 0x00000000) line 1997
    TclNormalizeToUniquePath(Tcl_Interp * 0x00000000, Tcl_Obj * 0x007d7198) line 1086 + 15 bytes
    FSNormalizeAbsolutePath(Tcl_Interp * 0x00000000, Tcl_Obj * 0x007d7228) line 1008 + 13 bytes
    Tcl_FSGetCwd(Tcl_Interp * 0x00000000) line 2025 + 13 bytes
    Tcl_FSGetNormalizedPath(Tcl_Interp * 0x00000000, Tcl_Obj * 0x007d7270) line 4293 + 9 bytes
    Tcl_FSGetFileSystemForPath(Tcl_Obj * 0x007d7270) line 4846 + 11 bytes
    Tcl_FSStat(Tcl_Obj * 0x007d7270, _stati64 * 0x0012febc) line 1554 + 9 bytes
    Tcl_FSEvalFile(Tcl_Interp * 0x007e1100, Tcl_Obj * 0x007d7270) line 1334 + 13 bytes
    Tcl_EvalFile(Tcl_Interp * 0x007e1100, const char * 0x00420090 ??_C@_0M@OJLM@tclTest?4tcl?$AA@) line 234 
    + 13 bytes
    main(int 0x00000001, char * * 0x00900e90) line 26 + 17 bytes
    mainCRTStartup() line 206 + 25 bytes
    KERNEL32! GetProcessPriorityBoost + 279 bytes
    ----------------END STACK TRACE------------
    
    The TclpObjNormalizePath(interp, pathPtr, nextCheckpoint) is entered with pathPtr= Tcl_Obj("c:/some/dir")
    and nextCheckpoint= 0.
    
    This function is broke.... it returns "<drive>:/" (eg."C:/") for whatever dir path is passed to it.
    
    Thanks for your support.
    
    -Prashant
    [email protected]
    
    
  2. login: "nobody"
  3. mimetype: "text/plain"
  4. username: "nobody"