[illumos-Developer] tr webrev

Joerg Schilling Joerg.Schilling at fokus.fraunhofer.de
Tue Sep 7 03:34:18 PDT 2010


John Grafton <john.grafton at gmail.com> wrote:

> I found a bug in the FreeBSD tr implementation that's causing it to fail
> most tests.  I submitted a new webrev a few minutes ago which changes one
> line in cset.c.
>
> The entire problem with the FreeBSD tr seems to revolve around an incorrect
> return of cset_rangecmp (line 158 of cset.c).  The incorrect return corrupts
> the cache for all values below the lowest value in your search range.  The
> splay tree functions work great, but since the cache building process was
> broken, all functions that relied upon the cache (most of them) failed to
> correctly identify the proper characters.
>
> The fix was simple, add a bool typecast to the return.  Change line 158 of
> cset.c from:
> return ((cs->cs_invert ^ cset_rangecmp(cs->cs_root, ch)) == 0);
>
> to:
> return ((cs->cs_invert ^ (bool) cset_rangecmp(cs->cs_root, ch)) == 0);
>
> http://cr.illumos.org/view/b8z5ojjd/

What did you test and what result did change for you?

my test schows the same problem:

prtconf | grep Mem | /tmp/tr -dc '[0-9]'
 : 1024 

Jörg

-- 
 EMail:joerg at schily.isdn.cs.tu-berlin.de (home) Jörg Schilling D-13353 Berlin
       js at cs.tu-berlin.de                (uni)  
       joerg.schilling at fokus.fraunhofer.de (work) Blog: http://schily.blogspot.com/
 URL:  http://cdrecord.berlios.de/private/ ftp://ftp.berlios.de/pub/schily



More information about the Developer mailing list