Skip Menu |

This queue is for tickets about the Tree-RedBlack CPAN distribution.

Report information
The Basics
Id: 19431
Status: open
Priority: 0/
Queue: Tree-RedBlack

People
Owner: Nobody in particular
Requestors: NIKC [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 0.3
Fixed in: (no value)



When using a custom comparator, the test to see whether the node's key is different to the parent key is broken. It inadvertently tests against the node's own key, instead of the parent. Herewith the trivial patch. --- src/RedBlack.pm (revision 15361) +++ src/RedBlack.pm (working copy) @@ -137,7 +137,7 @@ return $val; } $node = $parent->new($key, $value); - if ($this->{'cmp'} ? $this->{'cmp'}->($key, $node->key) < 0 + if ($this->{'cmp'} ? $this->{'cmp'}->($key, $parent->key) < 0 : $key lt $parent->key) { $parent->left($node); } else { Credit for this to Andre Lucas <andre@ae-35.com> who found and fixed it, I'm just reporting it on his behalf.
Subject: Re: [rt.cpan.org #19431]
Date: Tue, 23 May 2006 09:16:01 -0400 (GMT-04:00)
To: bug-Tree-RedBlack [...] rt.cpan.org, andre [...] ae-35.com
From: bholzman [...] earthlink.net
Andre, Nik, Thank you very much for the bug report. Despite the long time since T::RB was developed, I have not completely forgotten about it... I have some other patches for T::RB which I have been meaning to incorporate into a release, but unfortunately due to job shuffling they have been temporarily misplaced :( Once I locate them, I will include this fix. Thanks, Benjamin Holzman Show quoted text
-----Original Message-----
>From: via RT <bug-Tree-RedBlack@rt.cpan.org> >Sent: May 23, 2006 7:57 AM >To: undisclosed-recipients@null, null@null >Subject: [rt.cpan.org #19431] > > >Tue May 23 07:57:42 2006: Request 19431 was acted upon. >Transaction: Ticket created by NIKC > Queue: Tree-RedBlack > Subject: (No subject given) > Broken in: (no value) > Severity: Critical > Owner: Nobody > Requestors: NIKC@cpan.org > Status: new > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=19431 > > > >When using a custom comparator, the test to see whether the node's key >is different to the parent key is broken. It inadvertently tests >against the node's own key, instead of the parent. > >Herewith the trivial patch. > >--- src/RedBlack.pm (revision 15361) >+++ src/RedBlack.pm (working copy) >@@ -137,7 +137,7 @@ > return $val; > } > $node = $parent->new($key, $value); >- if ($this->{'cmp'} ? $this->{'cmp'}->($key, $node->key) < 0 >+ if ($this->{'cmp'} ? $this->{'cmp'}->($key, $parent->key) < 0 > : $key lt $parent->key) { > $parent->left($node); > } else { > >Credit for this to Andre Lucas <andre@ae-35.com> who found and fixed it, >I'm just reporting it on his behalf.
Subject: Tree-RedBlack: insert broken with custom comparison function
From: dam [...] modsoftsys.com
On Tue May 23 09:16:59 2006, bholzman@earthlink.net wrote: Show quoted text
> Thank you very much for the bug report. Despite the long time since > T::RB was developed, I have not completely forgotten about it... I > have some other patches for T::RB which I have been meaning to > incorporate into a release, but unfortunately due to job shuffling > they have been temporarily misplaced :( Once I locate them, I will > include this fix.
Any news on this? We just got the following bug[1] reported against the Debian package. I am going to patch the package with the included fix, but it would be better if I don't have to carry the patch forever (i.e. you release a fixed version) :) [1] http://bugs.debian.org/493064 -- dam Debian Perl Group Show quoted text
> >--- src/RedBlack.pm (revision 15361) > >+++ src/RedBlack.pm (working copy) > >@@ -137,7 +137,7 @@ > > return $val; > > } > > $node = $parent->new($key, $value); > >- if ($this->{'cmp'} ? $this->{'cmp'}->($key, $node->key) < 0 > >+ if ($this->{'cmp'} ? $this->{'cmp'}->($key, $parent->key) < 0 > > : $key lt $parent->key) { > > $parent->left($node); > > } else {
Subject: RE: [rt.cpan.org #19431] Tree-RedBlack: insert broken with custom comparison function
Date: Thu, 31 Jul 2008 08:15:09 -0400
To: <bug-Tree-RedBlack [...] rt.cpan.org>
From: "Benjamin Holzman" <bholzman [...] earthlink.net>
Oops, the things you can forget... Well, I never found the missing patches, so I guess I will just release a version with your fix below. Thanks, and my apologies, Ben Show quoted text
> -----Original Message----- > From: Damyan Ivanov via RT [mailto:bug-Tree-RedBlack@rt.cpan.org] > Sent: Thursday, July 31, 2008 2:33 AM > To: undisclosed-recipients: > Subject: [rt.cpan.org #19431] Tree-RedBlack: insert broken with custom > comparison function > > > Queue: Tree-RedBlack > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=19431 > > > On Tue May 23 09:16:59 2006, bholzman@earthlink.net wrote:
> > Thank you very much for the bug report. Despite the long time since > > T::RB was developed, I have not completely forgotten about it... I > > have some other patches for T::RB which I have been meaning to > > incorporate into a release, but unfortunately due to job shuffling > > they have been temporarily misplaced :( Once I locate them, I will > > include this fix.
> > Any news on this? We just got the following bug[1] reported against the > Debian package. I am going to patch the package with the included fix, > but it would be better if I don't have to carry the patch forever (i.e. > you release a fixed version) :) > > [1] http://bugs.debian.org/493064 > > -- > dam > Debian Perl Group >
> > >--- src/RedBlack.pm (revision 15361) > > >+++ src/RedBlack.pm (working copy) > > >@@ -137,7 +137,7 @@ > > > return $val; > > > } > > > $node = $parent->new($key, $value); > > >- if ($this->{'cmp'} ? $this->{'cmp'}->($key, $node->key) < 0 > > >+ if ($this->{'cmp'} ? $this->{'cmp'}->($key, $parent->key) < 0 > > > : $key lt $parent->key) { > > > $parent->left($node); > > > } else {
> >
On 2008-07-31 08:15:43, bholzman@earthlink.net wrote: Show quoted text
> Oops, the things you can forget... Well, I never found the missing > patches, so I guess I will just release a version with your fix below. >
It seems that this issue is already addressed and fixed in 0.4, so it may be set to resolved? Regards, Slaven Show quoted text
>
> > -----Original Message----- > > From: Damyan Ivanov via RT [mailto:bug-Tree-RedBlack@rt.cpan.org] > > Sent: Thursday, July 31, 2008 2:33 AM > > To: undisclosed-recipients: > > Subject: [rt.cpan.org #19431] Tree-RedBlack: insert broken with > > custom > > comparison function > > > > > > Queue: Tree-RedBlack > > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=19431 > > > > > On Tue May 23 09:16:59 2006, bholzman@earthlink.net wrote:
> > > Thank you very much for the bug report. Despite the long time > > > since > > > T::RB was developed, I have not completely forgotten about it... > > > I > > > have some other patches for T::RB which I have been meaning to > > > incorporate into a release, but unfortunately due to job > > > shuffling > > > they have been temporarily misplaced :( Once I locate them, I > > > will > > > include this fix.
> > > > Any news on this? We just got the following bug[1] reported against > > the > > Debian package. I am going to patch the package with the included > > fix, > > but it would be better if I don't have to carry the patch forever > > (i.e. > > you release a fixed version) :) > > > > [1] http://bugs.debian.org/493064 > > > > -- > > dam > > Debian Perl Group > >
> > > > --- src/RedBlack.pm (revision 15361) > > > > +++ src/RedBlack.pm (working copy) > > > > @@ -137,7 +137,7 @@ > > > > return $val; > > > > } > > > > $node = $parent->new($key, $value); > > > > - if ($this->{'cmp'} ? $this->{'cmp'}->($key, $node->key) < 0 > > > > + if ($this->{'cmp'} ? $this->{'cmp'}->($key, $parent->key) < > > > > 0 > > > > : $key lt $parent->key) { > > > > $parent->left($node); > > > > } else {
> > > >
Subject: Re: [rt.cpan.org #19431]
Date: Tue, 3 Dec 2013 09:39:42 -0500
To: bug-Tree-RedBlack [...] rt.cpan.org
From: Benjamin Holzman <bholzman [...] gmail.com>
Yes, this has been resolved. On Tue, Dec 3, 2013 at 7:40 AM, Slaven_Rezic via RT < bug-Tree-RedBlack@rt.cpan.org> wrote: Show quoted text
> Queue: Tree-RedBlack > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=19431 > > > On 2008-07-31 08:15:43, bholzman@earthlink.net wrote:
> > Oops, the things you can forget... Well, I never found the missing > > patches, so I guess I will just release a version with your fix below. > >
> > It seems that this issue is already addressed and fixed in 0.4, so it may > be set to resolved? > > Regards, > Slaven >
> >
> > > -----Original Message----- > > > From: Damyan Ivanov via RT [mailto:bug-Tree-RedBlack@rt.cpan.org] > > > Sent: Thursday, July 31, 2008 2:33 AM > > > To: undisclosed-recipients: > > > Subject: [rt.cpan.org #19431] Tree-RedBlack: insert broken with > > > custom > > > comparison function > > > > > > > > > Queue: Tree-RedBlack > > > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=19431 > > > > > > > On Tue May 23 09:16:59 2006, bholzman@earthlink.net wrote:
> > > > Thank you very much for the bug report. Despite the long time > > > > since > > > > T::RB was developed, I have not completely forgotten about it... > > > > I > > > > have some other patches for T::RB which I have been meaning to > > > > incorporate into a release, but unfortunately due to job > > > > shuffling > > > > they have been temporarily misplaced :( Once I locate them, I > > > > will > > > > include this fix.
> > > > > > Any news on this? We just got the following bug[1] reported against > > > the > > > Debian package. I am going to patch the package with the included > > > fix, > > > but it would be better if I don't have to carry the patch forever > > > (i.e. > > > you release a fixed version) :) > > > > > > [1] http://bugs.debian.org/493064 > > > > > > -- > > > dam > > > Debian Perl Group > > >
> > > > > --- src/RedBlack.pm (revision 15361) > > > > > +++ src/RedBlack.pm (working copy) > > > > > @@ -137,7 +137,7 @@ > > > > > return $val; > > > > > } > > > > > $node = $parent->new($key, $value); > > > > > - if ($this->{'cmp'} ? $this->{'cmp'}->($key, $node->key) < 0 > > > > > + if ($this->{'cmp'} ? $this->{'cmp'}->($key, $parent->key) < > > > > > 0 > > > > > : $key lt $parent->key) { > > > > > $parent->left($node); > > > > > } else {
> > > > > >
> > > >