[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#9780: sort -u throws out non-duplicates
From: |
Jim Meyering |
Subject: |
bug#9780: sort -u throws out non-duplicates |
Date: |
Fri, 17 Aug 2012 21:36:32 +0200 |
Paul Eggert wrote:
> On 08/16/2012 02:03 PM, Jim Meyering wrote:
>> * src/sort.c (saved_line): New static/global, renamed and moved from...
>> (write_unique): ...here.
>
> I see a couple of problems with this patch. Pedantically,
> the behavior of 'overlap' is undefined on hosts that
> use a segmented architecture, because '<=' is not reliable
> on pointers into different buffers. (I have the vague recollection
> that some compilers even rely on this to generate faster code
> on flat architectures....)
I pushed the change seconds before your message arrived.
But that's probably best. If you can change it to do the job
reliably even on fringe systems, that would be welcome.
> More importantly, suppose the
> buffer is reallocated (because it grows)? Won't 'overlap'
> do the wrong thing after that?
How? The first time the safe_text buffer is allocated
it will have to be disjoint from the line.text buffer
and from the buffer into which we're about to fread.
Thereafter, regardless of reallocation, overlap should
always be false.
> And it'd be nice if we didn't
> have to worry about making a copy of that line.
It appears that the need to copy a line (overlap)
is very rare, in practice. If you find a way to avoid it,
it seems like it would have to be small and simple to be
worthwhile.
> I'll see if I can come up with something that addresses these
> objectinos.
Thanks!
And thanks for the review.
- bug#9780: sort -u throws out non-duplicates, (continued)
- bug#9780: sort -u throws out non-duplicates, Jim Meyering, 2012/08/15
- bug#9780: sort -u throws out non-duplicates, Jim Meyering, 2012/08/16
- bug#9780: sort -u throws out non-duplicates, Jim Meyering, 2012/08/16
- bug#9780: sort -u throws out non-duplicates, Bernhard Voelker, 2012/08/16
- bug#9780: sort -u throws out non-duplicates, Jim Meyering, 2012/08/16
- bug#9780: sort -u throws out non-duplicates, Jim Meyering, 2012/08/16
- bug#9780: sort -u data loss deserves new release ASAP [Re: bug#9780: sort -u..., Jim Meyering, 2012/08/17
- bug#9780: sort -u data loss deserves new release ASAP [Re: bug#9780: sort -u..., Bernhard Voelker, 2012/08/17
- bug#9780: sort -u data loss deserves new release ASAP [Re: bug#9780: sort -u..., Jim Meyering, 2012/08/17
- bug#9780: sort -u throws out non-duplicates, Paul Eggert, 2012/08/17
- bug#9780: sort -u throws out non-duplicates,
Jim Meyering <=
- bug#9780: sort -u throws out non-duplicates, Paul Eggert, 2012/08/17
- bug#9780: sort -u throws out non-duplicates, Jim Meyering, 2012/08/17
- bug#9780: sort -u throws out non-duplicates, Paul Eggert, 2012/08/17
- bug#9780: sort -u throws out non-duplicates, Jim Meyering, 2012/08/17
- bug#9780: sort -u throws out non-duplicates, Paul Eggert, 2012/08/17
- bug#9780: sort -u throws out non-duplicates, Jim Meyering, 2012/08/20
- bug#9780: sort -u throws out non-duplicates, Paul Eggert, 2012/08/17
- bug#9780: sort -u throws out non-duplicates, Jim Meyering, 2012/08/17
- bug#9780: sort -u throws out non-duplicates, Jim Meyering, 2012/08/18
- bug#9780: sort -u throws out non-duplicates, Paul Eggert, 2012/08/18