Attachment "2251175.patch" to
ticket [2251175fff]
added by
dgp
2008-12-02 05:35:22.
Index: generic/tclParse.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclParse.c,v
retrieving revision 1.62.2.1
diff -u -r1.62.2.1 tclParse.c
--- generic/tclParse.c 21 May 2008 20:38:09 -0000 1.62.2.1
+++ generic/tclParse.c 1 Dec 2008 22:34:15 -0000
@@ -435,7 +435,7 @@
}
if (isLiteral) {
- int elemCount = 0, code = TCL_OK;
+ int elemCount = 0, code = TCL_OK, nakedbs = 0;
const char *nextElem, *listEnd, *elemStart;
/*
@@ -457,21 +457,37 @@
*/
while (nextElem < listEnd) {
+ int size, brace;
+
code = TclFindElement(NULL, nextElem, listEnd - nextElem,
- &elemStart, &nextElem, NULL, NULL);
- if (code != TCL_OK) break;
+ &elemStart, &nextElem, &size, &brace);
+ if (code != TCL_OK) {
+ break;
+ }
+ if (!brace) {
+ const char *s;
+
+ for(s=elemStart;size>0;s++,size--) {
+ if ((*s)=='\\') {
+ nakedbs=1;
+ break;
+ }
+ }
+ }
if (elemStart < listEnd) {
elemCount++;
}
}
- if (code != TCL_OK) {
+ if ((code != TCL_OK) || nakedbs) {
/*
- * Some list element could not be parsed. This means the
- * literal string was not in fact a valid list. Defer the
- * handling of this to compile/eval time, where code is
- * already in place to report the "attempt to expand a
- * non-list" error.
+ * Some list element could not be parsed, or contained
+ * naked backslashes. This means the literal string was
+ * not in fact a valid nor canonical list. Defer the
+ * handling of this to compile/eval time, where code is
+ * already in place to report the "attempt to expand a
+ * non-list" error or expand lists that require
+ * substitution.
*/
tokenPtr->type = TCL_TOKEN_EXPAND_WORD;