diff options
-rw-r--r-- | ChangeLog | 23 | ||||
-rw-r--r-- | library/auto.tcl | 9 | ||||
-rw-r--r-- | tests/autoMkindex.test | 14 | ||||
-rw-r--r-- | tests/pkg/magicchar.tcl | 6 |
4 files changed, 48 insertions, 4 deletions
@@ -1,3 +1,20 @@ +2000-01-28 Eric Melski <ericm@scriptics.com> + + * tests/pkg/magicchar.tcl: + * tests/autoMkindex.test: Test for fix for bug #2611. + + * library/auto.tcl: Fixed the regular expression that performs $ + escaping before sourcing a file to index. It was erroneously + adding \ escapes even to $'s that were already escaped, + effectively "un-escaping" those $'s. (bug #2611). + +2000-01-27 Eric Melski <ericm@scriptics.com> + + * tests/autoMkindex.test: + * library/auto.tcl: Applied patch (with slight modification) from + bug #2701: auto_mkIndex uses platform dependent file paths. + Added test for fix. + 2000-01-27 Jennifer Hom <jenn@scriptics.com> * library/tcltest1.0/tcltest.tcl: Changed NormalizePath to @@ -9,12 +26,18 @@ 2000-01-27 Eric Melski <ericm@scriptics.com> + * tests/pkg/samename.tcl: test file for bug #1983 + * tests/pkgMkIndex.test: * doc/pkgMkIndex.n: * library/package.tcl: Per rfe #4097, optimized creation of direct load packages to bypass computing the list of commands added by the new package. Also made direct loading the default, and added a -lazy option. + Fixed bug #1983, dealing with pkg_mkIndex incorrectly handling + situations with two procs by the same name but in different + namespaces (ie, foo::baz and bar::baz). + 2000-01-26 Eric Melski <ericm@scriptics.com> diff --git a/library/auto.tcl b/library/auto.tcl index ddb317b..07b3116 100644 --- a/library/auto.tcl +++ b/library/auto.tcl @@ -3,7 +3,7 @@ # utility procs formerly in init.tcl dealing with auto execution # of commands and can be auto loaded themselves. # -# RCS: @(#) $Id: auto.tcl,v 1.4 2000/01/28 00:09:15 ericm Exp $ +# RCS: @(#) $Id: auto.tcl,v 1.5 2000/01/28 16:38:34 ericm Exp $ # # Copyright (c) 1991-1993 The Regents of the University of California. # Copyright (c) 1994-1998 Sun Microsystems, Inc. @@ -319,8 +319,11 @@ proc auto_mkindex_parser::mkindex {file} { # interpreter: references like "$x" will fail since code is not # really being executed and variables do not really exist. # Be careful to escape all naked "$" before evaluating. - - regsub -all {([^\$])\$([^\$])} $contents {\1\\$\2} contents + regsub -expanded -all { + ([^\\](?:(?:\\\\)*)) # match any even number of backslashes ... + \$ # ... followed by an unescaped dollar sign ... + ([^\$]) # ... followed by anything but another dollar sign + } $contents {\1\\$\2} contents; # add one backslash for the dollar sign set index "" set contextStack "" diff --git a/tests/autoMkindex.test b/tests/autoMkindex.test index cdc33d3..bab9e43 100644 --- a/tests/autoMkindex.test +++ b/tests/autoMkindex.test @@ -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: autoMkindex.test,v 1.8 2000/01/28 00:09:15 ericm Exp $ +# RCS: @(#) $Id: autoMkindex.test,v 1.9 2000/01/28 16:38:34 ericm Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -187,6 +187,18 @@ test autoMkindex-4.1 {platform indenpendant source commands} { set result } {{set auto_index(::college::team) [list source [file join $dir pkg samename.tcl]]} {set auto_index(::pro::team) [list source [file join $dir pkg samename.tcl]]}} +test autoMkindex-5.1 {escape magic tcl chars in general code} { + file delete tclIndex + set result {} + if { ![catch {auto_mkindex . pkg/magicchar.tcl}] } { + set f [open tclIndex r] + set dat [split [string trim [read $f]] "\n"] + set result [lindex $dat end] + close $f + } + set result +} {set auto_index(testProc) [list source [file join $dir pkg magicchar.tcl]]} + # Clean up. unset result diff --git a/tests/pkg/magicchar.tcl b/tests/pkg/magicchar.tcl new file mode 100644 index 0000000..dc68fcd --- /dev/null +++ b/tests/pkg/magicchar.tcl @@ -0,0 +1,6 @@ +set dollar1 "this string contains an unescaped dollar sign -> \\$foo" +set dollar2 "this string contains an escaped dollar sign -> \$foo \\\$foo" +set bracket1 "this contains an unescaped bracket [NoSuchProc]" +set bracket2 "this contains an escaped bracket \[NoSuchProc\]" +set bracket3 "this contains nested unescaped brackets [[NoSuchProc]]" +proc testProc {} {} |