Skip to content
Tcl Source Code View Ticket
Login

View Ticket

ellipsis logic is not Unicode-safe

Closed / Fixed760872ffffffffffffffffffffffffffffffffffCreated 23 years agoUpdated 23 years ago
Descriptionplain2003-06-26 00:52:55
Tcl_LogCommandInfo truncates
messages added to the ::errorInfo
variable to at most 150 bytes in
length.

There is no check that this doesn't
break apart a UTF-8 encoded
character.

Seem more sensible to truncate
based on the number of characters
rather than the number of bytes.

Tests init-4.6.* have been committed
to call attention to this problem

There are similar ellipsis issues
in tclProc.c, tclCompile.c, and tclExecute.c.
dgpplain2003-06-27 23:00:19
Logged In: YES 
user_id=80530


the ellipsis in tclExecute.c and
one of them in tclProc.c just
write directly to stderr 
(TCL_COMPILE_DEBUG).
Since they don't store the
truncated string in ::errorInfo,
they are not bugs.
dgpplain2003-06-27 23:26:52
File Added - 54288: 760872.patch

Logged In: YES 
user_id=80530


Here's a patch.  Please review.
msoferplain2003-07-08 03:55:35
Logged In: YES 
user_id=148712

The patch applies cleanly and passes the testsuite - and
that is as far as my knowledge of unicode things allows me
to judge.
dkfplain2003-07-08 04:18:42
Logged In: YES 
user_id=79902

The patch misses a place in tclBasic.c (in function
TclObjInvoke) but otherwise looks fine from a quick glance.
dgpplain2003-07-08 23:58:24
File Deleted - 54288: 



File Added - 55273: 760872.patch

Logged In: YES 
user_id=80530

updated patch.
dkfplain2003-07-09 15:29:28
Logged In: YES 
user_id=79902

The patch looks OK on the alterations it does make, but code
review (this time, I've looked at everything that matches
".*\.\.\. so I think I've found everything :^/ ) has found
*another* two places that do ellipsis handling which might
matter:
  LogSyntaxError() in tclParseExpr.c
  TclRegError() in tclRegexp.c

Would it be easier to have a single (internal) Tcl function
to do ellipsis handling and do it right instead of spreading
the logic all over the core?

In Tk, GetEntryText in tkMacOSXMenu.c looks dodgy, but not
UNICODE-dodgy.  Just very strange and inefficient (and with
some odd spelling too.)  I'm also not 100% sure about
TkpDisplayWarning in tkWinInit.c but that might actually be
OK.  However, Tk doesn't seem to do any direct ellipsis
handling, which is good.
dgp Ticket [760872ffff]: 1 change [History diff]2003-07-17 04:20:19
vincentdarleyplain2003-07-17 16:58:36
Logged In: YES 
user_id=32170

Is it planned to put this in 8.4.4?
dgpplain2003-07-17 22:50:43
Logged In: YES 
user_id=80530


there will be some fix for the bug 
in 8.4.4, either this patch, or an
improved one I'm working on.
dgpplain2003-07-19 06:35:43
Logged In: YES 
user_id=80530


commiting this patch to get
the bug fixed for 8.4.4 release.

leaving this open for better
solutions still under development.
dgpplain2003-10-14 22:45:29
Logged In: YES 
user_id=80530

clean fix applied to HEAD that
makes use of two new internal
routines, TclAppendObjToErrorInfo()
and TclAppendLimitedToObj().
dgp Ticket [760872ffff]: 2 changes [History diff]2003-10-14 22:45:30
Log in (anonymous is fine) to add a comment.

Attachments: