Subject: bug#6600: [PATCH] sort: add --threads option to parallelize internal sort.

From: Pádraig Brady <[email-masked]>
Date: Thu, 15 Jul 2010 12:11:23 +0100

On 15/07/10 01:07, Pádraig Brady wrote:
> On 13/07/10 01:59, Pádraig Brady wrote:
>> I've finally applied the patch.
>> http://git.savannah.gnu.org/gitweb/?p=coreutils.git;a=commit;h=9face836
>>
>> I made a few comment tweaks and added
>> some dependencies for the heap module.
>>
>> I also removed the xmemcoll0() calls
>> which are separate to this concurrent functionality.
>> I will add those back in Chen's name after updating to
>> the latest gnulib.
>>
>> Thanks everyone for their work on this!
>>
>> Pádraig.
> 
> Here's the xmemcoll0 follow up:

And a follow up fix to that which
fixes 2 test failures noticed on our integration server:
http://hydra.nixos.org/build/486508

commit aadc67dfdb47f28bb8d1fa5e0fe0f52e2a8c51bf
Author: Pádraig Brady <[email-masked]>
Date:   Thu Jul 15 12:06:04 2010 +0100

    sort: fix a bug when sorting unterminated lines

    * src/sort.c (fillbuf): The previous commit incorrectly
    terminated the buffer when the last line of input
    didn't contain a terminating character.

diff --git a/src/sort.c b/src/sort.c
index 45cb78f..7d31878 100644
--- a/src/sort.c
+++ b/src/sort.c
@@ -1743,7 +1743,7 @@ fillbuf (struct buffer *buf, FILE *fp, char const *file)
                   if (buf->buf == ptrlim)
                     return false;
                   if (ptrlim[-1] != eol)
-                    *ptrlim++ = '\0';
+                    *ptrlim++ = eol;
                 }
             }