summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--generic/tclParse.c36
2 files changed, 30 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index ae75031..f34a79a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2008-12-01 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tclParse.c: Backport fix for [Bug 2251175].
+
2008-11-30 Kevin B. Kenny <kennykb@acm.org>
* library/clock.tcl (format, ParseClockScanFormat): Added a
diff --git a/generic/tclParse.c b/generic/tclParse.c
index 3197ac8..769be99 100644
--- a/generic/tclParse.c
+++ b/generic/tclParse.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclParse.c,v 1.62.2.1 2008/05/21 20:38:09 dgp Exp $
+ * RCS: @(#) $Id: tclParse.c,v 1.62.2.2 2008/12/01 22:39:59 dgp Exp $
*/
#include "tclInt.h"
@@ -435,7 +435,7 @@ Tcl_ParseCommand(
}
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 @@ Tcl_ParseCommand(
*/
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;