Skip to content
Tcl Source Code View Ticket
Login

View Ticket

patch for lsort -dictionary: bug sorting string beginning wi

Closed / Fixed218489ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2000-10-26 01:01:12
OriginalBugID: 706 Bug
Version: 8.0.4
SubmitDate: '1998-10-13'
LastModified: '1998-10-13'
Severity: SER
Status: Released
Submitter: admin
ChangedBy: rjohnson
OS: All
OSVersion: NA
Machine: NA
FixedDate: '1998-10-13'
FixedInVersion: NA
ClosedDate: '2000-10-25'


>> Jarle Greipsland wrote:
>> > I believe there is a bug in the lsort function when the -dictionary
style
>> > comparisons are used.
>> >
>> > Example:
>> > % lsort -dictionary {0k 1k 10k}
>> > 1k 0k 10k
>> >
>> > As I understand the documentation for this option the correct result
should
>> > have been {0k 1k 10k}.  Perhaps this should be fixed in tcl8.1?
>> >
>> Bug is still present in 8.1a2 (same bad results on NT).
>
>I think the patch shown below applied to the
>"generic/tclCmdIL.c" source file may fix the problem.
>
>*** tclCmdIL.c  Fri Aug  7 16:19:52 1998
>--- tclCmdIL.c.new      Sun Aug 30 19:07:26 1998
>***************
>*** 2863,2873 ****
>             */
>  
>            zeros = 0;
>!           while ((*right == '0') && (*(right + 1) != '\0')) {
>                right++;
>                zeros--;
>            }
>!           while ((*left == '0') && (*(left + 1) != '\0')) {
>                left++;
>                zeros++;
>            }
>--- 2863,2873 ----
>             */
>  
>            zeros = 0;
>!           while ((*right == '0') && (isdigit(UCHAR(right[1])))) {
>                right++;
>                zeros--;
>            }
>!           while ((*left == '0') && (isdigit(UCHAR(left[1])))) {
>                left++;
>                zeros++;
>            }
                        .
                        .
                        .
!  Am I reading that correctly?  Lexicographic sorting which
encounters any string which begins with a zero, and embeds
non-digits, is likely to be in error?  That sounds important.

What's the process, again?  Does Scriptics write you an
acknowledgement, or is there a place under www.scriptics.com
where faults are analyzed, or what?
welch Closed ticket [218489ffff]. [History diff]2000-10-26 08:23:17
dgp Ticket [218489ffff]: 3 changes [History diff]2001-04-16 23:32:42
Log in (anonymous is fine) to add a comment.