summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorandreas_kupries <akupries@shaw.ca>2006-12-05 17:44:43 (GMT)
committerandreas_kupries <akupries@shaw.ca>2006-12-05 17:44:43 (GMT)
commit279cfdfb6dd21dc84c44159eb34770e30511bdee (patch)
tree140f9a5bc68e660dbb8811da529498cde99d639d
parent91bc34c111a262e2350cc3ece78c75ef8ba3f185 (diff)
downloadtcl-279cfdfb6dd21dc84c44159eb34770e30511bdee.zip
tcl-279cfdfb6dd21dc84c44159eb34770e30511bdee.tar.gz
tcl-279cfdfb6dd21dc84c44159eb34770e30511bdee.tar.bz2
Backport to 8.4 (Don Porter's work).
When no requirements are supplied to a [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.
-rw-r--r--ChangeLog14
-rw-r--r--generic/tclPkg.c4
-rw-r--r--tests/pkg.test6
3 files changed, 20 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 92cc427..58f657b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2006-12-05 Andreas Kupries <andreask@activestate.com>
+
+ * tests/pkg.test: Backport to 8.4 (Don Porter's work):
+ * generic/tclPkg.c: When no requirements are supplied to a
+ [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 <donal.k.fellows@man.ac.uk>
* doc/file.n: Fix confusing wording for [file pathtype]. [Bug 1606454]
diff --git a/generic/tclPkg.c b/generic/tclPkg.c
index 8f1f413..5115442 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.9.2.7 2006/10/11 21:32:13 andreas_kupries Exp $
+ * RCS: @(#) $Id: tclPkg.c,v 1.9.2.8 2006/12/05 17:44:44 andreas_kupries Exp $
*
* TIP #268.
* Heavily rewritten to handle the extend version numbers, and extended
@@ -2143,6 +2143,8 @@ AddRequirementsToDString(dstring, reqc, reqv)
Tcl_DStringAppend(dstring, " ", 1);
Tcl_DStringAppend(dstring, TclGetString(reqv[i]), -1);
}
+ } else {
+ Tcl_DStringAppend(dstring, " 0-", -1);
}
}
diff --git a/tests/pkg.test b/tests/pkg.test
index 344de1c..cde4151 100644
--- a/tests/pkg.test
+++ b/tests/pkg.test
@@ -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: pkg.test,v 1.9.12.6 2006/10/10 18:16:59 dgp Exp $
+# RCS: @(#) $Id: pkg.test,v 1.9.12.7 2006/12/05 17:44:44 andreas_kupries Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest 2
@@ -255,7 +255,7 @@ test pkg-2.15-268 {Tcl_PkgRequire procedure, "package unknown" support} tip268 {
package require {a b}
package unknown {}
set x
-} {{a b}}
+} {{a b} 0-}
test pkg-2.16 {Tcl_PkgRequire procedure, "package unknown" error} !tip268 {
proc pkgUnknown args {
error "testing package unknown"
@@ -288,7 +288,7 @@ test pkg-2.16-268 {Tcl_PkgRequire procedure, "package unknown" error} tip268 {
"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"}}