Re: [Mutt] #2515: Sorting by from or to in index is sometimes
#2515: Sorting by from or to in index is sometimes incorrect
Old description:
> {{{
> When a mailbox contains entries with "To" addresses that consist solely
> of the email address, then sorting in the index by "To" is sometimes
> inconsistent. An operation like "sort by to, sort by date, sort by to,
> sort by thread, and sort by to" should leave the index in the same order
> after each "sort by to". However, it does not some of the time.
> >How-To-Repeat:
> >Fix:
> Attached is a patch that fixes this for me. In sort.c:compare_to(),
> mutt_get_name() is called twice in a row. In the buggy cases,
> mutt_addr_for_display() in mutt_get_name() is called twice. In
> mutt_addr_for_display(), the returned pointer is a static variable that
> is immediately FREE'd and barring no failures is safe_realloc'ed and
> returned with results. The patch makes a copy of the first address, so
> it is not destroyed by the second. Identical changes were made to the
> compare_from() function.
> }}}
New description:
When a mailbox contains entries with "To" addresses that consist solely of
the email address, then sorting in the index by "To" is sometimes
inconsistent. An operation like "sort by to, sort by date, sort by to,
sort by thread, and sort by to" should leave the index in the same order
after each "sort by to". However, it does not some of the time.
>How-To-Repeat:
>Fix:
Attached is a patch that fixes this for me. In sort.c:compare_to(),
mutt_get_name() is called twice in a row. In the buggy cases,
mutt_addr_for_display() in mutt_get_name() is called twice. In
mutt_addr_for_display(), the returned pointer is a static variable that is
immediately FREE'd and barring no failures is safe_realloc'ed and returned
with results. The patch makes a copy of the first address, so it is not
destroyed by the second. Identical changes were made to the
compare_from() function.
--
Ticket URL: <http://dev.mutt.org/trac/ticket/2515#comment:3>