From e26a569c68c90ec0011ec6b4e464fb77c78b7d89 Mon Sep 17 00:00:00 2001 From: dkf Date: Wed, 19 Nov 2003 22:04:38 +0000 Subject: Fixed Bug 845412; long commands without expansion don't get tangled with the expansion machinery now... --- ChangeLog | 7 +++++++ generic/tclCompile.c | 4 ++-- tests/compile.test | 9 ++++++++- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 90cc59f..283b93b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2003-11-19 Donal K. Fellows + + * generic/tclCompile.c (TclCompileScript): Added a guard for the + expansion code so that long non-expanding commands don't get + expansion infrastructure inserted in them, especially when that + infrastructure isn't initialised. + 2003-11-18 David Gravereaux * contrib/djgpp/Makefile: Changes from Victor Wagner diff --git a/generic/tclCompile.c b/generic/tclCompile.c index d687fbe..0514838 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCompile.c,v 1.53 2003/11/17 15:23:10 dgp Exp $ + * RCS: @(#) $Id: tclCompile.c,v 1.54 2003/11/19 22:04:39 dkf Exp $ */ #include "tclInt.h" @@ -923,7 +923,7 @@ TclCompileScript(interp, script, numBytes, envPtr) wordIdx < parse.numWords; delta++, wordIdx++, tokenPtr += (tokenPtr->numComponents + 1)) { - if ((delta == 255) + if (expand && (delta == 255) && (tokenPtr->type != TCL_TOKEN_EXPAND_WORD)) { /* * Push an empty list for expansion so our delta diff --git a/tests/compile.test b/tests/compile.test index 1fb445c..809c69a 100644 --- a/tests/compile.test +++ b/tests/compile.test @@ -11,7 +11,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: compile.test,v 1.28 2003/11/14 20:44:46 dgp Exp $ +# RCS: @(#) $Id: compile.test,v 1.29 2003/11/19 22:04:39 dkf Exp $ package require tcltest 2 namespace import -force ::tcltest::* @@ -503,6 +503,13 @@ test compile-16.21.$noComp {TclCompileScript: word expansion} -body { rename LongList {} } -returnCodes ok -result [expr {wide(1)<<32}] +test compile-16.22.$noComp {TclCompileScript: word expansion not mandatory} -body { + proc ReturnResults args {return $args} + if 1 "ReturnResults [string repeat {x } 260]" +} -constraints $constraints -cleanup { + rename ReturnResults {} +} -returnCodes ok -result [string trim [string repeat {x } 260]] + } ;# End of noComp loop # cleanup -- cgit v0.12