Artifacts Associated With Ticket 219829ffffffffff
Ticket change [71d926d535] (rid 100750) by drh on 2000-10-31 02:17:44:
- assignee initialized to: "nobody"
- cmimetype initialized to: "text/plain"
- comment initialized to:
The command: puts [subst {[return {}; should be invisible]}] outputs nothing in Tcl8.0 as I would expect. But it outputs "should be invisible]" in 8.3.0 and in 8.4a2. In general, a "return" statement within [...] inside a subst causes the scanning of text inside the [...] to stop immediately, rather than continuing on to the closing ']'. I do not have a fix at this time. This comes up when using "subst" to embed TCL in web pages (for example in tclhttpd). The work- around is to do [if 1 {...}] in place of [...] - foundin initialized to: "obsolete: 8.4a2"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "drh"
- subsystem initialized to: "81. Bundled Packages"
- title initialized to: ""subst" processes "return" incorrectly"
- type initialized to: "Bug"
Ticket change [e04e1ecf01] (rid 115163) by hobbs on 2000-11-01 00:46:47:
- icomment:
This seems to have cropped up specifically in 8.2 somewhere. If I use 8.2b2, I get really weird results: % info patch 8.2b2 % subst {[return {}; should be invisible]} can't read "i": no such variable % subst {[return {}; should be invisible]} 1o_pa Whereas 8.2.3-8.4a has saner, but incorrect behavior: % info patch 8.2.3 % subst {[return {}; should be invisible]} should be invisible] - login: "hobbs"
- mimetype: "text/plain"
- priority changed to: "7 High"
- username: "hobbs"
- icomment:
Ticket change [7a6a54e3ec] (rid 90313) by hobbs on 2000-11-02 04:45:26:
- closedate changed to: "2000-11-01T21:45:26"
- closer changed to: "hobbs"
- icomment:
Fixed with the following patch. There was varying behavior from 7.6 to 8.2 that (in 8.0+) was all broken in one way or another. The following allows for the best effort, keeping close compatability with 7.6. cvs diff -bc generic/tclParse.c Index: generic/tclParse.c =================================================================== RCS file: /home/cvs/external/tcl/generic/tclParse.c,v retrieving revision 1.13 diff -b -c -r1.13 tclParse.c *** tclParse.c 1999/11/10 02:51:57 1.13 --- tclParse.c 2000/11/01 21:43:50 *************** *** 1456,1470 **** Tcl_DecrRefCount(objv[i]); } if (gotParse) { ! p = parse.commandStart + parse.commandSize; Tcl_FreeParse(&parse); ! if ((nested != 0) && (p > script) && (p[-1] == ']')) { /* * We get here in the special case where the TCL_BRACKET_TERM ! * flag was set in the interpreter and we reached a close ! * bracket in the script. Return immediately. */ iPtr->termOffset = (p - 1) - script; } else { iPtr->termOffset = p - script; --- 1456,1506 ---- Tcl_DecrRefCount(objv[i]); } if (gotParse) { ! next = parse.commandStart + parse.commandSize; ! bytesLeft -= next - p; ! p = next; Tcl_FreeParse(&parse); ! ! if ((nested != 0) && (p > script)) { ! char *nextCmd = NULL; /* pointer to start of next command */ ! /* * We get here in the special case where the TCL_BRACKET_TERM ! * flag was set in the interpreter. ! * ! * At this point, we want to find the end of the script ! * (either end of script or the closing ']'). ! */ ! ! while ((p[-1] != ']') && bytesLeft) { ! if (Tcl_ParseCommand(NULL, p, bytesLeft, nested, &parse) ! != TCL_OK) { ! /* ! * We were looking for the ']' to close the script. ! * But if we find a syntax error, it is ok to quit ! * early since in that case we no longer need to know ! * where the ']' is (if there was one). We reset the ! * pointer to the start of the command that after the ! * one causing the return. -- hobbs */ + p = (nextCmd == NULL) ? parse.commandStart : nextCmd; + break; + } + + if (nextCmd == NULL) { + nextCmd = parse.commandStart; + } + + /* + * Advance to the next command in the script. + */ + + next = parse.commandStart + parse.commandSize; + bytesLeft -= next - p; + p = next; + Tcl_FreeParse(&parse); + } iPtr->termOffset = (p - 1) - script; } else { iPtr->termOffset = p - script; - login: "hobbs"
- mimetype: "text/plain"
- resolution changed to: "Fixed"
- status changed to: "Closed"
- username: "hobbs"
Ticket change [63942b48a3] (rid 92601) by dgp on 2001-04-05 08:06:24:
- closedate changed to: "2001-04-05T01:06:24"
- closer changed to: "dgp"
- subsystem changed to: "45. Parsing and Eval"
- title changed to: ""subst" processes "return" incorrectly"