Skip to content
Tcl Source Code History Of Ticket 219215ffffffffff
Login

History Of Ticket 219215ffffffffff

Artifacts Associated With Ticket 219215ffffffffff

  1. Ticket change [fa77e1dacc] (rid 91881) by nobody on 2000-10-26 05:03:41:

    1. assignee initialized to: "nobody"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      OriginalBugID: 3863 Bug
      Version: 8.2.2
      SubmitDate: '1999-12-13'
      LastModified: '2000-04-03'
      Severity: MED
      Status: Assigned
      Submitter: techsupp
      ChangedBy: hobbs
      OS: Solaris
      OSVersion: 2.6
      Machine: Sparc 5
      FixedDate: '2000-10-25'
      ClosedDate: '2000-10-25'
      
      
      Name: John R. Jackson
      
      Comments:
      A word of advice (and maybe it will save you all the time it took me to figure out :-): if you run this
      under gdb, it messes with argv[0] and uses a full path which does not trip the bug. In that case,
      tweak the test case to pass an explicit value, e.g. "./bug".
      
      ReproducibleScript:
      Run the following example **exactly** like this against Tcl built with TCL_MEM_DEBUG:
      
        ./a.out /
      
      #include <unistd.h>
      #include <tcl.h>
      
      int
      main (argc, argv)
              int                     argc;
              char                    **argv;
      {
              if (argc > 1) {
                      (void) chdir(argv[1]);
              }
              Tcl_FindExecutable(argv[0]);
              return 0;
      }
      
      If the program is called without the ./ it works.
      If the program is called without arguments (so it does not chdir), it works.
      If the program is called with an argument other than /opt (e.g. /foozle), it works.
      
      ObservedBehavior:
      low guard byte 4 is 0xef         
      low guard byte 5 is 0xff         
      low guard byte 6 is 0xe7         
      low guard byte 7 is 0xe0         
      total mallocs                     34
      total frees                        1
      current packets allocated         33
      current bytes allocated         1483
      maximum packets allocated         33
      maximum bytes allocated         1483
      low guard failed at 230d0, ./../unix/tclUnixInit.c 327
      20 bytes allocated at (./../generic/tclFileName.c 381)
      Memory validation failure
      Abort
      
      DesiredBehavior:
      My application tries to cd to a "safe" place as soon as possible to protect any core files that are
      generated (not that my code would ever do that, of course :-), and this was done before the Tcl_FindExecutable call. After reading the man page again and stepping through the code to try
      and find the problem (but I got tired and gave up), I can see that I should probably call Tcl_FindExecutable immediately on entry, which is OK. But there is still pretty clearly something
      wrong in the guts of this thing -- it shouldn't trip a memory fault.
      
      
      
      Verified with 8.3.0.  You can work-around it with:
      
              if (argc > 1) {
                      (void) chdir(argv[1]);
                Tcl_FindExecutable(argv[1]);
              } else {
                Tcl_FindExecutable(argv[0]);
              }
              return 0;
      
      Or doing the FindExecutable first. 
      -- 04/03/2000 hobbs
      
    4. foundin initialized to: "obsolete: 8.2.2"
    5. priority initialized to: "5 Medium"
    6. resolution initialized to: "None"
    7. status initialized to: "Open"
    8. submitter initialized to: "nobody"
    9. subsystem initialized to: "69. Other"
    10. title initialized to: "Memory validation failure in Tcl_FindExecutable"
    11. type initialized to: "Bug"
  2. Ticket change [2972edeb9f] (rid 88872) by dkf on 2001-01-31 17:35:54:

    1. subsystem changed to: "38. Init - Library - Autoload"
  3. Ticket change [dc54e76137] (rid 114460) by dgp on 2001-02-08 13:55:51:

    1. subsystem changed to: "10. Objects"
  4. Ticket change [acc0b9a721] (rid 101346) by andreas_kupries on 2001-09-08 06:33:18:

    1. assignee changed to: "msofer"
  5. Ticket change [aeca9701cd] (rid 101699) by msofer on 2001-09-08 20:55:02:

    1. assignee changed to: "das"
    2. icomment:
      Logged In: YES 
      user_id=148712
      
      I could not find the memory error - and didn't even try to
      reproduce it. However, some remarks before passing to area
      maintainer:
      
      The wording in the docs of should be peremptory: DO NOT
      change the working directory before calling
      Tcl_FindExecutable!
      
      The code in unix/tclUnixFile.c (TclpFindExecutable) makes
      clear that whenever argv[0] contains "/", the executable
      name "found" will be rooted at the cwd *at the time of the
      call to TclpFindExecutable*. So, a wrong name will be
      returned ...
      
      Also, the algorithm of TclpFindExecutable may be improved;
      it sometimes reports "correct but very ugly" results, as
      shown in:
      
      [mig@mini generic]$ pwd
      /CVS/tcl_SF_clean/generic
      [mig@mini generic]$ ../unix/tclsh
      % info nameofexecutable
      /CVS/tcl_SF_clean/generic/../unix/tclsh
      
      
      
    3. login: "msofer"
    4. mimetype: "text/plain"
    5. subsystem changed to: "36. Pathname Management"
    6. username: "msofer"
  6. Ticket change [4ae953c0f6] (rid 126613) by msofer on 2001-09-10 03:15:05:

    1. icomment:
      Logged In: YES 
      user_id=148712
      
      That last comment about what TclpFindExecutable does
      contains a mistake, of course. It should be:
      
      The code in unix/tclUnixFile.c (TclpFindExecutable)
      makesclear that whenever argv[0] contains BUT DOES NOT START
      WITH "/", the executable name "found" will be rooted at the
      cwd *at the time of the call to TclpFindExecutable*. So, a
      wrong name will be returned ...
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  7. Ticket change [a011dd434c] (rid 96742) by das on 2001-09-22 12:54:36:

    1. assignee changed to: "vincentdarley"
    2. icomment:
      Logged In: YES 
      user_id=90580
      
      vince, can you take a look at this? not really my area of 
      expertise
      
      
      
    3. login: "das"
    4. mimetype: "text/plain"
    5. username: "das"
  8. Ticket change [074e9d103b] (rid 89374) by vincentdarley on 2001-09-24 17:27:17:

    1. assignee changed to: "dgp"
  9. Ticket change [10b7b799a6] (rid 95009) by vincentdarley on 2001-09-24 17:27:18:

    1. icomment:
      Logged In: YES 
      user_id=32170
      
      dgp's changes of 2001-01-04 may have fixed some issues here 
      (When the executable is
      installed in or near the root directory of the file 
      system,
      relative pathnames were being incorrectly 
      generated, and in
      the worst case, memory access violations were 
      crashing the program).
      
      
      In any case, we should definitely make sure the docs say 
      not to change the pwd before calling Tcl_FindExecutable.
      
      
      
    2. login: "vincentdarley"
    3. mimetype: "text/plain"
    4. username: "vincentdarley"
  10. Ticket change [fb3ab1f984] (rid 92016) by dgp on 2001-09-28 03:52:56:

    1. assignee changed to: "msofer"
    2. icomment:
      Logged In: YES 
      user_id=80530
      
      I agree.  This looks like a duplicate report
      of Bug 219416, which is fixed.
      
      The docs for Tcl_FindExecutable already say that
      it is "typically invoked as the very first thing
      in the applications main program; it must be
      passed argv[0] as its argument"
      
      Assigning to the Category and maintainers of 
      doc/FileExec.3 to determine if more clarification
      is needed and for closing.
      
      
    3. login: "dgp"
    4. mimetype: "text/plain"
    5. resolution changed to: "Duplicate"
    6. subsystem changed to: "10. Objects"
    7. username: "dgp"
  11. Ticket change [76d2305f7b] (rid 105648) by msofer on 2001-09-29 00:10:13:

    1. closedate changed to: "2001-09-28T17:10:13"
    2. closer changed to: "msofer"
    3. icomment:
      Logged In: YES 
      user_id=148712
      
      Edited the docs to warn not to change the working directory
      before calling.
      
      
    4. login: "msofer"
    5. mimetype: "text/plain"
    6. status changed to: "Closed"
    7. username: "msofer"