From 7c22ad04aa281f88dbf8b20774d7fdd84d570284 Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 5 Dec 2006 15:36:12 +0000 Subject: * generic/tclPkg.c: When no requirements are supplied to a * tests/pkg.test: [package require $pkg] and [package unknown] is invoked to find a satisfying package, pass the requirement argument "0-" (which means all versions are acceptable). This permits a registered [package unknown] command to call [package vsatisfies $testVersion {*}$args] without any special handling of the empty $args case. This fixes/avoids a bug in [::tcl::tm::UnknownHandler] that was causing old TM versions to be provided in preference to newer TM versions. Thanks to Julian Noble for discovering the issue. --- ChangeLog | 13 +++++++++++++ generic/tclPkg.c | 4 +++- tests/pkg.test | 6 +++--- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 838049c..3e588d6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2006-12-05 Don Porter + + * generic/tclPkg.c: When no requirements are supplied to a + * tests/pkg.test: [package require $pkg] and [package unknown] + is invoked to find a satisfying package, pass the requirement argument + "0-" (which means all versions are acceptable). This permits a + registered [package unknown] command to call + [package vsatisfies $testVersion {*}$args] without any special + handling of the empty $args case. This fixes/avoids a bug in + [::tcl::tm::UnknownHandler] that was causing old TM versions to + be provided in preference to newer TM versions. Thanks to Julian + Noble for discovering the issue. + 2006-12-04 Donal K. Fellows TIP#267 IMPLEMENTATION diff --git a/generic/tclPkg.c b/generic/tclPkg.c index cecc634..5426bc7 100644 --- a/generic/tclPkg.c +++ b/generic/tclPkg.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: tclPkg.c,v 1.25 2006/11/15 20:08:45 dgp Exp $ + * RCS: @(#) $Id: tclPkg.c,v 1.26 2006/12/05 15:36:12 dgp Exp $ * * TIP #268. * Heavily rewritten to handle the extend version numbers, and extended @@ -1698,6 +1698,8 @@ AddRequirementsToDString( Tcl_DStringAppend(dsPtr, " ", 1); Tcl_DStringAppend(dsPtr, TclGetString(reqv[i]), -1); } + } else { + Tcl_DStringAppend(dsPtr, " 0-", -1); } } diff --git a/tests/pkg.test b/tests/pkg.test index 116f006..6c27e5f 100644 --- a/tests/pkg.test +++ b/tests/pkg.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: pkg.test,v 1.22 2006/11/03 00:34:53 hobbs Exp $ +# RCS: @(#) $Id: pkg.test,v 1.23 2006/12/05 15:36:12 dgp Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest 2 @@ -212,7 +212,7 @@ test pkg-2.15 {Tcl_PkgRequire procedure, "package unknown" support} { package require {a b} package unknown {} set x -} {{a b}} +} {{a b} 0-} test pkg-2.16 {Tcl_PkgRequire procedure, "package unknown" error} { proc pkgUnknown args { error "testing package unknown" @@ -227,7 +227,7 @@ test pkg-2.16 {Tcl_PkgRequire procedure, "package unknown" error} { "error "testing package unknown"" (procedure "pkgUnknown" line 2) invoked from within -"pkgUnknown t" +"pkgUnknown t 0-" ("package unknown" script) invoked from within "package require t"}} -- cgit v0.12