|
2001-04-23
| ||
| 03:41 | • Ticket [218956ffff] http 2.0 package may pollute global namespace status sti... artifact: 83c47e7b8c user: dgp | |
| 03:41 | • Ticket [218956ffff]: 1 change artifact: 5eade0f22a user: dgp | |
|
2000-10-26
| ||
| 08:32 | • Deleted ticket [218956ffff]. artifact: 788b53cc4d user: welch | |
| 01:08 | • New ticket [218956ffff]. artifact: 7c97b998bb user: nobody | |
http 2.0 package may pollute global namespace
Deleted218956ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2000-10-26 01:08:36
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
welch Deleted ticket [218956ffff].
[History diff]2000-10-26 08:32:15
dgp Ticket [218956ffff]: 1 change
[History diff]2001-04-23 03:41:35
dgp Ticket [218956ffff]: 2 changes
[History diff]2001-04-23 03:41:36
Log in (anonymous is fine) to add a comment.