#2019 Tcl_FindExecutable documentation

obsolete: 8.4b2
closed-invalid
Don Porter
5
2002-09-04
2002-08-23
Anonymous
No

Using TCL dynamic library tcl84.dll in our process.
The current dir is d:\xyz\some\dir ; have tcl source
script there named "tclExtSource.tcl".

When called Tcl_EvalFile("tclExtSource.tcl");
it fails saying "couldn't read file "tclExtSource.tcl":
no such file or directory"

After investigation, it looks like there is bug in
following method in "tclWinFile.cpp"
int TclpObjNormalizePath(interp, pathPtr,
nextCheckpoint)
Tcl_Interp *interp;
Tcl_Obj *pathPtr;
int nextCheckpoint;
{
.....
}

Thanks.

-Prashant Hedaoo
phedaoo@iss.net

Discussion

1 2 > >> (Page 1 of 2)
  • Logged In: NO

    Please provide more detail on the "bug" you found in
    tclWinFile.c. In particular what were the inputs to the
    function, what were the results and how did those
    results differ from what you expected to see.

     
  • Vince Darley
    Vince Darley
    2002-08-28

    Logged In: YES
    user_id=32170

    Can't reproduce this without further information.

     
  • Vince Darley
    Vince Darley
    2002-08-28

    • status: open --> pending-works-for-me
     
  • Logged In: NO

    Test case:

    1. Create Test Tcl source sctipt ("tclTest.tcl") and put it in a dir "c:\some\dir"
    2. Create a program to use tcl84.dll (Beta 2) which calls Tcl_EvalFile( "tclTest.tcl") after changing current dir to
    "C:\some\dir"

    Actual result:

    Tcl_EvalFile(..) fails. If you furthur probe, the TclpObjNormalizePath(...) returns path "C:\tclTest.tcl" instead of
    "C:\some\dir\tclTest.tcl"

    -Prashant

     
  • Logged In: YES
    user_id=75003

    Step number 2 is the difficult one.
    Please provide your sources.
    Without these sources we might accidentially create an
    application which does not exhibit the problem.
    Maybe your application initialization is wrong or something
    which prevents the normalization code from working correctly.

    If your sources are to big, confidential, etc. reduce your code
    to a minimal example still exhibiting the problem and submit
    that.

    Is it possible for you to add your email address so that Vince
    can talk to you more directly ?

     
    • status: pending-works-for-me --> open-works-for-me
     
  • Logged In: NO

    I will try to get you source code for step 2.

    Additional info :

    Tcl_EvalFile() worked fine till TCL 8.4 (Alfa 4) release.
    Broke in TCL 8.4 (Beta 1 and 2)

    My email : phedaoo@iss.net

    -Prashant

     
  • 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
    phedaoo@iss.net

     
  • Vince Darley
    Vince Darley
    2002-09-02

    Logged In: YES
    user_id=32170

    As per the documentation, you need to call
    Tcl_FindExecutable first. None of the things you point
    out are bugs. sorry!

     
  • Vince Darley
    Vince Darley
    2002-09-02

    • status: open-works-for-me --> closed-invalid
     
1 2 > >> (Page 1 of 2)