From 158d77b8cba72fb076672d1e53581c432eeb517c Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 24 Nov 2003 19:06:07 +0000 Subject: * generic/tclParse.c: Corrected faulty check for trailing white space in {expand} parsing. Thanks Andreas Leitgeb. [Bug 848262]. * tests/parse.test: New tests for the bug. --- ChangeLog | 6 ++++++ generic/tclParse.c | 6 ++++-- tests/parse.test | 13 ++++++++++++- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index de404f2..116524f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2003-11-24 Don Porter + + * generic/tclParse.c: Corrected faulty check for trailing white + space in {expand} parsing. Thanks Andreas Leitgeb. [Bug 848262]. + * tests/parse.test: New tests for the bug. + 2003-11-24 Vince Darley * generic/tclPathObj.c: fix to [Bug 845778] - Infinite recursion diff --git a/generic/tclParse.c b/generic/tclParse.c index e86a7d4..2923642 100644 --- a/generic/tclParse.c +++ b/generic/tclParse.c @@ -13,7 +13,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.30 2003/11/15 03:19:17 dgp Exp $ + * RCS: @(#) $Id: tclParse.c,v 1.31 2003/11/24 19:06:08 dgp Exp $ */ #include "tclInt.h" @@ -360,7 +360,9 @@ parseWord: && (0 == strncmp(expPfx,expPtr->start,expPfxLen)) /* Is the prefix */ && (numBytes > 0) - && (0 == TclParseWhiteSpace(termPtr, 1, parsePtr, &type)) + && (TclParseWhiteSpace(termPtr, numBytes, parsePtr, &type) + == 0) + && (type != TYPE_COMMAND_END) /* Non-whitespace follows */ ) { expandWord = 1; diff --git a/tests/parse.test b/tests/parse.test index 3a83af1..2ae8152 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.17 2003/11/14 20:44:46 dgp Exp $ +# RCS: @(#) $Id: parse.test,v 1.18 2003/11/24 19:06:08 dgp Exp $ if {[catch {package require tcltest 2.0.2}]} { puts stderr "Skipping tests in [info script]. tcltest 2.0.2 required." @@ -215,6 +215,17 @@ test parse-5.23 {Tcl_ParseCommand: {expand} parsing} testparser { test parse-5.24 {Tcl_ParseCommand: {expand} parsing} testparser { testparser {{expand}x} 0 } {- {{expand}x} 1 expand {{expand}x} 1 text x 0 {}} +test parse-5.25 {Tcl_ParseCommand: {expand} parsing} testparser { + testparser {{expand} +} 0 +} {- {{expand} +} 1 simple {{expand}} 1 text expand 0 {}} +test parse-5.26 {Tcl_ParseCommand: {expand} parsing} testparser { + testparser {{expand};} 0 +} {- {{expand};} 1 simple {{expand}} 1 text expand 0 {}} +test parse-5.27 {Tcl_ParseCommand: {expand} parsing} testparser { + testparser "{expand}\\\n foo bar" 0 +} {- \{expand\}\\\n\ foo\ bar 3 simple {{expand}} 1 text expand 0 simple foo 1 text foo 0 simple bar 1 text bar 0 {}} test parse-6.1 {ParseTokens procedure, empty word} testparser { testparser {""} 0 -- cgit v0.12