summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2008-05-21 20:28:12 (GMT)
committerdgp <dgp@users.sourceforge.net>2008-05-21 20:28:12 (GMT)
commitf2de8e1838fd8e298098915a1fc9292b01af59a5 (patch)
treeb351f874a6a36f55d1fe282b740f94088ed84169
parenta1ca307c098bd1b12e73b18eb500707296e084ca (diff)
downloadtcl-f2de8e1838fd8e298098915a1fc9292b01af59a5.zip
tcl-f2de8e1838fd8e298098915a1fc9292b01af59a5.tar.gz
tcl-f2de8e1838fd8e298098915a1fc9292b01af59a5.tar.bz2
* generic/tclParse.c (ParseComment): The new TclParseAllWhiteSpace()
* tests/parse.test (parse-15.60): routine has no mechanism to return the "incomplete" status of "\\\n" so calling this routine anywhere that can be reached within a Tcl_ParseCommand() call is a mistake. In particular, ParseComment() must not use it. [Bug 1968882].
-rw-r--r--ChangeLog8
-rw-r--r--generic/tclParse.c11
-rw-r--r--tests/parse.test6
3 files changed, 20 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 7820292..a8da0e6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2008-05-21 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tclParse.c (ParseComment): The new TclParseAllWhiteSpace()
+ * tests/parse.test (parse-15.60): routine has no mechanism to
+ return the "incomplete" status of "\\\n" so calling this routine
+ anywhere that can be reached within a Tcl_ParseCommand() call is a
+ mistake. In particular, ParseComment() must not use it. [Bug 1968882].
+
2008-05-20 Donal K. Fellows <dkf@users.sf.net>
* generic/tclNamesp.c (Tcl_SetNamespaceUnknownHandler): Corrected odd
diff --git a/generic/tclParse.c b/generic/tclParse.c
index b4b872d..620f54e 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.63 2008/04/27 22:21:31 dkf Exp $
+ * RCS: @(#) $Id: tclParse.c,v 1.64 2008/05/21 20:28:14 dgp Exp $
*/
#include "tclInt.h"
@@ -954,9 +954,12 @@ ParseComment(
char type;
int scanned;
- scanned = TclParseAllWhiteSpace(p, numBytes);
- p += scanned;
- numBytes -= scanned;
+ do {
+ scanned = ParseWhiteSpace(p, numBytes,
+ &parsePtr->incomplete, &type);
+ p += scanned;
+ numBytes -= scanned;
+ } while (numBytes && (*p == '\n') && (p++,numBytes--));
if ((numBytes == 0) || (*p != '#')) {
break;
diff --git a/tests/parse.test b/tests/parse.test
index 5becb4c..e978907 100644
--- a/tests/parse.test
+++ b/tests/parse.test
@@ -8,7 +8,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: parse.test,v 1.30 2007/12/13 15:26:07 dgp Exp $
+# RCS: @(#) $Id: parse.test,v 1.31 2008/05/21 20:28:15 dgp Exp $
if {[catch {package require tcltest 2.0.2}]} {
puts stderr "Skipping tests in [info script]. tcltest 2.0.2 required."
@@ -884,6 +884,10 @@ test parse-15.59 {CommandComplete procedure} {
# Test for Tcl Bug 684744
info complete [encoding convertfrom identity "\x00;if 1 \{"]
} 0
+test parse-15.60 {CommandComplete procedure} {
+ # Test for Tcl Bug 1968882
+ info complete \\\n
+} 0
test parse-16.1 {Tcl_EvalEx, check termOffset is set correctly for non TCL_OK cases, bug 2535} {
subst {[eval {return foo}]bar}