Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2016-04-06
18:27 • Closed ticket [213b6a2b9d]: EIAS violation in level parsing plus 7 other cha... artifact: fe77d13dd8 user: dgp
18:24
[213b6a2b9d] Make level parsing honor EIAS. check-in: 17f62d8265 user: dgp tags: core-8-6-branch
15:15 • Ticket [213b6a2b9d] EIAS violation in level parsing status still Open with 3... artifact: 37e1db95c4 user: dgp
02:44 • Ticket [213b6a2b9d]: 4 changes artifact: 26fd392c0f user: anonymous
02:03 • Ticket [213b6a2b9d]: 3 changes artifact: 0b67a78f90 user: dgp
01:23 • New ticket [213b6a2b9d]. artifact: 9c1eb56fb7 user: dgp

EIAS violation in level parsing

Closed / Fixed213b6a2b9d42ba2df4171af2c97511bd3b2c15f2Created 11 years agoUpdated 11 years ago
Descriptionplain2016-04-06 01:23:13
% apply {{} {uplevel -1 {}}}
invalid command name "-1"

% apply {{} {uplevel [expr -1] {}}}
bad level "-1"

[uplevel] ought to treat alike all "-1" values passed
as the first argument.  It doesn't.  It interprets the
arguments differently based on whether there's
an underlying integer objtype.

The related Q is whether level parsing ought to ever
report a "bad level" error, or whether it should treat
all invalid level values in the first argument as an
indication that the default level of "1" is intended,
and that argument that's not a valid level is the next
argument to [uplevel] or [upvar].

See also this variation:

% apply {{} {uplevel 1.2 {}}}
expected integer but got "1.2"
Referenced by1
dgpplain2016-04-06 02:03:27
Another EIAS problem illustrated:

% apply {{} {uplevel -4294967295 {}}}
invalid command name "-4294967295"
% apply {{} {uplevel [expr -4294967295] {}}}
%

This one is even more strange because in the
latter case there is no error because in the
rules of interpretation of [uplevel] the value
-4294967295 is just another way to write "1".

The [uplevel] docs state that the $level argument
is required whenever the first non-level argument
might begin with a '#' or with a digit.  This suggests
that any value that begins with a '#' or with a digit
which fails parsing as a level has to be reported as
a bad parse, and not fall back to the default handling.
Somewhat strangely, neither case covers the values "-3"
or ".2", but it does cover "0.2", so numerically equal
values can get different treatment.
anonymous (claiming to be aspect)plain2016-04-06 02:44:19
nice bug!

at fault seems to be TclObjGetFrame - for negative arguments the flow is clear between http://core.tcl.tk/tcl/artifact/97c663a4905173b7?ln=870 and http://core.tcl.tk/tcl/artifact/97c663a4905173b7?ln=892 .  Floats starting with a digit will get the "expected integer" variation from line 893.
dgpplain2016-04-06 15:15:44
Yes.  Code review is how I found it.  Wanted a record
here of why I was making the changes I'm about to make.
dgpplain2016-04-06 18:27:27
Fix committed for 8.6.6.  Will merge forward later.
Log in (anonymous is fine) to add a comment.