|
2026-03-09
| ||
| 07:39 | • Closed ticket [8d1fc70995]: lseq "count" error persists across calls</... artifact: a66bae2031 user: jan.nijtmans | |
|
2026-02-07
| ||
| 01:14 | fix bugs in lseq: [8d1fc7099570], [999b6966b299], tip-746 check-in: d97e97e967 user: griffin tags: lseq_bug_fixes | |
|
2026-01-14
| ||
| 17:38 | • Ticket [8d1fc70995] lseq "count" error persists across calls statu... artifact: 1ce29f103d user: apnadkarni | |
| 17:30 | • Ticket [8d1fc70995]: 3 changes artifact: 56ec2296eb user: apnadkarni | |
| 16:18 | • Ticket [8d1fc70995]: 4 changes artifact: da74e8251d user: griffin | |
| 14:52 | • Ticket [8d1fc70995]: 3 changes artifact: fe324431c3 user: apnadkarni | |
| 13:32 | • Ticket [8d1fc70995]: 3 changes artifact: 51516e26cb user: juliannoble2 | |
| 11:57 | • Ticket [8d1fc70995]: 3 changes artifact: c2f468dbaf user: apnadkarni | |
|
2026-01-13
| ||
| 19:25 | • New ticket [8d1fc70995]. artifact: 1b2c4d7346 user: tomkiti | |
lseq "count" error persists across calls
If an lseq "count" command returns an error, the command returns an error forever:
% lseq 0 count 5
0 1 2 3 4
% lseq count 5
invalid bareword "count"
in expression "count";
should be "$count" or "{count}" or "count(...)" or ...
% lseq 0 count 5
invalid bareword "count"
in expression "count";
should be "$count" or "{count}" or "count(...)" or ...
What platform is this (though I doubt that would make a difference). I could not reproduce this in 9.0.0, 9.0.2, 9.0.3 and trunk (9.1) on Windows.
% info pat
9.0.3
% lseq 0 count 5
0 1 2 3 4
% lseq count 5
invalid bareword "count"
in expression "count";
should be "$count" or "{count}" or "count(...)" or ...
% lseq 0 count 5
0 1 2 3 4
curious.. I see the persistent error as reported. Tested: windows 10 9.0b3 9.0.2 and 9.0.3 windows 11 25H2 9.0.2 The 9.0.3 is a recent download of the magicsplat distribution, the 9.0b3 is also magicsplat The 9.0.2 is bawt I don't see it in an obsolete 8.7 I have on the windows 10 machine.
Ok, found the difference. I have history turned off in my tclshrc. Re-enabling it reproduces the error.
It also means (I suspect) the error would not occur in a script (including the test suite!) since history is disabled in that situation.
In any case, I confirm that it's a real bug that needs investigating.
Thank you for this report!
Even without the unexpected interaction with the user's environment, the use of lseq key words in positions of numeric arguments, should be checked by the command, and provide a more meaningful error message.
And in fact, the error can be reproduced in a script as well. The argument just has to have a reference count > 1.
x.tcl:
set count count
puts [catch {lseq 0 $count 5} result],$result
puts [catch {lseq $count 5} result],$result
puts [catch {lseq 0 $count 5} result],$result
Running it,
c:\src\tcltk\wip\tcl\win>tclsh x.tcl
0,0 1 2 3 4
1,invalid bareword "count"
in expression "count";
should be "$count" or "{count}" or "count(...)" or ...
1,invalid bareword "count"
in expression "count";
should be "$count" or "{count}" or "count(...)" or ...
I think the optimization in function SequenceIdentifyArgument is broken
if (TclHasInternalRep(argPtr, &tclExprCodeType)) {
goto doExpr;
}
Basing a decision on the current internal representation type feels like it violates EIAS. Here for example, "count" is an invalid expression but still has bytecode representing it generated (which will raise an error). "count" passed as the third argument though is not to be treated as an integer but a keyword. The above fragment means that treatment of "count" depends on what the last type it was shimmered to which feels like a violation of EIAS.
Since the fix branch is now merged to bothe 9.0 and trunk, this can be closed.
Thanks!