Overview
| Artifact ID: | 9891748bef5b77cef792f270202fbeed2234d6eb |
|---|---|
| Ticket: | 218895ffffffffffffffffffffffffffffffffff
info exists command - invalid return code |
| User & Date: | nobody on 2000-10-26 01:07:20 |
Changes
- assignee changed to: "nobody"
- cmimetype changed to: "text/plain"
- comment changed to:
OriginalBugID: 2587 Bug Version: 8.0p2 SubmitDate: '1999-08-20' LastModified: '1999-08-20' Severity: CRIT Status: Released Submitter: techsupp ChangedBy: hobbs OS: Other OSVersion: Win98, WinNT4.0 Machine: NA FixedDate: '1999-08-20' FixedInVersion: 8.0.5 ClosedDate: '2000-10-25' Name: Stuart Smith Extensions: No extensions have been loaded CustomShell: Only the addition of Icons into the wish80.exe file - modification of the RC file only ReproducibleScript: We are moving towards 8.0.5 from 8.0p2 so that we can make use of TCL Pro (the compiler side) and I have noticed an anomoly in the way info exists works. Below is a small script file that works as expected under 8.0p2, yet fails under 8.0.5. This test script was performed within a 'clean' Wish80 console. set smeg(1,1) 1 set smeg(2,1) 2 set smeg(3,1) 3 set smeg(4,1) 4 set smeg(5,1) 5 set smeg(6,1) 6 set smeg(7,1) 7 set smeg(8,1) 8 set smeg(9,1) 9 set smeg(10,1) 10 set smeg(11,1) 11 set smeg(12,1) 12 set smeg(13,1) 13 set smeg(14,1) 14 set smeg(15,1) 15 set smeg(16,1) 16 set smeg(17,1) 17 set count 1 while [info exists smeg($count,1)] { puts "Looking at smeg($count,1) which contains $smeg($count,1)" incr count } ObservedBehavior: Under 8.0p2, the routine displays the following:- Looking at smeg(1,1) which contains 1 Looking at smeg(2,1) which contains 2 Looking at smeg(3,1) which contains 3 Looking at smeg(4,1) which contains 4 Looking at smeg(5,1) which contains 5 Looking at smeg(6,1) which contains 6 Looking at smeg(7,1) which contains 7 Looking at smeg(8,1) which contains 8 Looking at smeg(9,1) which contains 9 Looking at smeg(10,1) which contains 10 Looking at smeg(11,1) which contains 11 Looking at smeg(12,1) which contains 12 Looking at smeg(13,1) which contains 13 Looking at smeg(14,1) which contains 14 Looking at smeg(15,1) which contains 15 Looking at smeg(16,1) which contains 16 Looking at smeg(17,1) which contains 17 under 8.0.5 it displays the following:- Looking at smeg(1,1) which contains 1 Looking at smeg(2,1) which contains 2 Looking at smeg(3,1) which contains 3 Looking at smeg(4,1) which contains 4 Looking at smeg(5,1) which contains 5 Looking at smeg(6,1) which contains 6 Looking at smeg(7,1) which contains 7 Looking at smeg(8,1) which contains 8 Looking at smeg(9,1) which contains 9 Looking at smeg(10,1) which contains 10 Looking at smeg(11,1) which contains 11 Looking at smeg(12,1) which contains 12 Looking at smeg(13,1) which contains 13 Looking at smeg(14,1) which contains 14 Looking at smeg(15,1) which contains 15 Looking at smeg(16,1) which contains 16 Looking at smeg(17,1) which contains 17 can't read "smeg(18,1)": no such element in array DesiredBehavior: I would have expected both outputs to be exatly the same. The info exists command should have caught the fact that element 18,1 does not exist and fail the while statement, allowing the program to terminate without warnings. Actually, this was a bug in 8.0p2 and is fixed in 8.0.5. This line: while [info exists smeg($count,1)] { is a programming error. Following Tcl syntax, the [] is only eval'd the first time, to 1. Then the loop continues until an error occurs. Conditionals require braces in almost all cases. -- 08/20/1999 hobbs - foundin changed to: "obsolete: 8.0p2"
- priority changed to: "5 Medium"
- resolution changed to: "None"
- status changed to: "Open"
- submitter changed to: "nobody"
- subsystem changed to: "69. Other"
- title changed to: "info exists command - invalid return code"
- type changed to: "Bug"