Skip to content
Tcl Source Code History Of Ticket 218894
Login

History Of Ticket 218894

Artifacts Associated With Ticket 218894

  1. Ticket change [5ecebf996d] (rid 115693) by nobody on 2000-10-26 01:07:19:

    1. assignee initialized to: "nobody"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      OriginalBugID: 2570 Bug
      Version: 8.1
      SubmitDate: '1999-08-18'
      LastModified: '2000-03-06'
      Severity: SER
      Status: Released
      Submitter: techsupp
      ChangedBy: ericm
      OS: Windows 95
      Machine: X86
      FixedDate: '2000-03-06'
      FixedInVersion: 8.3.1
      ClosedDate: '2000-10-25'
      
      
      Name:
      Chengye Mao
      
      Extensions:
      xbit81.dll version 1.0
      
      Comments:
      Summary: 
          1) varible tcl_pkgPath is missing.
          2) Either pkg_mkIndex procedure or some Tk code need to modified. A
          modification of pkg_mkIndex is provided and it works fine.
      
      ReproducibleScript:
      I was using wish81 at a Windows 95 platform and
          trying to install a xbit package by using the following script:
      
          pkg_mkIndex [pwd] xbit81.dll
      
      ObservedBehavior:
      The wish81 application crashed.
      
      DesiredBehavior:
      I have done the package installation for wish42 and wish80 with
          successes.
          There are no problems in loading xbit81.dll. I expected no problems in
          package 
          installation for wish81. I also expected the Tcl variable tcl_pkgPath to
          contain the path of the package directory, but could not find it. The
          variable tcl_pkgPath is missing in wish81!
      
      Patch:
      I traced the bug into some xbit81.dll's C code that try to access the window's information. The crash was caused by these code such as 
          Tk_MakeWindowExist(tkwin);
          scrnNumber = Tk_ScreenNumber(tkwin);
          disp = Tk_Display(tkwin);
          scrnPtr = Tk_Screen(tkwin);
          cmap = Tk_Colormap(tkwin);
          depth = Tk_Depth(tkwin);
      indicating an invalid structure was accessed to by these code.
      
      I then traced the script of pkg_mkIndex and found that the problem was due to
      loading Tk package with a geometry +0+0, which causes invalid window structure.
      Please see my comments in the following fixed scripts:
      
      proc pkg_mkIndex {dir args} {
          global errorCode errorInfo
          append index "# Tcl package index file, version 1.0\n"
          append index "# This file is generated by the \"pkg_mkIndex\" command\n"
          append index "# and sourced either when an application starts up or\n"
          append index "# by a \"package unknown\" script.  It invokes the\n"
          append index "# \"package ifneeded\" command to set up package-related\n"
          append index "# information so that packages will be loaded automatically\n"
          append index "# in response to \"package require\" commands.  When this\n"
          append index "# script is sourced, the variable \$dir must contain the\n"
          append index "# full path name of this file's directory.\n"
          set oldDir [pwd]
          cd $dir
          foreach file [eval glob $args] {
      # For each file, figure out what commands and packages it provides.
      # To do this, create a child interpreter, load the file into the
      # interpreter, and get a list of the new commands and packages
      # that are defined.  Define an empty "package unknown" script so
      # that there are no recursive package inclusions.
      
      set c [interp create]
      
      # If Tk is loaded in the parent interpreter, load it into the
      # child also, in case the extension depends on it.
      
      foreach pkg [info loaded] {
          if {[lindex $pkg 1] == "Tk"} {
      #
      # Comment of Chengye Mao
      # The following script causes crash in making package of xbit81.dll
      # pkg_mkIndex worked fine after it was commented out.
      #                $c eval {set argv {-geometry +0+0}}
      
      load [lindex $pkg 0] Tk $c
      #
      # Comment of Chengye Mao
      # The following line was added to void side-effect of showing a main window
      # during making a pkgIndex.tcl with pkg_mkIndex
      #
                      $c eval wm withdraw .
      break
          }
      }
      $c eval [list set file $file]
      if [catch {
          $c eval {
      proc dummy args {}
      package unknown dummy
      set origCmds [info commands]
      set dir "";# in case file is pkgIndex.tcl
      set pkgs ""
      
      # Try to load the file if it has the shared library extension,
      # otherwise source it.  It's important not to try to load
      # files that aren't shared libraries, because on some systems
      # (like SunOS) the loader will abort the whole application
      # when it gets an error.
      
      if {[string compare [file extension $file]  [info sharedlibextension]] == 0} {
      
          # The "file join ." command below is necessary.  Without
          # it, if the file name has no \'s and we're on UNIX, the
          # load command will invoke the LD_LIBRARY_PATH search
          # mechanism, which could cause the wrong file to be used.
      
          load [file join . $file]
          set type load
      } else {
          source $file
          set type source
      }
      foreach i [info commands] {
          set cmds($i) 1
      }
      foreach i $origCmds {
          catch {unset cmds($i)}
      }
      foreach i [package names] {
          if {([string compare [package provide $i] ""] != 0)
          && ([string compare $i Tcl] != 0)
          && ([string compare $i Tk] != 0)} {
      lappend pkgs [list $i [package provide $i]]
          }
      }
          }
      } msg] {
          puts "error while loading or sourcing $file: $msg"
      }
      
      foreach pkg [$c eval set pkgs] {
          lappend files($pkg) [list $file [$c eval set type]  [lsort [$c eval array names cmds]]]
      }
      interp delete $c
          }
          foreach pkg [lsort [array names files]] {
      append index "\npackage ifneeded $pkg \[list tclPkgSetup \$dir [lrange $pkg 0 0] [lrange $pkg 1 1] [list $files($pkg)]\]"
          }
          set f [open pkgIndex.tcl w]
          puts $f $index
          close $f
          cd $oldDir
      }
      
      PatchFiles:
      The effected file: ../lib/tcl8.1/init.tcl
      
      
      
      tcl_pkgPath is not used on Windows, thus its absence.  I applied your patch, with slight modification to account for source changes between 8.1 and 8.3.  The fix will go out with 8.3.1.
      
      - eric
      
      -- 03/06/2000 ericm
      
      
      
    4. foundin initialized to: "obsolete: 8.1"
    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: "56. LibTomMath"
    10. title initialized to: "pkg_mkIndex [pwd] xbit81.dll"
    11. type initialized to: "Bug"
  2. Ticket change [0a14baa6c4] (rid 113756) by welch on 2000-10-26 08:31:15:

    1. closedate changed to: "2000-10-26T01:31:15"
    2. closer changed to: "welch"
    3. priority changed to: "2"
    4. resolution changed to: "Fixed"
    5. status changed to: "Closed"
  3. Ticket change [92d3810f66] (rid 120842) by dgp on 2001-04-06 02:05:06:

    1. closedate changed to: "2001-04-05T19:05:06"
    2. closer changed to: "dgp"
    3. subsystem changed to: "39. Package Manager"