Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2003-02-17
03:20 • Closed ticket [681841ffff]: odd error message with missing character plus 7 ... artifact: fba561d812 user: dgp
2003-02-16
08:49 • Ticket [681841ffff]: 6 changes artifact: 2b393f90cc user: msofer
2003-02-14
01:08 • Ticket [681841ffff]: 4 changes artifact: 597d868b01 user: dgp
01:08 • Add attachment 681841-final.patch to ticket [681841ffffffffff|681841fff... artifact: 29b0b3ea5a user: dgp
01:08 • Ticket [681841ffff] odd error message with missing character status still Op... artifact: 0abc5919ff user: dgp
01:08 • Ticket [681841ffff]: 1 change artifact: 2af65a2766 user: dgp
2003-02-13
23:46 • Ticket [681841ffff]: 4 changes artifact: b6e9863b72 user: dgp
23:39 • Ticket [681841ffff]: 4 changes artifact: 5a8038fd49 user: dkf
23:07 • Ticket [681841ffff]: 5 changes artifact: f20ea07b3f user: dgp
21:59 • Ticket [681841ffff]: 1 change artifact: de5d0d3628 user: dkf
21:57 • Ticket [681841ffff]: 4 changes artifact: b0fdd50d82 user: dkf
21:31 • Ticket [681841ffff]: 4 changes artifact: 2245d1554a user: dkf
08:46 • Ticket [681841ffff]: 4 changes artifact: 5409e20f64 user: dgp
08:46 • Add attachment 681841.patch to ticket [681841ffff] artifact: 74539233be user: dgp
08:46 • Ticket [681841ffff] odd error message with missing character status still Op... artifact: 54bc625fa1 user: dgp
01:36 • Ticket [681841ffff]: 4 changes artifact: b2e564e6d4 user: dgp
2003-02-08
08:10 • Ticket [681841ffff]: 4 changes artifact: ae321c9795 user: dgp
07:18 • Ticket [681841ffff]: 4 changes artifact: 034bf7aad8 user: dgp
06:29 • Ticket [681841ffff]: 4 changes artifact: 821b1c4980 user: dgp
03:57 • Ticket [681841ffff]: 4 changes artifact: 331d919ddd user: msofer
03:30 • Ticket [681841ffff]: 4 changes artifact: 876ea4cf83 user: dgp
02:06 • Ticket [681841ffff]: 4 changes artifact: 0bb62896dd user: dgp
2003-02-07
23:16 • Ticket [681841ffff]: 4 changes artifact: f72506cf3a user: dkf
23:13 • Ticket [681841ffff]: 4 changes artifact: a0d7fa707b user: dkf
22:32 • Ticket [681841ffff]: 4 changes artifact: bc293f6526 user: dkf
22:30 • Ticket [681841ffff]: 4 changes artifact: 8eeb6c0c62 user: dkf
22:28 • Ticket [681841ffff]: 4 changes artifact: 9d75d18117 user: dkf
18:59 • Ticket [681841ffff]: 4 changes artifact: 842fcea04f user: msofer
13:46 • Ticket [681841ffff]: 4 changes artifact: 3dc2508211 user: dgp
05:28 • Ticket [681841ffff]: 4 changes artifact: 8de2bcae5e user: dgp
05:22 • Ticket [681841ffff]: 4 changes artifact: 03cba0e2a8 user: dgp
04:58 • Ticket [681841ffff]: 4 changes artifact: d22ba30a1a user: dgp
02:17 • Ticket [681841ffff]: 5 changes artifact: a0165033ea user: msofer
2003-02-06
18:41 • New ticket [681841ffff]. artifact: 8711b6eb65 user: vincentdarley

odd error message with missing character

Closed / Fixed681841ffffffffffffffffffffffffffffffffffCreated 24 years agoUpdated 24 years ago
Descriptionplain2003-02-06 18:41:59
This script, when evaluated (note the missing 
closing square bracket):

catch {
    if {![catch [list foo]} {
    }
} err
puts $err
puts $errorInfo

gives me:



invalid command name "fo"
    while executing
"fo"
    invoked from within
"catch [list foo"

i.e. 'err' is empty, and errorInfo has somehow 
dropped the last 'o' from foo.

Both of these seem incorrect.
msoferplain2003-02-07 02:17:41
Logged In: YES 
user_id=148712

AIEEEEE! 

Mem corruption in the parser? Introduced between 8.4b1 and
8.4b2 ...
dgpplain2003-02-07 04:58:02
Logged In: YES 
user_id=80530

Therefore my parser rewrite is likely to blame.
dgpplain2003-02-07 05:22:31
Logged In: YES 
user_id=80530

Ouch!  Note that the return from
[catch] here is TCL_OK, not
TCL_ERROR !
dgpplain2003-02-07 05:28:24
Logged In: YES 
user_id=80530

Error is in parsing nested command
evaluations in an expression.

Simpler test case:

expr {[set a [format bc]}

Miguel, error should be found in
lines 1261-1313 of tclParseExpr.c
dgpplain2003-02-07 13:46:57
Logged In: YES 
user_id=80530

Curious.  There is a parsing error there,
but there always has been.

Before, Tcl would parse the expression
wrong, allowing the error to go unnoticed,
but then the compiler would raise an error
when trying to compile the command
substitutions in the expr.

The *new* error is that Tcl_ParseCommand
itself is buggy in handling strings that have
a ] following the string to be parsed.  See
this with

    testparser {set a [format bc]} 16

in both 8.3 and 8.4.  (length 16 does
not include the closing ].  Thus a
parse error in 8.3, but a mistaken
acceptance in 8.4, apparently due
to an effective read beyond numbytes
when parsing.)

Both errors should be fixed.
msoferplain2003-02-07 18:59:12
Logged In: YES 
user_id=148712

Debug notes RE the new error: something subtle going on, witness

% set x {set a [format bc]}
set a [format bc]
% set y [string range $x 0 15]
set a [format bc
% testparser $x 16
- {set a [format bc} 3 simple set 1 text set 0 simple a 1
text a 0 word {[format bc} 1 command {[format bc} 0 \]
% testparser $y 16
missing close-bracket
dkfplain2003-02-07 22:28:17
Logged In: YES 
user_id=79902

I suspect a problem near tclParse.c:865
dkfplain2003-02-07 22:30:07
Logged In: YES 
user_id=79902

Yes, shouldn't the tests there come after the test to see if 
the end of the string has been reached?
dkfplain2003-02-07 22:32:43
Logged In: YES 
user_id=79902

Obviously not (or we barf on init.tcl!)  :^/
dkfplain2003-02-07 23:13:56
Logged In: YES 
user_id=79902

Further investigation seems to indicate the problem as being 
that when parsing bracketed things, the trailing bracket is 
consumed by Tcl_ParseCommand, stopping us from telling 
whether it should have done so.  Perhaps.  Everything's so 
recursive it's hard to tell for sure...
dkfplain2003-02-07 23:16:13
Logged In: YES 
user_id=79902

I don't know which function has responsibility for stripping the 
close bracket.  The open bracket is obviously consumed by 
ParseTokens(), but who gets the close?
dgpplain2003-02-08 02:06:40
Logged In: YES 
user_id=80530

patch coming soon.
dgpplain2003-02-08 03:30:09
File Added - 41799: 681841.patch

Logged In: YES 
user_id=80530

please review this patch.
msoferplain2003-02-08 03:57:21
Logged In: YES 
user_id=148712

Patch looks good! 

Q: does it also solve the old bug you mentioned? (I never
got around to understanding what it is ...)
dgpplain2003-02-08 06:29:29
Logged In: YES 
user_id=80530

There is a similar error in Tcl_EvalEx()
that can be demo'd by

    subst {a[set b [format cd]}

no syntax error reported.
dgpplain2003-02-08 07:18:04
File Deleted - 41799: 



File Added - 41816: 681841.patch

Logged In: YES 
user_id=80530

Here is an updated patch that
also includes a fix for Tcl_EvalEx().

I suspect there are still errors 
involving the setting of
iPtr->termOffset.  Not ready
to commit yet.
dgpplain2003-02-08 08:10:18
Logged In: YES 
user_id=80530

Here's another demo of the original bug:

% if {1 && "" == [puts \]} {}
\

Note that a backslash is printed, not a ] !
dgpplain2003-02-13 01:36:19
File Deleted - 41816: 



File Added - 42217: 681841.patch

Logged In: YES 
user_id=80530

Here's an updated patch that
takes care of updating 
tclCompile.c.

More bugs fixed, and ::errorInfo
trace should now be improved
when parsing errors occur.

Please review.

Still more work to do on Tcl_EvalEx.
dgpplain2003-02-13 08:46:20
Logged In: YES 
user_id=80530

another updated patch.
Now includes changes to
Tcl_EvalEx in tclBasic.c
No more code changes to make.

With this patch, 8 tests in subst.test
fail, but arguably they are testing
bugward compatibility, and the
new behavior is better.  Assigning
to the [subst] maintainer for his
opinion on that.
dgpplain2003-02-13 08:46:21
File Deleted - 42217: 



File Added - 42249: 681841.patch
dkfplain2003-02-13 21:31:50
Logged In: YES 
user_id=79902

And people wonder why Tcl_SubstObj has undefined
behaviour...
dkfplain2003-02-13 21:57:57
Logged In: YES 
user_id=79902

OK, I prefer the behaviour of [subst] forced by these
changes.  It's even less surprising given the documentation
of the command as being like substitution inside a "quoted"
string; we're actually closer to the documentation with this
alteration!  Go ahead and modify subst.test so that the
following tests do not fail:
  subst-8.6, subst-8.7, subst-8.8,
  subst-10.4, subst-10.5, subst-11.4, subst-11.5
dkf Ticket [681841ffff]: 1 change [History diff]2003-02-13 21:59:53
dgpplain2003-02-13 23:07:19
Logged In: YES 
user_id=80530

I'm having second thoughts about
tests subst-10.4 and subst-10.5.

In those tests a [break] is being
used to halt substitution.  In that
case, it seems strange for a parse
error beyond the [break] to cause
an error.  Thoughts?
dkfplain2003-02-13 23:39:18
Logged In: YES 
user_id=79902

Ultimately, the behaviour of [subst] is strange in so many
ways in these edge cases.  Given that, it's hard to believe
that many people are encountering them, so fixing them any
way you like (especially if it is more consistent with the
documentation of the command) will be no problem.  Perhaps
the alteration of that aspect should wait for 8.4.2 to be
branched off though, for maximum backward compatability.
dgpplain2003-02-13 23:46:51
Logged In: YES 
user_id=80530

yes, for the sake of good
patch-release compatibility,
I am separating the bug fix
patch from the "improve subst"
patch.

update soon.
dgp Ticket [681841ffff]: 1 change [History diff]2003-02-14 01:08:40
dgpplain2003-02-14 01:08:41
Logged In: YES 
user_id=80530

Here's the final version of the patch.
Ambitious changes to [subst] have
been removed.  Just the bug fix, ma'am.

Please review, test, and commit.
dgpplain2003-02-14 01:08:45
File Added - 42334: 681841-final.patch
msoferplain2003-02-16 08:49:33
Logged In: YES 
user_id=148712

Reviewed, teste, committed.
Assigning to dgp for the [subst] fixes - or else, for
branching the subst bugs to another ticket and closing thisone
dgpplain2003-02-17 03:20:46
Logged In: YES 
user_id=80530

the bug is fixed.  Other changes
will be dealt with in other reports.
Log in (anonymous is fine) to add a comment.

Attachments: