Skip to content
Tcl Source Code History Of Ticket a8579d906a28
Login

History Of Ticket a8579d906a28

Artifacts Associated With Ticket a8579d906a28

  1. Ticket change [8a0b568454] (rid 195878) by russell-tcl on 2021-10-06 21:57:42:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/plain"
    4. comment initialized to:
      The bug will probably not show up if the args list is 
      constructed in a single frame. The code below uses an 
      external proc to create each arg which are then lappended 
      to the final list used, with or without a default value. 
      
      The first version of tcl where this shows up is 8.6.9, 
      when the trampoline code started to be used. I've tested 
      every released version of tcl since, compiling from source.
      
      The error occurs in 8.6.9,10,11 8.7a5 and 9.0a3.
      The error does not occur in 8.6.8,7,6,5 8.5.19 or 8.4.20.
      
      The main platform is Ubuntu: uname -a
      5.11.0-37-generic #41-Ubuntu SMP x86_64 x86_64 x86_64 GNU/Linux
      
      I tried following the process with gdb/VS Code and in working and
      non-working versions, the objv bytes is 0x0 when the proc commands
      starts. 
      
      Here's what makes the bug go away:
      
      In the helper proc or in the main proc call:
      llength $argName on each arg.
      
      In the main proc:
      puts $argsList
      
      If you catch the error with proc, you can still make the bug
      go away using the above calls. If you just repeat the same call
      the bug is still there.
      
      I have not found a way to repeat the bug without a helper proc.
      
      Here's the simplified code which shows the bug:
      
      proc splitArg {argSpec {splitChar !} {ArrayName ""}} {
      
          set firstPart [lindex $argSpec 0]
          set first [string first $splitChar $firstPart]
      
          if {$first > -1} {
              set argName [string range $firstPart 0 [expr {$first - 1}]]
              set extra [string range $firstPart [expr {$first + 1}] end]
          }
          if {$ArrayName eq ""} {
              set ArrayName $argName 
          }
          upvar $ArrayName ArgNameArray 
      
          array set ArgNameArray [lindex $argSpec 1]
          return $argName
      }
      
      proc testProc {procName argSpecs body} {
      
          set argList [list] 
          foreach argSpec $argSpecs {
              if {[array exists specArray]} {
                  array unset specArray
              }
              set argName [splitArg $argSpec ! specArray]
              if {[info exists specArray(default)]} {
                  lappend argList [list $argName $specArray(default)]
              } else {
                  lappend argList [list $argName]
              }
      
          }
      
          proc $procName $argList $body
      }
      
      testProc myproc {{arg1!type1 {default "It Works, no bug in "}}}\
          {puts -nonewline $arg1;puts tcl[info patchlevel]}
      
      myproc
      
    5. foundin initialized to: "tcl8.6.9+"
    6. is_private initialized to: "0"
    7. login: "russell-tcl"
    8. priority initialized to: "5 Medium"
    9. private_contact initialized to: "746f77a74dfbfc2cb5ae42088bf5906fdc297916"
    10. resolution initialized to: "None"
    11. severity initialized to: "Important"
    12. status initialized to: "Open"
    13. submitter initialized to: "russell-tcl"
    14. subsystem initialized to: "18. Commands M-Z"
    15. title initialized to:
      'argument with no name' calling proc with args built in different frame
      
    16. type initialized to: "Bug"
  2. Ticket change [ae7f2aec32] (rid 195884) by dgp on 2021-10-07 20:25:55:

    1. assignee changed to: "pooryorick"
    2. icomment:
      
      Bisecting locates the behavior change of this script to
      
      https://core.tcl-lang.org/tcl/info/c9251294d9b8b14d
      
      Assigning for further review.
      
    3. login: "dgp"
    4. mimetype: "text/plain"
  3. Ticket change [91c0e89b2c] (rid 195945) by pooryorick on 2021-10-08 19:51:39:

    1. icomment:
      A more concise script to reproduce the issue is:
      
      <code><verbatim>
      proc p1 [list [list [expr {1 + 2}] default]] {}
      </verbatim></code>
      
      The issue is that to determine the length of the string,
      <code>TclCreateProc()</code> was only checking the size of any existing string
      repesentation of a value without taking into the consideration that the string
      representation might not be current.
      
      Fixed in [75a9777184741e05]
      
    2. login: "pooryorick"
    3. mimetype: "text/x-fossil-wiki"
    4. resolution changed to: "Fixed"
  4. Ticket change [70cd2487fe] (rid 195985) by jan.nijtmans on 2021-10-11 14:35:43:

    1. closedate changed to: "2459499.10814251"
    2. closer changed to: "jan.nijtmans"
    3. icomment: "Fix is now merged to 8.7 and 9.0 branches as well."
    4. login: "jan.nijtmans"
    5. mimetype: "text/x-fossil-wiki"
    6. status changed to: "Closed"