From b8250fee59da71021aa11343910dd4eb0594f003 Mon Sep 17 00:00:00 2001 From: Miguel Sofer Date: Thu, 5 Oct 2006 11:44:02 +0000 Subject: * generic/tclVar.c (Tcl_LappendObjCmd): * tests/append.test(4.21-22): fix for longstanding [Bug 1570718], lappending nothing to non-list. Reported by lvirden --- ChangeLog | 6 ++++++ generic/tclVar.c | 11 +++++++++-- tests/append.test | 11 ++++++++++- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 010925f..2d70cc1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-10-05 Miguel Sofer + + * generic/tclVar.c (Tcl_LappendObjCmd): + * tests/append.test(4.21-22): fix for longstanding [Bug 1570718], + lappending nothing to non-list. Reported by lvirden + 2006-10-02 Don Porter * generic/tclFileName.c (TclGlob): Prevent doubling of directory diff --git a/generic/tclVar.c b/generic/tclVar.c index c926e4e..c0dfdc3 100644 --- a/generic/tclVar.c +++ b/generic/tclVar.c @@ -15,7 +15,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclVar.c,v 1.69.2.11 2005/11/27 02:34:41 das Exp $ + * RCS: @(#) $Id: tclVar.c,v 1.69.2.12 2006/10/05 11:44:03 msofer Exp $ */ #include "tclInt.h" @@ -2764,7 +2764,14 @@ Tcl_LappendObjCmd(dummy, interp, objc, objv) if (newValuePtr == NULL) { return TCL_ERROR; } - } + } else { + int result; + + result = Tcl_ListObjLength(interp, newValuePtr, &numElems); + if (result != TCL_OK) { + return result; + } + } } else { /* * We have arguments to append. We used to call Tcl_SetVar2 to diff --git a/tests/append.test b/tests/append.test index 58c0de7..312bc09 100644 --- a/tests/append.test +++ b/tests/append.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: append.test,v 1.7 2001/07/03 23:39:24 hobbs Exp $ +# RCS: @(#) $Id: append.test,v 1.7.12.1 2006/10/05 11:44:04 msofer Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -143,6 +143,15 @@ test append-4.20 {lappend command} { catch {unset x} lappend x(0) abc } {abc} +unset x +test append-4.21 {lappend command} { + set x \" + list [catch {lappend x} msg] $msg +} {1 {unmatched open quote in list}} +test append-4.22 {lappend command} { + set x \" + list [catch {lappend x abc} msg] $msg +} {1 {unmatched open quote in list}} proc check {var size} { set l [llength $var] -- cgit v0.12