Skip to content
Tcl Source Code History Of Ticket 1590483
Login

History Of Ticket 1590483

Artifacts Associated With Ticket 1590483

  1. Ticket change [76aeaf8319] (rid 105623) by msofer on 2006-11-04 14:08:29:

    1. assignee initialized to: "msofer"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      The idiom 
        uplevel 1 [info level 0]
      to cause a renewed call to the same proc can be broken
      by interp aliases:
      
       mig@ice:/tmp$ cat /tmp/test
       set res {}
       proc x {} {
          if {![llength $::res]} {
              set ::res [list [info level 0] :: [uplevel 1
      [info level 0]]]
          } else {
              return ::
          }
       }
       namespace eval a {
          proc x {} {return ::a}
       }
       interp alias {} y {} x
       namespace eval a y
       puts $res
      
       mig@ice:/tmp$ /home/CVS/tcl8.3.4/unix/tclsh test
       x :: ::a
      
      In order for it to break
       1. the alias target is not fully qualified
       2. the alias target is shadowed in the namespace from
      which the alias is invoked
      
      It is relatively easy to fix this: as interp aliases
      are always looked up in the global namespace anyway,
      the target could be fully qualified at alias creation
      time. This would also simplify TEOVI, allowing to
      remove all the namespace gymnastics performed by
      TCL_EVAL_INVOKE. The only change seen by current
      scripts would be in error traces, and in the actual
      return of [info level n] (now fully qualified).
      
    4. foundin initialized to: "obsolete: 8.4.15"
    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: "msofer"
    10. subsystem initialized to: "45. Parsing and Eval"
    11. title initialized to: "alias can break [uplevel 1 [info level 0]] idiom"
    12. type initialized to: "Bug"
  2. Ticket change [b7ba4f5b82] (rid 128848) by msofer on 2006-11-04 21:47:45:

    1. icomment:
      Logged In: YES 
      user_id=148712
      
      Mmhh ... no, the gymnastics are needed for unknown
      processing too; thank you parse-8.11 
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  3. Add attachment "alias-8.4.patch" [7b8e665a98] (rid 96930) by msofer on 2006-11-04 21:54:51.

  4. Ticket change [672da4ba22] (rid 102857) by msofer on 2006-11-04 21:54:51:

    1. icomment:
      
      
      File Added - 201382: alias-8.4.patch
      
      Logged In: YES 
      user_id=148712
      
      Attaching an 8.4 patch to make alias call its target with a
      fully qualified name. The patch almost applies to HEAD too
      (one failure in interp.test)
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  5. Ticket change [4dd107ea97] (rid 127119) by msofer on 2006-11-04 22:31:11:

    1. icomment:
      Logged In: YES 
      user_id=148712
      
      Doh ... infinite loop after the fix. Replace in the test code
      
      proc x {} {
          if {![llength $::res]} {
              set ::res [list [info level 0] ::]
              lappend ::res [uplevel 1 [info level 0]]
          } else {
              return ::
          }
      }
      
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  6. Ticket change [98cd95a539] (rid 148249) by dkf on 2016-07-24 18:12:01:

    1. assignee changed to: "dgp"
    2. closer changed to: "nobody"
    3. comment changed to:
      The idiom 
        uplevel 1 [info level 0]
      to cause a renewed call to the same proc can be broken
      by interp aliases:
      
       mig@ice:/tmp$ cat /tmp/test
       set res {}
       proc x {} {
          if {![llength $::res]} {
              set ::res [list [info level 0] :: [uplevel 1
      [info level 0]]]
          } else {
              return ::
          }
       }
       namespace eval a {
          proc x {} {return ::a}
       }
       interp alias {} y {} x
       namespace eval a y
       puts $res
      
       mig@ice:/tmp$ /home/CVS/tcl8.3.4/unix/tclsh test
       x :: ::a
      
      In order for it to break
       1. the alias target is not fully qualified
       2. the alias target is shadowed in the namespace from
      which the alias is invoked
      
      It is relatively easy to fix this: as interp aliases
      are always looked up in the global namespace anyway,
      the target could be fully qualified at alias creation
      time. This would also simplify TEOVI, allowing to
      remove all the namespace gymnastics performed by
      TCL_EVAL_INVOKE. The only change seen by current
      scripts would be in error traces, and in the actual
      return of [info level n] (now fully qualified).
      
    4. icomment:
      Do we really want to support this sort of thing by policy? And how does this interact with the rewrite stuff that's been worked on recently?
      
    5. login: "dkf"
    6. mimetype: "text/x-fossil-wiki"
    7. severity changed to: "Minor"
    8. username: "dkf"