|
2016-07-15
| ||
| 16:10 | • Ticket [de7f92b65a] variable substitution causes crashes status still Closed... artifact: 7006e14244 user: dgp | |
| 16:10 | • Ticket [de7f92b65a]: 7 changes artifact: 8c56e1d98a user: dgp | |
| 10:24 | • Closed ticket [de7f92b65a]. artifact: 69887020bc user: sebres | |
| 09:59 | • New ticket [de7f92b65a]. artifact: b0d2faaa6b user: ekd123 | |
variable substitution causes crashes
Closed / Duplicatede7f92b65af279c0495d648ae871281c026ca955Created 10 years agoUpdated 10 years ago
Descriptionplain2016-07-15 09:59:00
set yf1 "14-11-03 14-18-27: 88 13 03 05 00 00 5A" set sen "78 78" set z "16-07-14 12-15-20" set str1 [string replace $[string replace $yf1 0 16 $z] 31 35 $sen] ;# oops; $[ is unnecessary puts $str1 This code doesn't work because there's an unnecessary $, but an error is expected to be given rather than crash. OS: Windows 10 x64
sebresplain2016-07-15 10:24:59
> but an error is expected to be given rather than crash.
That is almost impossible, because it is expected behavior - how tcl substitution works.
See example bellow:
% puts $[list this is a command execution]$
$this is a command execution$
% puts -[list this is a command execution]-
-this is a command execution-
In this case "$" is just a dollar-character, exactly so as by second example "-" is minus character.
BTW if that will be "fixed", thousands tcl codes over the world would be no longer functional. Then the backwards compatibility always has a priority here!
The only exception here was a sequence "{*}" (does expanding of arguments), but it was possible only why such combination was anyway not allowed in previous versions because of chars after closed brace (so indirect it was backwards compatible):
% puts {*}[list stdout test]
test
Please take a look into documentation about tcl substitution, before post a new "bugs" here...
Close now, because won't be fixed.
dgpplain2016-07-15 16:10:34
Appears to be a near-duplicate of ticket from yesterday. http://core.tcl.tk/tcl/tktview?name=58241eb2e4 Suspect it is the same bug -- and it is still fixed for 8.6.6. Crashes should be reported. Detailed instructions help, since the crash did not happen unless the commands were fed to tclsh via stdin. Testing with script files did not demonstrate the problem. In fact it is especially important to report cases like this where bad code causes crashes because since it is bad code we're much less likely to see someone else uncover it by chance.
dgp Ticket [de7f92b65a]: 4 changes
[History diff]2016-07-15 16:10:49
Log in (anonymous is fine) to add a comment.