|
2009-04-20
| ||
| 00:27 | • Closed ticket [2774581fff]: cross-interp alias uplevel behaviour plus 7 othe... artifact: ee054cb9c0 user: msofer | |
|
2009-04-19
| ||
| 16:55 | • New ticket [2774581fff]. artifact: 89f7b1b06a user: cnassau | |
cross-interp alias uplevel behaviour
Closed / Rejected2774581fffffffffffffffffffffffffffffffffCreated 18 years agoUpdated 18 years ago
Descriptionplain2009-04-19 16:55:51
The following doesn't feel right:
interp create other
other eval {
proc myforeach {var script} {
upvar 1 $var v
foreach v {1 2 3} {
uplevel 1 $script
}
}
set myvar myvar-remote
myforeach stuff {
puts remote,$myvar,$stuff
}
}
interp alias {} myforeach other myforeach
set myvar myvar-main
myforeach stuff {
puts main,$myvar,$stuff
}
The output is
remote,myvar-remote,1
remote,myvar-remote,2
remote,myvar-remote,3
main,myvar-remote,1
main,myvar-remote,2
main,myvar-remote,3
Here $myvar is taken from interpreter "other" in both cases: I would have expected "main,myvar-main,1..3" in the second three lines.
msoferplain2009-04-20 00:27:57
This is an isolation/security feature, not a bug: slave interps DO NOT HAVE ACCESS to their parent's vars or commands, except when explicitly authorized. Interps are strongly isolated from each other by design. Think of what would happen if you allowed the slave to access the master's var and, say, put a trace on it. With this mechanism it could set up some kind of "trojan code" in the master. If you think that we can improve the docs to make this more explicit, please reopen the bug with your suggestions.
Log in (anonymous is fine) to add a comment.