some order of options to lsort results in strange error
Closed / Fixed219119ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2000-10-26 01:11:03
OriginalBugID: 6212 Bug
Version: 8.4a1
SubmitDate: '2000-09-05'
LastModified: '2000-09-17'
Severity: LOW
Status: Released
Submitter: techsupp
ChangedBy: ericm
OS: All
FixedDate: '2000-09-17'
FixedInVersion: 8.4a2
ClosedDate: '2000-10-25'
Name:
Harald Kirsch
ReproducibleScript:
# run this script.
proc cmplen {a b} {
return [expr {[string length $a] - [string length $b]}]
}
set S {
{xxx "sdafkj "}
{yyy "sf"}
}
puts [lsort -index 1 -command cmplen -decreasing $S]
puts ---------
puts [lsort -command cmplen -decreasing -index 1 $S]
ObservedBehavior:
Both lsort commands should work, but only the first one does. The 2nd gives the error
invalid command name "1"
while executing
"1 {sdafkj } sf"
(-compare command)
invoked from within
"lsort -command cmplen -decreasing -index 1 $S"
invoked from within
"puts [lsort -command cmplen -decreasing -index 1 $S]
DesiredBehavior:
No error should occur.
Patch from Kuchler (needs tests as well):
The following change to the current CVS 8.4 sources will
fix the problem. For those working off of an older version,
simpley remove the 'cmdPtr = objv[i+1];' line from
tclCmdIL.c in the function Tcl_LsortObjCmd in the handling
for the '-index' flag in the argument processing for loop.
diff -c -r1.27 tclCmdIL.c
*** tclCmdIL.c 2000/05/27 23:58:01 1.27
--- tclCmdIL.c 2000/09/05 08:07:06
***************
*** 2759,2765 ****
!= TCL_OK) {
return TCL_ERROR;
}
- cmdPtr = objv[i+1];
i++;
break;
case 6: /* -integer */
--- 2759,2764 ----
-- 09/05/2000 hobbs
I applied this patch and added test cases for it. The fix will be included in Tcl 8.4a2. Nice work, everybody.
Eric Melski The Other Tcl Guy
ericm at ajubasolutions.com Ajuba Solutions
-- 09/17/2000 ericm
welch Closed ticket [219119ffff].
[History diff]2000-10-26 08:34:57
dgp Ticket [219119ffff]: 3 changes
[History diff]2001-04-05 08:02:00
Log in (anonymous is fine) to add a comment.