info commands return value altered by execution of command inside a namespace 
Author Message
 info commands return value altered by execution of command inside a namespace

Tcl 8.0.3 Bug:  Generated by Scriptics' bug entry form at
        http://www.*-*-*.com/
Responses to this post are encouraged.
------

Submitted by:  Bruce Adams
OperatingSystem:  Windows NT
OperatingSystemVersion:  4.0 SP4
Synopsis:  info commands return value altered by execution of command inside a namespace

ReproducibleScript:
    proc putList { channel list { entryFormat "%s" } } {
       foreach item $list {
          puts $channel [ format $entryFormat $item ]
       }
    }
    # End Proc putList

    namespace eval fred {
    }

    puts "==========="

    rename info ::fred::info_builtin
    proc info { subcommand args } {
       return [ eval ::fred::info_builtin $subcommand $args ]
    }

    puts "BEFORE:"
    putList stdout "[ info commands inf* ]"

    proc info { subcommand args } {
    # each of the following has the same effect
        return [ eval namespace eval ::fred [ list info_builtin $subcommand
    $args ]
    #    return [ eval namespace eval ::fred [ list ::fred::info_builtin
    $subcommand $args ]
    #   return [ eval namespace inscope ::fred ::fred::info_builtin
    $subcommand $args ]
    }

    puts "AFTER:"
    putList stdout "[ info commands inf* ]"

    info_builtin

ObservedBehavior:
    info_builtin is wrongly reported as existing in the global namespace by
    [ info commands inf* ] when it does not exist.
    i.e.
       info
       info_builtin

DesiredBehavior:
    info commands inf*
    should only return "info"
    in the above script

Comments:
    This behaviour impacts the development of my introspection package which
    amongst other things extends the semantics of info, through redefining
    it and
    creating a wrapper.



Fri, 31 Aug 2001 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Execution traces on imported namespace commands

2. TIP #261: Return Imported Commands from [namespace import]

3. Return command inside a catch block?

4. namespace eval myspace { info commands }

5. getting the return value of a command executed on another host

6. Capturing return values from custom commands

7. EXPECT - getting the return value of diff command

8. exec question regarding returning the value of a command running in background

9. how to output commands and return values

10. Newbie Expect Question: where does Expect store values returned from an expect command

11. emacs and command return values

12. incorrect return value for "scan" command

 

 
Powered by phpBB® Forum Software