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
- assignee changed to: "nobody"
- cmimetype changed to: "text/plain"
- 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 - foundin changed to: "final: 8.1.1"
- priority changed to: "5 Medium"
- resolution changed to: "None"
- status changed to: "Open"
- submitter changed to: "nobody"
- subsystem changed to: "69. Other"
- title changed to: "http 2.0 package may pollute global namespace"
- type changed to: "Bug"