|
2010-09-08
| ||
| 23:54 | • Closed ticket [3061814fff]: Tcl use invalid pattern for module name. plus 7 ... artifact: 9d6519e733 user: andreas_kupries | |
| 19:34 | • Ticket [3061814fff]: 1 change artifact: 0d27f1d6ef user: dgp | |
| 07:53 | • New ticket [3061814fff]. artifact: bcd3ed1a8e user: daapp | |
Tcl use invalid pattern for module name.
Closed / Fixed3061814fffffffffffffffffffffffffffffffffCreated 16 years agoUpdated 16 years ago
Descriptionplain2010-09-08 07:53:34
Affected versions at least 8.6b1 and 8.5.[89]
1. Manual page tm.3 and source code file library/tm.tcl use different pattern for tcl modules - character "_" is not specified in
manual page.
2. Tcl use invalid pattern for module name, which can cause problem on Windows platform.
Tcl module names should follow this pattern:
http://tcl.cvs.sourceforge.net/viewvc/tcl/tcl/library/tm.tcl?revision=1.18&content-type=text%2Fplain&pathrev=core-8-6-b1
set pkgpattern {^([_[:alpha:]][:_[:alnum:]]*)-([[:digit:]].*)[.]tm$}
http://tcl.cvs.sourceforge.net/viewvc/tcl/tcl/library/tm.tcl?revision=1.14.2.3&view=markup&pathrev=core-8-5-9
set pkgpattern {^([_[:alpha:]][:_[:alnum:]]*)-([[:digit:]].*)[.]tm$}
http://tcl.cvs.sourceforge.net/viewvc/tcl/tcl/doc/tm.n?revision=1.18&view=markup&pathrev=core-8-5.9
([[:alpha:]][:[:alnum:]]*)-([[:digit:]].*)\e.tm
http://tcl.cvs.sourceforge.net/viewvc/tcl/tcl/doc/tm.n?revision=1.18&view=markup&pathrev=core-8-6-b1
([[:alpha:]][:[:alnum:]]*)-([[:digit:]].*)\e.tm
This pattern allow to use module named a:b-1.tm, but character ":" has special meaning in Windows file names and it can't be used in names of plain files.
Correct pattern for tcl modules should be:
set pkgpattern {^([_[:alpha:]][_[:alnum:]]*)-([[:digit:]].*)\.tm$}
dgp Ticket [3061814fff]: 1 change
[History diff]2010-09-08 19:34:17
andreas_kupriesplain2010-09-08 23:54:13
allow_comments - 1 (Ad 1) The manpage is out of date needs an update ... Done. (Ad 2) This is, IMHO, not a bug. First note, from the manpage "Before the search is started ... All occurrences of “::” in the package name are replaced by the appropriate directory separator character for the platform we are on". So, a package a::b::c is transformed to a/b/c, and the search code then looks for <base>/a/b/*.tm (<base> is my placeholder here for the paths to searchs for modules). Now note that to get the package name back from a path the code converts the / back to :: ... See the code 'set pkgfilename ...' in tm.tcl. At that point we have a string like "a::b::x-X.y.tm" and this is compared against the pkgpattern. As the string contains ':' the regex has to allow this. Now if you have a package with a name like "z::a:b", using a single colon ... Then the search is for "<base>/z/*.tm" and as "a:b-1.tm" is an illegal file name on Windows it cannot be constructed and won't be found. That the pkgpattern would accept it is immaterial at this point. Windows has already prevented you from creating the file you wanted. I do not have to constrain my pattern to handle something which cannot occur. And on unix, where this such a file is possible the acceptance by the pattern is also correct.
Log in (anonymous is fine) to add a comment.