Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 7c97b998bbf5011300266dcf1d0fa095d9d2feb4
Ticket: 218956ffffffffffffffffffffffffffffffffff
http 2.0 package may pollute global namespace
User & Date: nobody on 2000-10-26 01:08:36
Changes

  1. assignee changed to: "nobody"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    OriginalBugID: 3174 Bug
    Version: 8.1.1
    SubmitDate: '1999-10-25'
    LastModified: '1999-10-29'
    Severity: MED
    Status: Released
    Submitter: techsupp
    ChangedBy: hobbs
    OS: Other
    OSVersion: FreeBSD 3.3-RELEASE
    Machine: NA
    FixedDate: '1999-10-29'
    FixedInVersion: 8.2.1
    ClosedDate: '2000-10-25'
    
    
    Name:
    John LoVerso
    
    Extensions:
    none
    
    CustomShell:
    none
    
    Comments:
    This is a trivial and obvious fix to (at least) LIB/http2.0/http.tcl
    
    ReproducibleScript:
    A well written package should not pollute the global namespace unless
        such global names are documented.
        
        Packages should not offer varing behavior given unrelated global names.
        
        Consider this example:
        
        #!/usr/local/bin/tclsh8.1
        package require http
        http::config
        puts $alphanumeric
        
        This results in the error:
        
        can't read "alphanumeric": no such variable
            while executing
        "puts $alphanumeric"
            (file "./x" line 5)
        
        Now consider this program, being that a program may have defined a
        particule global variable.  This is noting the general rule that "In Tcl
        8.x, the global namespace is the exclusive property of the application."
        (Rule 3 at http://www.cogent.net/~duquette/tcl/namespaces.html):
        
        #!/usr/local/bin/tclsh8.1
        set alphanumeric 0-9a-z
        package require http
        http::config
        puts $alphanumeric
        
        The result of running this program is startling:
        
        a-zA-Z0-9
    
    ObservedBehavior:
    Using ::http::config will overwrite the existing values of the global
        variables:
        
            alphanumeric, i, c
    
    DesiredBehavior:
    Packages (especially those distributed with Tcl) should be written to
        not pollute the global namespace.  They need to take care to use
        "variable" in each namespace eval section and must not use global
        variables as scratch registers.
    
    
    
    Already fixed in 8.2.1, please upgrade. 
    -- 10/29/1999 hobbs
    
  4. foundin changed to: "final: 8.1.1"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "nobody"
  9. subsystem changed to: "69. Other"
  10. title changed to: "http 2.0 package may pollute global namespace"
  11. type changed to: "Bug"