GNU bug report logs - #5958
Sort-8.4 bug

Previous Next

Package: coreutils;

Reported by: srodri <at> datsi.fi.upm.es

Date: Fri, 16 Apr 2010 12:14:02 UTC

Severity: normal

Merged with 5991

Fixed in version 8.5

Done: Eric Blake <eblake <at> redhat.com>

Bug is archived. No further changes may be made.

Full log


Message #32 received at 5958 <at> debbugs.gnu.org (full text, mbox):

From: Pádraig Brady <P <at> draigBrady.com>
To: Alan Curry <pacman-cu <at> kosh.dhis.org>
Cc: Santiago Rodriguez <srodri <at> fi.upm.es>, 5958 <at> debbugs.gnu.org,
	Eric Blake <eblake <at> redhat.com>, Jim Meyering <jim <at> meyering.net>
Subject: Re: bug#5958: Sort-8.4 bug
Date: Tue, 20 Apr 2010 17:35:11 +0100
[Message part 1 (text/plain, inline)]
On 20/04/10 09:37, Alan Curry wrote:
> --- coreutils-8.4.orig/src/sort.c	2010-04-20 02:45:35.000000000 -0500
> +++ coreutils-8.4/src/sort.c	2010-04-20 03:12:57.000000000 -0500
> @@ -1460,9 +1460,6 @@
>    char *ptr = line->text, *lim = ptr + line->length - 1;
>    size_t eword = key->eword, echar = key->echar;
>  
> -  if (echar == 0)
> -    eword++; /* Skip all of end field.  */
> -
>    /* Move PTR past EWORD fields or to one past the last byte on LINE,
>       whichever comes first.  If there are more than EWORD fields, leave
>       PTR pointing at the beginning of the field having zero-based index,
> @@ -3424,6 +3421,8 @@
>                    s = parse_field_count (s + 1, &key->echar,
>                                           N_("invalid number after `.'"));
>                  }
> +              if (key->echar == 0)
> +                key->eword++; /* Skip all of end field.  */
>                s = set_ordering (s, key, bl_end);
>              }
>            if (*s)

I've changed it around in the attached patch so that
we consistently use zero based limits throughout the code.
I'll push this later on tonight unless there are objections.

cheers,
Pádraig.

[sort-key-limit.diff (text/x-patch, attachment)]

This bug report was last modified 15 years and 35 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.