Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2001-09-28
22:32 • Closed ticket [465674ffff]: lsort -index end-1 problem plus 3 other change... artifact: 1ebaa501d6 user: dkf
2001-09-27
14:37 • New ticket [465674ffff]. artifact: 5532f611db user: dkf

[lsort -index end-1] problem

Closed / Fixed465674ffffffffffffffffffffffffffffffffffCreated 25 years agoUpdated 25 years ago
Descriptionplain2001-09-27 14:37:51
The index 'end-1' (or with any other offset from the
end) is processed by [lsort] exactly as if it was the
index 'end' without an offset.  Thus

  % set l {{d b c} {a c b}}
  {d b c} {a c b}
  % lsort $l                 ;# OK
  {a c b} {d b c}
  % lsort -index end $l      ;# OK
  {a c b} {d b c}
  % lsort -index end-1 $l    ;# WRONG WAY ROUND!
  {a c b} {d b c}

The fault is because SortCompare in tclCmdIL.c always
sets 'index' to 'listLen - 1' when 'infoPtr->index' is
less than -1 instead of using the value that is
actually there (i.e. 'listLen + 1 + infoPtr->index')
dkf Closed ticket [465674ffff]. [History diff]2001-09-28 22:32:36
Log in (anonymous is fine) to add a comment.