Overview
| Artifact ID: | b40b841d05514500762b3bf3fea963c3246bc8de68f80251a06a7540346bc5b9 |
|---|---|
| Ticket: | 775ee885603d3d09b5984b1579630e9786f78928
upvar (used with wrong level) causes a segfault |
| User & Date: | sebres on 2019-09-06 16:25:18 |
Changes
- icomment:
Furthermore I think TIP 515 has also some conceptual errors: It intends to write syntax error in case of: <pre> % apply {{} { uplevel 1 }} wrong # args: should be "uplevel ?level? command ?arg ...?" </pre> But would "fail" with bad level if given (or relative calculated as current - 1) levels are really wrong: <pre> % uplevel 1 bad level "1" % uplevel -1 bad level "-1" % uplevel {lappend error BOOM} bad level "lappend error BOOM" </pre> Just noone from that is level at all. I don't think it is possible to provide simple fix at all using current handling of <code>TclObjGetFrame</code>, either the return code (-1) should be rewritten to "negative is error", where -1 mean supplied level is wrong, -2 relative level is wrong (or supplied argument is not a level), and/or TclObjGetFrame should consider arguments count additionally (to bypass several cases of confusion level/body). I'd prefer totally without a TIP 515 as with implementation like this.<br/> Again, note the syntax of uplevel: <pre> uplevel ?level? command ?arg ...? </pre> It is pretty clear that the <code>command</code> (in opposite to <code>level</code>) is not optional, so in my opinion better to catch <code>invalid command "1"</code> instead of usage, as <code>bad level "body"</code> like now. - login: "sebres"
- mimetype: "text/x-fossil-wiki"