diff options
author | dgp <dgp@users.sourceforge.net> | 2007-11-28 20:30:14 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2007-11-28 20:30:14 (GMT) |
commit | fdac2b39fea8099117e984579453fdf0d129ae07 (patch) | |
tree | 145610b3ffd3fd9129e9514c6af102ecbab55499 | |
parent | 325853d22a554d03e6347953724621db7e41e891 (diff) | |
download | tcl-fdac2b39fea8099117e984579453fdf0d129ae07.zip tcl-fdac2b39fea8099117e984579453fdf0d129ae07.tar.gz tcl-fdac2b39fea8099117e984579453fdf0d129ae07.tar.bz2 |
merge updates from HEAD
-rw-r--r-- | ChangeLog | 33 | ||||
-rw-r--r-- | doc/chan.n | 5 | ||||
-rw-r--r-- | doc/fconfigure.n | 5 | ||||
-rw-r--r-- | generic/tclBasic.c | 14 | ||||
-rw-r--r-- | generic/tclConfig.c | 37 | ||||
-rw-r--r-- | generic/tclIO.c | 30 | ||||
-rw-r--r-- | generic/tclNamesp.c | 26 | ||||
-rw-r--r-- | tests/chan.test | 17 | ||||
-rw-r--r-- | win/tclWinSock.c | 15 |
9 files changed, 141 insertions, 41 deletions
@@ -1,3 +1,36 @@ +2007-11-28 Don Porter <dgp@users.sourceforge.net> + + * generic/tclConfig.c: Corrected failure of the [::foo::pkgconfig] + command to clean up registered configuration data when the query + command is deleted from the interp. [Bug 983501]. + + * generic/tclNamesp.c (Tcl_SetEnsembleMappingDict): Added checks + that the dict value passed in is in the format required to make the + internals of ensembles work. [Bug 1436096] + + * generic/tclIO.c: Simplify test and improve accuracy of error + message in latest changes. + +2007-11-28 Pat Thoyts <patthoyts@users.sourceforge.net> + + * generic/tclIO.c: -eofchar must support no eofchar. + +2007-11-27 Miguel Sofer <msofer@users.sf.net> + + * generic/tclBasic.c: remove unneeded call in Tcl_CreateInterp, + add comments + +2007-11-27 Don Porter <dgp@users.sourceforge.net> + + * win/tclWinSock.c: Add mising encoding conversion of the [info + hostname] value from the system encoding to Tcl's internal encoding. + + * doc/chan.n: "Fix" the limitation on channel -eofchar + * doc/fconfigure.n: values to single byte characters by documenting + * generic/tclIO.c: it and making it fail loudly. Thanks to + * tests/chan.test: Stuart Cassoff for contributing the fix. + [Bug 800753] + 2007-11-26 Miguel Sofer <msofer@users.sf.net> * generic/tclBasic.c: @@ -4,7 +4,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: chan.n,v 1.9.2.2 2007/11/01 16:25:48 dgp Exp $ +'\" RCS: @(#) $Id: chan.n,v 1.9.2.3 2007/11/28 20:30:18 dgp Exp $ .so man.macros .TH chan n 8.5 Tcl "Tcl Built-In Commands" .BS @@ -173,6 +173,9 @@ returned. The default value for \fB\-eofchar\fR is the empty string in all cases except for files under Windows. In that case the \fB\-eofchar\fR is Control-z (\ex1a) for reading and the empty string for writing. +The acceptable range for \fB\-eofchar\fR values is \ex01 - \ex7f; +attempting to set \fB\-eofchar\fR to a value outside of this range will +generate an error. .TP \fB\-translation\fR \fImode\fR .TP diff --git a/doc/fconfigure.n b/doc/fconfigure.n index 63b65c6..7224b1c 100644 --- a/doc/fconfigure.n +++ b/doc/fconfigure.n @@ -4,7 +4,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: fconfigure.n,v 1.17.2.1 2007/07/04 15:13:42 dgp Exp $ +'\" RCS: @(#) $Id: fconfigure.n,v 1.17.2.2 2007/11/28 20:30:19 dgp Exp $ '\" .so man.macros .TH fconfigure n 8.3 Tcl "Tcl Built-In Commands" @@ -120,6 +120,9 @@ channel, a two-element list will always be returned. The default value for \fB\-eofchar\fR is the empty string in all cases except for files under Windows. In that case the \fB\-eofchar\fR is Control-z (\ex1a) for reading and the empty string for writing. +The acceptable range for \fB\-eofchar\fR values is \ex01 - \ex7f; +attempting to set \fB\-eofchar\fR to a value outside of this range will +generate an error. .TP \fB\-translation\fR \fImode\fR .TP diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 5cd1f18..a866f66 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -14,7 +14,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclBasic.c,v 1.244.2.17 2007/11/26 19:43:16 dgp Exp $ + * RCS: @(#) $Id: tclBasic.c,v 1.244.2.18 2007/11/28 20:30:23 dgp Exp $ */ #include "tclInt.h" @@ -609,6 +609,11 @@ Tcl_CreateInterp(void) iPtr->pendingObjDataPtr = NULL; iPtr->asyncReadyPtr = TclGetAsyncReadyPtr(); + /* + * Insure that the stack checking mechanism for this interp is + * initialized. + */ + GetCStackParams(iPtr); /* @@ -831,13 +836,6 @@ Tcl_CreateInterp(void) Tcl_Panic(Tcl_GetString(Tcl_GetObjResult(interp))); } - /* - * Insure that the stack checking mechanism for this interp is - * initialized. - */ - - TclInterpReady(interp); - return interp; } diff --git a/generic/tclConfig.c b/generic/tclConfig.c index 2fd6ea1..ad2e881 100644 --- a/generic/tclConfig.c +++ b/generic/tclConfig.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclConfig.c,v 1.14.2.2 2007/11/21 06:44:31 dgp Exp $ + * RCS: @(#) $Id: tclConfig.c,v 1.14.2.3 2007/11/28 20:30:25 dgp Exp $ */ #include "tclInt.h" @@ -28,6 +28,17 @@ #define ASSOC_KEY "tclPackageAboutDict" /* + * A ClientData struct for the QueryConfig command. Store the two bits + * of data we need; the package name for which we store a config dict, + * and the (Tcl_Interp *) in which it is stored. + */ + +typedef struct QCCD { + Tcl_Obj *pkg; + Tcl_Interp *interp; +} QCCD; + +/* * Static functions in this file: */ @@ -66,12 +77,14 @@ Tcl_RegisterConfig( CONST char *valEncoding) /* Name of the encoding used to store the * configuration values, ASCII, thus UTF-8. */ { - Tcl_Obj *pDB, *pkg, *pkgDict; + Tcl_Obj *pDB, *pkgDict; Tcl_DString cmdName; Tcl_Config *cfg; Tcl_Encoding venc = Tcl_GetEncoding(NULL, valEncoding); + QCCD *cdPtr = (QCCD *)ckalloc(sizeof(QCCD)); - pkg = Tcl_NewStringObj(pkgName, -1); + cdPtr->interp = interp; + cdPtr->pkg = Tcl_NewStringObj(pkgName, -1); /* * Phase I: Adding the provided information to the internal database of @@ -86,7 +99,7 @@ Tcl_RegisterConfig( * Note, the created command will have a reference through its clientdata. */ - Tcl_IncrRefCount(pkg); + Tcl_IncrRefCount(cdPtr->pkg); /* * For venc == NULL aka bogus encoding we skip the step setting up the @@ -100,7 +113,7 @@ Tcl_RegisterConfig( pDB = GetConfigDict(interp); - if (Tcl_DictObjGet(interp, pDB, pkg, &pkgDict) != TCL_OK + if (Tcl_DictObjGet(interp, pDB, cdPtr->pkg, &pkgDict) != TCL_OK || (pkgDict == NULL)) { pkgDict = Tcl_NewDictObj(); } else if (Tcl_IsShared(pkgDict)) { @@ -136,7 +149,7 @@ Tcl_RegisterConfig( * Write the changes back into the overall database. */ - Tcl_DictObjPut(interp, pDB, pkg, pkgDict); + Tcl_DictObjPut(interp, pDB, cdPtr->pkg, pkgDict); } /* @@ -166,7 +179,7 @@ Tcl_RegisterConfig( Tcl_DStringAppend(&cmdName, "::pkgconfig", -1); if (Tcl_CreateObjCommand(interp, Tcl_DStringValue(&cmdName), - QueryConfigObjCmd, (ClientData) pkg, QueryConfigDelete) == NULL) { + QueryConfigObjCmd, (ClientData) cdPtr, QueryConfigDelete) == NULL) { Tcl_Panic("%s: %s", "Tcl_RegisterConfig", "Unable to create query command for package configuration"); } @@ -198,7 +211,8 @@ QueryConfigObjCmd( int objc, struct Tcl_Obj *CONST *objv) { - Tcl_Obj *pkgName = (Tcl_Obj *) clientData; + QCCD *cdPtr = (QCCD *) clientData; + Tcl_Obj *pkgName = cdPtr->pkg; Tcl_Obj *pDB, *pkgDict, *val, *listPtr; int n, index; static CONST char *subcmdStrings[] = { @@ -308,9 +322,12 @@ static void QueryConfigDelete( ClientData clientData) { - Tcl_Obj *pkgName = (Tcl_Obj *) clientData; - + QCCD *cdPtr = (QCCD *) clientData; + Tcl_Obj *pkgName = cdPtr->pkg; + Tcl_Obj *pDB = GetConfigDict(cdPtr->interp); + Tcl_DictObjRemove(NULL, pDB, pkgName); Tcl_DecrRefCount(pkgName); + ckfree((char *)cdPtr); } /* diff --git a/generic/tclIO.c b/generic/tclIO.c index c65a192..21e164a 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclIO.c,v 1.121.2.5 2007/11/21 06:30:51 dgp Exp $ + * RCS: @(#) $Id: tclIO.c,v 1.121.2.6 2007/11/28 20:30:25 dgp Exp $ */ #include "tclInt.h" @@ -7314,14 +7314,25 @@ Tcl_SetChannelOption( if (argc == 0) { statePtr->inEofChar = 0; statePtr->outEofChar = 0; - } else if (argc == 1) { - if (statePtr->flags & TCL_WRITABLE) { - statePtr->outEofChar = (int) argv[0][0]; + } else if (argc == 1 || argc == 2) { + int outIndex = (argc - 1); + int inValue = (int) argv[0][0]; + int outValue = (int) argv[outIndex][0]; + if (inValue & 0x80 || outValue & 0x80) { + if (interp) { + Tcl_AppendResult(interp, "bad value for -eofchar: ", + "must be non-NUL ASCII character", NULL); + } + ckfree((char *) argv); + return TCL_ERROR; } if (statePtr->flags & TCL_READABLE) { - statePtr->inEofChar = (int) argv[0][0]; + statePtr->inEofChar = inValue; + } + if (statePtr->flags & TCL_WRITABLE) { + statePtr->outEofChar = outValue; } - } else if (argc != 2) { + } else { if (interp) { Tcl_AppendResult(interp, "bad value for -eofchar: should be a list of zero," @@ -7329,13 +7340,6 @@ Tcl_SetChannelOption( } ckfree((char *) argv); return TCL_ERROR; - } else { - if (statePtr->flags & TCL_READABLE) { - statePtr->inEofChar = (int) argv[0][0]; - } - if (statePtr->flags & TCL_WRITABLE) { - statePtr->outEofChar = (int) argv[1][0]; - } } if (argv != NULL) { ckfree((char *) argv); diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c index 37ac553..2c53562 100644 --- a/generic/tclNamesp.c +++ b/generic/tclNamesp.c @@ -23,7 +23,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclNamesp.c,v 1.134.2.13 2007/11/21 16:27:00 dgp Exp $ + * RCS: @(#) $Id: tclNamesp.c,v 1.134.2.14 2007/11/28 20:30:32 dgp Exp $ */ #include "tclInt.h" @@ -5407,11 +5407,33 @@ Tcl_SetEnsembleMappingDict( return TCL_ERROR; } if (mapDict != NULL) { - int size; + int size, done; + Tcl_DictSearch search; + Tcl_Obj *valuePtr; if (Tcl_DictObjSize(interp, mapDict, &size) != TCL_OK) { return TCL_ERROR; } + + for (Tcl_DictObjFirst(NULL, mapDict, &search, NULL, &valuePtr, &done); + !done; Tcl_DictObjNext(&search, NULL, &valuePtr, &done)) { + Tcl_Obj *cmdPtr; + const char *bytes; + + if (Tcl_ListObjIndex(interp, valuePtr, 0, &cmdPtr) != TCL_OK) { + Tcl_DictObjDone(&search); + return TCL_ERROR; + } + bytes = TclGetString(cmdPtr); + if (bytes[0] != ':' || bytes[1] != ':') { + Tcl_AppendResult(interp, + "ensemble target is not a fully-qualified command", + NULL); + Tcl_DictObjDone(&search); + return TCL_ERROR; + } + } + if (size < 1) { mapDict = NULL; } diff --git a/tests/chan.test b/tests/chan.test index 1108216..b6375fe 100644 --- a/tests/chan.test +++ b/tests/chan.test @@ -7,7 +7,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: chan.test,v 1.8 2006/12/17 03:44:03 das Exp $ +# RCS: @(#) $Id: chan.test,v 1.8.2.1 2007/11/28 20:30:33 dgp Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest 2 @@ -37,6 +37,21 @@ test chan-3.1 {chan command: close subcommand} -body { test chan-4.1 {chan command: configure subcommand} -body { chan configure } -returnCodes error -result "wrong # args: should be \"chan configure channelId ?optionName? ?value? ?optionName value?...\"" +test chan-4.2 {chan command: [Bug 800753]} -body { + chan configure stdout -eofchar \u0100 +} -returnCodes error -match glob -result {bad value*} +test chan-4.3 {chan command: [Bug 800753]} -body { + chan configure stdout -eofchar \u0000 +} -returnCodes error -match glob -result {bad value*} +test chan-4.4 {chan command: check valid inValue, no outValue} -body { + chan configure stdout -eofchar [list \x27 {}] +} -returnCodes ok -result {} +test chan-4.5 {chan command: check valid inValue, invalid outValue} -body { + chan configure stdout -eofchar [list \x27 \x80] +} -returnCodes error -match glob -result {bad value for -eofchar:*} +test chan-4.6 {chan command: check no inValue, valid outValue} -body { + chan configure stdout -eofchar [list {} \x27] +} -returnCodes ok -result {} test chan-5.1 {chan command: copy subcommand} -body { chan copy foo diff --git a/win/tclWinSock.c b/win/tclWinSock.c index d46bfc0..4da0958 100644 --- a/win/tclWinSock.c +++ b/win/tclWinSock.c @@ -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: tclWinSock.c,v 1.57 2007/02/20 23:24:07 nijtmans Exp $ + * RCS: @(#) $Id: tclWinSock.c,v 1.57.2.1 2007/11/28 20:30:34 dgp Exp $ */ #include "tclWinInt.h" @@ -2576,13 +2576,18 @@ InitializeHostName( * Maintainers are welcome to supply it. */ - Tcl_DStringSetLength(&ds, 255); - if (winSock.gethostname(Tcl_DStringValue(&ds), - Tcl_DStringLength(&ds)) == 0) { + Tcl_DString inDs; + + Tcl_DStringInit(&inDs); + Tcl_DStringSetLength(&inDs, 255); + if (winSock.gethostname(Tcl_DStringValue(&inDs), + Tcl_DStringLength(&inDs)) == 0) { Tcl_DStringSetLength(&ds, 0); } else { - Tcl_DStringSetLength(&ds, strlen(Tcl_DStringValue(&ds))); + Tcl_ExternalToUtfDString(NULL, Tcl_DStringValue(&inDs), + Tcl_DStringLength(&inDs), &ds); } + Tcl_DStringFree(&inDs); } } |