Skip to content
Tcl Source Code History Of Ticket 3480599fffffffff
Login

History Of Ticket 3480599fffffffff

Artifacts Associated With Ticket 3480599fffffffff

  1. Ticket change [6416a8ba78] (rid 92694) by bovineone on 2012-01-27 17:03:00:

    1. assignee initialized to: "dgp"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      pkg_mkIndex currently generates the pkgIndex.tcl containing multiple "list source" commands with each file as they were encountered in the filesystem directory, which will usually vary from one computer to the next.
      
      If multiple users are doing development on different directories/computers and committing work to a shared repository, the contents of the pkgIndex.tcl file will almost always be different and cause unnecessary file differences in pkgIndex.tcl.
      
      Besides the inconvenience of revision control detecting unnecessary file differences, the programmatic behavior could theoretically be different if the listed order of files is unpredictable and there are unintentional interactions between the files.  This might lead to difficulties in diagnosing due to the unpredictable file loading order.
      
      pkg_mkIndex should be changed to generate pkgIndex.tcl files that have a deterministic ordering that will be the same on different computers.  This could be done by simply sorting the list of filenames before writing them to the pkgIndex.tcl, if no other criteria is better suited for this.
      
    4. foundin initialized to: "obsolete: 8.5.11"
    5. is_private initialized to: "0"
    6. priority initialized to: "5 Medium"
    7. resolution initialized to: "None"
    8. status initialized to: "Open"
    9. submitter initialized to: "bovineone"
    10. subsystem initialized to: "39. Package Manager"
    11. title initialized to:
      pkg_mkIndex should generate deterministic pkgIndex.tcl order
      
    12. type initialized to: "Bug"
  2. Ticket change [c54f49a28e] (rid 111981) by dgp on 2012-01-28 00:35:04:

    1. icomment:
      My best advice is "Don't Do That".
      
      If your package is contained in multiple
      files for some reason, it's far better to make
      only one of them the master file to be [source]d to
      provide the package.  To bring the contents of
      the other files in, you can do something as simple
      as a [source] of them from the master file.  Or
      you can set up in the master file for the auto-loading
      of the other files as their contents are required.
      This is best done with your own loading-stubs of
      those commands, but you can also build on Tcl's
      tclIndex scheme if you prefer.  An example is the
      package "control" in tcllib.
      
      If you really do have a package made up of parts with
      order dependence, you really have no choice but to
      take one of those steps.  Even if pkg_mkIndex produced
      a deterministic order, there's no reason to believe it will
      pick the order needed by your code.
      
      If you have a package made up of parts that depend
      less on an explicit order, but on interdependency constraints,
      it may be that you actually have code that would be better
      represented as multiple packages, instead of one, using
      [package] to manage the dependency constraints.  In that situation,
      my preference is to install each package into its own directory with
      its own pkgIndex.tcl file.
      
      Once you've reduced the provide script of your package
      to the [source] of a single file, the contents of your
      pkgIndex.tcl likely are near as simple as:
      
      package ifneeded foo 1.0 [list source [file join $dir master.tcl]]
      
      At that point, my advice is not to use [pkg_mkIndex] at all.
      You can either hand-edit, or generate via much simpler tools.
      [pkg_mkIndex] is simply too ambitious and complex, and tries
      to take on problems that are simply unsolvable.  It's best abandoned.
      
      Another issue you might consider is that if your build is set up
      so that pkgIndex.tcl is a generated file, it arguably should not
      be checked into your version control system.
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  3. Ticket change [bee5189fbb] (rid 102166) by sebres on 2012-01-28 00:47:58:

    1. icomment:
      pkg_mkIndex in 8.5 currently generate "pkgIndex.tcl" already sorted by :
      ... lsort [array names files] ...
      
      perhaps, did you mean "auto_mkindex" to generate "tclIndex"?
      This routine does not do (sort) this at the moment.
      
      I have another solution, that in addition to sorting, accelerates auto loading and load the memory gently, example:
      
      -----------------------------
      ORG:
      -----------------------------
      ....
      set auto_index(::safe::DeleteHookName) [list source [file join $dir safe.tcl]]
      set auto_index(::safe::TranslatePath) [list source [file join $dir safe.tcl]]
      set auto_index(::safe::Log) [list source [file join $dir safe.tcl]]
      set auto_index(::safe::CheckFileName) [list source [file join $dir safe.tcl]]
      set auto_index(::safe::AliasSource) [list source [file join $dir safe.tcl]]
      set auto_index(::safe::AliasLoad) [list source [file join $dir safe.tcl]]
      set auto_index(::safe::FileInAccessPath) [list source [file join $dir safe.tcl]]
      set auto_index(::safe::Subset) [list source [file join $dir safe.tcl]]
      set auto_index(::safe::AliasSubset) [list source [file join $dir safe.tcl]]
      set auto_index(::safe::AliasEncoding) [list source [file join $dir safe.tcl]]
      ....
      set auto_index(::tcl::tm::add) [list source [file join $dir tm.tcl]]
      set auto_index(::tcl::tm::remove) [list source [file join $dir tm.tcl]]
      set auto_index(::tcl::tm::list) [list source [file join $dir tm.tcl]]
      set auto_index(::tcl::tm::UnknownHandler) [list source [file join $dir tm.tcl]]
      set auto_index(::tcl::tm::roots) [list source [file join $dir tm.tcl]]
      set auto_index(::tcl::tm::path) [list source [file join $dir tm.tcl]]
      ....
      set auto_index(::itclTestClass) [list source [file join $dir testing.itcl]]
      ....
      set auto_index(::itclTestClass::proc1) [list source [file join $dir testing.itcl]]
      set auto_index(::itclTestClass::proc2) [list source [file join $dir testing.itcl]]
      set auto_index(::itclTestClass::proc3) [list source [file join $dir testing.itcl]]
      ....
      -----------------------------
      NEW:
      -----------------------------
      set auto_index(::safe::*) [list source [file join $dir safe.tcl]]
      ....
      set auto_index(::tcl::tm::*) [list source [file join $dir tm.tcl]]
      ....
      set auto_index(::itclTestClass) [list source [file join $dir testing.itcl]]
      set auto_index(::itclTestClass::*) [list source [file join $dir testing.itcl]]
      -----------------------------
      
      If someone is interested, I can upload a patch for this.
      
      
      
    2. login: "sebres"
    3. mimetype: "text/plain"
    4. username: "sebres"
  4. Ticket change [1f17230645] (rid 91085) by bovineone on 2012-01-28 01:02:13:

    1. icomment:
      I am referring to running pkg_mkIndex in this manner with tcl 8.5.10, which does not seem to generate a tclIndex.tcl file that is sorted in any deterministic way:
      
      echo "pkg_mkIndex -- ." | $(TCLSH)
      
      I agree that you should not intentionally introduce ordering dependencies within files in a single package, but it sometimes happens unintentionally and it would be nice to have predictable behavior.  (ie: redefining a proc or a variable in two files and getting different definitions depending on which file is loaded first by different users.)  Having deterministic behavior is generally a desirable feature of software, and arguing to support the opposite is highly irregular and unparliamentary.
      
      
    2. login: "bovineone"
    3. mimetype: "text/plain"
    4. username: "bovineone"
  5. Ticket change [d5d575ff4e] (rid 123700) by dgp on 2012-01-28 01:26:36:

    1. icomment:
      I'm not really arguing to support arbitrary over deterministic.
      
      I'm arguing that [pkg_mkIndex] is a tool better abandoned
      than repaired.
      
      That said, this seems like a simple enough change.  Looking
      into generation of a quick patch... unless you already have one?
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  6. Ticket change [8670e32b71] (rid 131509) by dgp on 2012-01-28 01:39:54:

    1. icomment:
      
      Patch for review and testing:
      
      http://core.tcl.tk/tcl/info/1da688ab14
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  7. Ticket change [e5024d1183] (rid 88053) by bovineone on 2012-01-28 01:40:13:

    1. icomment:
      Here is a patch I just made:
      
      diff --git a/library/package.tcl b/library/package.tcl
      index 0a1e7bd..c61052d 100644
      --- a/library/package.tcl
      +++ b/library/package.tcl
      @@ -401,7 +401,7 @@ proc pkg_mkIndex {args} {
           break
       }
       lappend cmd ::tcl::Pkg::Create -name $name -version $version
      -foreach spec $files($pkg) {
      +foreach spec [lsort -index 0 $files($pkg)] {
           foreach {file type procs} $spec {
       if {$direct} {
           set procs {}
      
      
      
    2. login: "bovineone"
    3. mimetype: "text/plain"
    4. username: "bovineone"
  8. Ticket change [e685d7a188] (rid 104304) by bovineone on 2012-01-28 01:41:51:

    1. icomment:
      Your patch looks identical to mine :)  That indeed corrects the issue in my testing.
      
      
    2. login: "bovineone"
    3. mimetype: "text/plain"
    4. username: "bovineone"
  9. Ticket change [3dbebfbe0b] (rid 121143) by dgp on 2012-01-28 01:46:51:

    1. closedate changed to: "2012-01-27T18:46:51"
    2. closer changed to: "dgp"
    3. icomment:
      
      
      allow_comments - 1
      
      Applied for 8.5.12 and 8.6b3.
      
      
    4. login: "dgp"
    5. mimetype: "text/plain"
    6. resolution changed to: "Accepted"
    7. status changed to: "Closed"
    8. username: "dgp"