summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog9
-rw-r--r--library/clock.tcl8
-rw-r--r--tests/clock.test15
3 files changed, 28 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 3e7289e..806fb77 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2008-11-30 Kevin B. Kenny <kennykb@acm.org>
+
+ * library/clock.tcl (format, ParseClockScanFormat): Added a
+ [string map] to get rid of namespace delimiters before caching a
+ scan or format procedure [Bug 2362156].
+ * tests/clock.test (clock-64.[12]): Added test cases for the bug
+ that was tickled by a namespace delimiter inside a format string.
+
+
2008-11-29 Donal K. Fellows <dkf@users.sf.net>
TIP #210 IMPLEMENTATION
diff --git a/library/clock.tcl b/library/clock.tcl
index 75edb1c..e4a21e3 100644
--- a/library/clock.tcl
+++ b/library/clock.tcl
@@ -13,7 +13,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: clock.tcl,v 1.48 2008/11/01 15:03:28 das Exp $
+# RCS: @(#) $Id: clock.tcl,v 1.49 2008/11/30 19:24:00 kennykb Exp $
#
#----------------------------------------------------------------------
@@ -687,7 +687,8 @@ proc ::tcl::clock::format { args } {
# name in the 'FormatProc' array to avoid losing its internal
# representation, which contains the name resolution.
- set procName ::tcl::clock::formatproc'$format'$locale
+ set procName formatproc'$format'$locale
+ set procName [namespace current]::[string map {: {\:} \\ {\\}} $procName]
if {[info exists FormatProc($procName)]} {
set procName $FormatProc($procName)
} else {
@@ -1531,7 +1532,8 @@ proc ::tcl::clock::ParseClockScanFormat {formatString locale} {
# Check whether the format has been parsed previously, and return
# the existing recognizer if it has.
- set procName [namespace current]::scanproc'$formatString'$locale
+ set procName scanproc'$formatString'$locale
+ set procName [namespace current]::[string map {: {\:} \\ {\\}} $procName]
if { [namespace which $procName] != {} } {
return $procName
}
diff --git a/tests/clock.test b/tests/clock.test
index a2c0fda..6f2afdd 100644
--- a/tests/clock.test
+++ b/tests/clock.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: clock.test,v 1.86 2008/07/21 21:25:22 nijtmans Exp $
+# RCS: @(#) $Id: clock.test,v 1.87 2008/11/30 19:24:00 kennykb Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest 2
@@ -36644,6 +36644,19 @@ test clock-63.1 {Incorrect use of internal ConvertLocalToUTC command} {*}{
-result {key "localseconds" not found in dictionary}
}
+test clock-64.1 {:: in format string [Bug 2362156]} {*}{
+ -body {
+ clock scan 2001-02-03::04:05:06 -gmt 1 -format %Y-%m-%d::%H:%M:%S
+ }
+ -result 981173106
+}
+test clock-64.2 {:: in format string [Bug 2362156]} {*}{
+ -body {
+ clock format 981173106 -gmt 1 -format %Y-%m-%d::%H:%M:%S
+ }
+ -result 2001-02-03::04:05:06
+}
+
# cleanup
namespace delete ::testClock