Обсуждение: Fix proposal for comparaison bugs in PostgreSQL::Version

Поиск
Список
Период
Сортировка

Fix proposal for comparaison bugs in PostgreSQL::Version

От
Jehan-Guillaume de Rorthais
Дата:
Hi,

I found a comparaison bug when using the PostgreSQL::Version module. See:

  $ perl -I. -MPostgreSQL::Version -le '
    my $v = PostgreSQL::Version->new("9.6");
  
    print "not 9.6 > 9.0" unless $v >  9.0;
    print "not 9.6 < 9.0" unless $v <  9.0;
    print "9.6 <= 9.0"    if     $v <= 9.0;
    print "9.6 >= 9.0"    if     $v >= 9.0;'
  not 9.6 > 9.0
  not 9.6 < 9.0
  9.6 <= 9.0
  9.6 >= 9.0

When using < or >, 9.6 is neither greater or lesser than 9.0. 
When using <= or >=, 9.6 is equally greater and lesser than 9.0.
The bug does not show up if you compare with "9.0" instead of 9.0.
This bug is triggered with devel versions, eg. 14beta1 <=> 14.

The bug appears when both objects have a different number of digit in the
internal array representation:

  $ perl -I. -MPostgreSQL::Version -MData::Dumper -le '
    print Dumper(PostgreSQL::Version->new("9.0")->{num});
    print Dumper(PostgreSQL::Version->new(9.0)->{num});
    print Dumper(PostgreSQL::Version->new(14)->{num});
    print Dumper(PostgreSQL::Version->new("14beta1")->{num});'
  $VAR1 = [ '9', '0' ];
  $VAR1 = [ '9' ];
  $VAR1 = [ '14' ];
  $VAR1 = [ '14', -1 ];

Because of this, The following loop in "_version_cmp" is wrong because we are
comparing two versions with different size of 'num' array:

    for (my $idx = 0;; $idx++)
    {
        return 0 unless (defined $an->[$idx] && defined $bn->[$idx]);
        return $an->[$idx] <=> $bn->[$idx]
          if ($an->[$idx] <=> $bn->[$idx]);
    }


If we want to keep this internal array representation, the only fix I can think
of would be to always use a 4 element array defaulted to 0. Previous examples
would be:

  $VAR1 = [ 9, 0, 0, 0 ];
  $VAR1 = [ 9, 0, 0, 0 ];
  $VAR1 = [ 14, 0, 0, 0 ];
  $VAR1 = [ 14, 0, 0, -1 ];

A better fix would be to store the version internally as version_num that are
trivial to compute and compare. Please, find in attachment an implementation of
this.

The patch is a bit bigger because it improved the devel version to support
rc/beta/alpha comparison like 14rc2 > 14rc1.

Moreover, it adds a bunch of TAP tests to check various use cases.

Regards,

Вложения

Re: Fix proposal for comparaison bugs in PostgreSQL::Version

От
Andrew Dunstan
Дата:
On 2022-06-28 Tu 16:53, Jehan-Guillaume de Rorthais wrote:
> Hi,
>
> I found a comparaison bug when using the PostgreSQL::Version module. See:
>
>   $ perl -I. -MPostgreSQL::Version -le '
>     my $v = PostgreSQL::Version->new("9.6");
>   
>     print "not 9.6 > 9.0" unless $v >  9.0;
>     print "not 9.6 < 9.0" unless $v <  9.0;
>     print "9.6 <= 9.0"    if     $v <= 9.0;
>     print "9.6 >= 9.0"    if     $v >= 9.0;'
>   not 9.6 > 9.0
>   not 9.6 < 9.0
>   9.6 <= 9.0
>   9.6 >= 9.0
>
> When using < or >, 9.6 is neither greater or lesser than 9.0. 
> When using <= or >=, 9.6 is equally greater and lesser than 9.0.
> The bug does not show up if you compare with "9.0" instead of 9.0.
> This bug is triggered with devel versions, eg. 14beta1 <=> 14.
>
> The bug appears when both objects have a different number of digit in the
> internal array representation:
>
>   $ perl -I. -MPostgreSQL::Version -MData::Dumper -le '
>     print Dumper(PostgreSQL::Version->new("9.0")->{num});
>     print Dumper(PostgreSQL::Version->new(9.0)->{num});
>     print Dumper(PostgreSQL::Version->new(14)->{num});
>     print Dumper(PostgreSQL::Version->new("14beta1")->{num});'
>   $VAR1 = [ '9', '0' ];
>   $VAR1 = [ '9' ];
>   $VAR1 = [ '14' ];
>   $VAR1 = [ '14', -1 ];
>
> Because of this, The following loop in "_version_cmp" is wrong because we are
> comparing two versions with different size of 'num' array:
>
>     for (my $idx = 0;; $idx++)
>     {
>         return 0 unless (defined $an->[$idx] && defined $bn->[$idx]);
>         return $an->[$idx] <=> $bn->[$idx]
>           if ($an->[$idx] <=> $bn->[$idx]);
>     }
>
>
> If we want to keep this internal array representation, the only fix I can think
> of would be to always use a 4 element array defaulted to 0. Previous examples
> would be:
>
>   $VAR1 = [ 9, 0, 0, 0 ];
>   $VAR1 = [ 9, 0, 0, 0 ];
>   $VAR1 = [ 14, 0, 0, 0 ];
>   $VAR1 = [ 14, 0, 0, -1 ];
>
> A better fix would be to store the version internally as version_num that are
> trivial to compute and compare. Please, find in attachment an implementation of
> this.
>
> The patch is a bit bigger because it improved the devel version to support
> rc/beta/alpha comparison like 14rc2 > 14rc1.
>
> Moreover, it adds a bunch of TAP tests to check various use cases.


Nice catch, but this looks like massive overkill. I think we can very
simply fix the test in just a few lines of code, instead of a 190 line
fix and a 130 line TAP test.

It was never intended to be able to compare markers like rc1 vs rc2, and
I don't see any need for it. If you can show me a sane use case I'll
have another look, but right now it seems quite unnecessary.

Here's my proposed fix.


cheers


andrew


--
Andrew Dunstan
EDB: https://www.enterprisedb.com

Вложения

Re: Fix proposal for comparaison bugs in PostgreSQL::Version

От
Michael Paquier
Дата:
On Tue, Jun 28, 2022 at 06:17:40PM -0400, Andrew Dunstan wrote:
> Nice catch, but this looks like massive overkill. I think we can very
> simply fix the test in just a few lines of code, instead of a 190 line
> fix and a 130 line TAP test.
>
> It was never intended to be able to compare markers like rc1 vs rc2, and
> I don't see any need for it. If you can show me a sane use case I'll
> have another look, but right now it seems quite unnecessary.
>
> Here's my proposed fix.

Do you think that we should add some tests for that?  One place that
comes into mind is test_misc/, and this would be cheap as this does
not require setting up a node or such.
--
Michael

Вложения

Re: Fix proposal for comparaison bugs in PostgreSQL::Version

От
Jehan-Guillaume de Rorthais
Дата:
On Tue, 28 Jun 2022 18:17:40 -0400
Andrew Dunstan <andrew@dunslane.net> wrote:

> On 2022-06-28 Tu 16:53, Jehan-Guillaume de Rorthais wrote:
> > ...
> > A better fix would be to store the version internally as version_num that
> > are trivial to compute and compare. Please, find in attachment an
> > implementation of this.
> >
> > The patch is a bit bigger because it improved the devel version to support
> > rc/beta/alpha comparison like 14rc2 > 14rc1.
> >
> > Moreover, it adds a bunch of TAP tests to check various use cases.  
> 
> 
> Nice catch, but this looks like massive overkill. I think we can very
> simply fix the test in just a few lines of code, instead of a 190 line
> fix and a 130 line TAP test.

I explained why the patch was a little bit larger than required: it fixes the
bugs and do a little bit more. The _version_cmp sub is shorter and easier to
understand, I use multi-line code where I could probably fold them in a
one-liner, added some comments... Anyway, I don't feel the number of line
changed is "massive". But I can probably remove some code and shrink some other
if it is really important...

Moreover, to be honest, I don't mind the number of additional lines of TAP
tests. Especially since it runs really, really fast and doesn't hurt day-to-day
devs as it is independent from other TAP tests anyway. It could be 1k, if it
runs fast, is meaningful and helps avoiding futur regressions, I would welcome
the addition.

If we really want to save some bytes, I have a two lines worth of code fix that
looks more readable to me than fixing _version_cmp:

+++ b/src/test/perl/PostgreSQL/Version.pm
@@ -92,9 +92,13 @@ sub new
        # Split into an array
        my @numbers = split(/\./, $arg);
 
+       # make sure all digit of the array-represented version are set so we can
+       # keep _version_cmp code as a "simple" digit-to-digit comparison loop
+       $numbers[$_] += 0 for 0..3;
+
        # Treat development versions as having a minor/micro version one less than
        # the first released version of that branch.
-       push @numbers, -1 if ($devel);
+       $numbers[3] = -1 if $devel;
 
        $devel ||= "";
 
But again, in my humble opinion, the internal version array representation is
more a burden we should replace by the version_num...

> It was never intended to be able to compare markers like rc1 vs rc2, and
> I don't see any need for it. If you can show me a sane use case I'll
> have another look, but right now it seems quite unnecessary.

I don't have a practical use case right now, but I thought the module
would be more complete with these little few more line of codes. Now, keep in
mind these TAP modules might help external projects, not just core.

In fact, I wonder what was your original use case to support
devel/alpha/beta/rc versions, especially since it was actually not working?
Should we just get rid of this altogether and wait for an actual use case?

Cheers,



Re: Fix proposal for comparaison bugs in PostgreSQL::Version

От
Andrew Dunstan
Дата:
On 2022-06-29 We 05:09, Jehan-Guillaume de Rorthais wrote:
> On Tue, 28 Jun 2022 18:17:40 -0400
> Andrew Dunstan <andrew@dunslane.net> wrote:
>
>> On 2022-06-28 Tu 16:53, Jehan-Guillaume de Rorthais wrote:
>>> ...
>>> A better fix would be to store the version internally as version_num that
>>> are trivial to compute and compare. Please, find in attachment an
>>> implementation of this.
>>>
>>> The patch is a bit bigger because it improved the devel version to support
>>> rc/beta/alpha comparison like 14rc2 > 14rc1.
>>>
>>> Moreover, it adds a bunch of TAP tests to check various use cases.  
>>
>> Nice catch, but this looks like massive overkill. I think we can very
>> simply fix the test in just a few lines of code, instead of a 190 line
>> fix and a 130 line TAP test.
> I explained why the patch was a little bit larger than required: it fixes the
> bugs and do a little bit more. The _version_cmp sub is shorter and easier to
> understand, I use multi-line code where I could probably fold them in a
> one-liner, added some comments... Anyway, I don't feel the number of line
> changed is "massive". But I can probably remove some code and shrink some other
> if it is really important...
>
> Moreover, to be honest, I don't mind the number of additional lines of TAP
> tests. Especially since it runs really, really fast and doesn't hurt day-to-day
> devs as it is independent from other TAP tests anyway. It could be 1k, if it
> runs fast, is meaningful and helps avoiding futur regressions, I would welcome
> the addition.


I don't see the point of having a TAP test at all. We have TAP tests for
testing the substantive products we test, not for the test suite
infrastructure. Otherwise, where will we stop? Shall we have tests for
the things that test the test suite?


>
> If we really want to save some bytes, I have a two lines worth of code fix that
> looks more readable to me than fixing _version_cmp:
>
> +++ b/src/test/perl/PostgreSQL/Version.pm
> @@ -92,9 +92,13 @@ sub new
>         # Split into an array
>         my @numbers = split(/\./, $arg);
>  
> +       # make sure all digit of the array-represented version are set so we can
> +       # keep _version_cmp code as a "simple" digit-to-digit comparison loop
> +       $numbers[$_] += 0 for 0..3;
> +
>         # Treat development versions as having a minor/micro version one less than
>         # the first released version of that branch.
> -       push @numbers, -1 if ($devel);
> +       $numbers[3] = -1 if $devel;
>  
>         $devel ||= "";


I don't see why this is any more readable.


cheers


andrew


--
Andrew Dunstan
EDB: https://www.enterprisedb.com




Re: Fix proposal for comparaison bugs in PostgreSQL::Version

От
Jehan-Guillaume de Rorthais
Дата:
On Sun, 3 Jul 2022 10:40:21 -0400
Andrew Dunstan <andrew@dunslane.net> wrote:

> On 2022-06-29 We 05:09, Jehan-Guillaume de Rorthais wrote:
> > On Tue, 28 Jun 2022 18:17:40 -0400
> > Andrew Dunstan <andrew@dunslane.net> wrote:
> >  
> >> On 2022-06-28 Tu 16:53, Jehan-Guillaume de Rorthais wrote:  
> >>> ...
> >>> A better fix would be to store the version internally as version_num that
> >>> are trivial to compute and compare. Please, find in attachment an
> >>> implementation of this.
> >>>
> >>> The patch is a bit bigger because it improved the devel version to support
> >>> rc/beta/alpha comparison like 14rc2 > 14rc1.
> >>>
> >>> Moreover, it adds a bunch of TAP tests to check various use cases.    
> >>
> >> Nice catch, but this looks like massive overkill. I think we can very
> >> simply fix the test in just a few lines of code, instead of a 190 line
> >> fix and a 130 line TAP test.  
> > I explained why the patch was a little bit larger than required: it fixes
> > the bugs and do a little bit more. The _version_cmp sub is shorter and
> > easier to understand, I use multi-line code where I could probably fold
> > them in a one-liner, added some comments... Anyway, I don't feel the number
> > of line changed is "massive". But I can probably remove some code and
> > shrink some other if it is really important...
> >
> > Moreover, to be honest, I don't mind the number of additional lines of TAP
> > tests. Especially since it runs really, really fast and doesn't hurt
> > day-to-day devs as it is independent from other TAP tests anyway. It could
> > be 1k, if it runs fast, is meaningful and helps avoiding futur regressions,
> > I would welcome the addition.  
> 
> 
> I don't see the point of having a TAP test at all. We have TAP tests for
> testing the substantive products we test, not for the test suite
> infrastructure. Otherwise, where will we stop? Shall we have tests for
> the things that test the test suite?

Tons of perl module have regression tests. When questioning where testing
should stop, it seems the Test::More module itself is not the last frontier:
https://github.com/Test-More/test-more/tree/master/t

Moreover, the PostgreSQL::Version is not a TAP test module, but a module to
deal with PostgreSQL versions and compare them.

Testing makes development faster as well when it comes to test the code.
Instead of testing vaguely manually, you can test a whole bunch of situations
and add accumulate some more when you think about a new one or when a bug is
reported. Having TAP test helps to make sure the code work as expected.

It helped me when creating my patch. With all due respect, I just don't
understand your arguments against them. The number of lines or questioning when
testing should stop doesn't hold much.

> > If we really want to save some bytes, I have a two lines worth of code fix
> > that looks more readable to me than fixing _version_cmp:
> >
> > +++ b/src/test/perl/PostgreSQL/Version.pm
> > @@ -92,9 +92,13 @@ sub new
> >         # Split into an array
> >         my @numbers = split(/\./, $arg);
> >  
> > +       # make sure all digit of the array-represented version are set so
> > we can
> > +       # keep _version_cmp code as a "simple" digit-to-digit comparison
> > loop
> > +       $numbers[$_] += 0 for 0..3;
> > +
> >         # Treat development versions as having a minor/micro version one
> > less than # the first released version of that branch.
> > -       push @numbers, -1 if ($devel);
> > +       $numbers[3] = -1 if $devel;
> >  
> >         $devel ||= "";  
> 
> I don't see why this is any more readable.

The _version_cmp is much more readable.

But anyway, this is not the point. Using an array to compare versions where we
can use version_num seems like useless and buggy convolutions to me.

Regards,



Re: Fix proposal for comparaison bugs in PostgreSQL::Version

От
Andrew Dunstan
Дата:
On 2022-07-03 Su 16:12, Jehan-Guillaume de Rorthais wrote:
> On Sun, 3 Jul 2022 10:40:21 -0400
> Andrew Dunstan <andrew@dunslane.net> wrote:
>
>> On 2022-06-29 We 05:09, Jehan-Guillaume de Rorthais wrote:
>>> On Tue, 28 Jun 2022 18:17:40 -0400
>>> Andrew Dunstan <andrew@dunslane.net> wrote:
>>>  
>>>> On 2022-06-28 Tu 16:53, Jehan-Guillaume de Rorthais wrote:  
>>>>> ...
>>>>> A better fix would be to store the version internally as version_num that
>>>>> are trivial to compute and compare. Please, find in attachment an
>>>>> implementation of this.
>>>>>
>>>>> The patch is a bit bigger because it improved the devel version to support
>>>>> rc/beta/alpha comparison like 14rc2 > 14rc1.
>>>>>
>>>>> Moreover, it adds a bunch of TAP tests to check various use cases.    
>>>> Nice catch, but this looks like massive overkill. I think we can very
>>>> simply fix the test in just a few lines of code, instead of a 190 line
>>>> fix and a 130 line TAP test.  
>>> I explained why the patch was a little bit larger than required: it fixes
>>> the bugs and do a little bit more. The _version_cmp sub is shorter and
>>> easier to understand, I use multi-line code where I could probably fold
>>> them in a one-liner, added some comments... Anyway, I don't feel the number
>>> of line changed is "massive". But I can probably remove some code and
>>> shrink some other if it is really important...
>>>
>>> Moreover, to be honest, I don't mind the number of additional lines of TAP
>>> tests. Especially since it runs really, really fast and doesn't hurt
>>> day-to-day devs as it is independent from other TAP tests anyway. It could
>>> be 1k, if it runs fast, is meaningful and helps avoiding futur regressions,
>>> I would welcome the addition.  
>>
>> I don't see the point of having a TAP test at all. We have TAP tests for
>> testing the substantive products we test, not for the test suite
>> infrastructure. Otherwise, where will we stop? Shall we have tests for
>> the things that test the test suite?
> Tons of perl module have regression tests. When questioning where testing
> should stop, it seems the Test::More module itself is not the last frontier:
> https://github.com/Test-More/test-more/tree/master/t
>
> Moreover, the PostgreSQL::Version is not a TAP test module, but a module to
> deal with PostgreSQL versions and compare them.
>
> Testing makes development faster as well when it comes to test the code.
> Instead of testing vaguely manually, you can test a whole bunch of situations
> and add accumulate some more when you think about a new one or when a bug is
> reported. Having TAP test helps to make sure the code work as expected.
>
> It helped me when creating my patch. With all due respect, I just don't
> understand your arguments against them. The number of lines or questioning when
> testing should stop doesn't hold much.


There is not a single TAP test in our source code that is aimed at
testing our test infrastructure as opposed to testing what we are
actually in the business of building, and I'm not about to add one. This
is quite different from, say, CPAN modules.

Every added test consumes buildfarm cycles and space on the buildfarm
server for the report, be it ever so small. Every added test needs
maintenance, be it ever so small. There's no such thing as a free test
(apologies to Heinlein and others).


>
>>> If we really want to save some bytes, I have a two lines worth of code fix
>>> that looks more readable to me than fixing _version_cmp:
>>>
>>> +++ b/src/test/perl/PostgreSQL/Version.pm
>>> @@ -92,9 +92,13 @@ sub new
>>>         # Split into an array
>>>         my @numbers = split(/\./, $arg);
>>>  
>>> +       # make sure all digit of the array-represented version are set so
>>> we can
>>> +       # keep _version_cmp code as a "simple" digit-to-digit comparison
>>> loop
>>> +       $numbers[$_] += 0 for 0..3;
>>> +
>>>         # Treat development versions as having a minor/micro version one
>>> less than # the first released version of that branch.
>>> -       push @numbers, -1 if ($devel);
>>> +       $numbers[3] = -1 if $devel;
>>>  
>>>         $devel ||= "";  
>> I don't see why this is any more readable.
> The _version_cmp is much more readable.
>
> But anyway, this is not the point. Using an array to compare versions where we
> can use version_num seems like useless and buggy convolutions to me.
>

I think we'll just have to agree to disagree about it.


cheers


andrew


--
Andrew Dunstan
EDB: https://www.enterprisedb.com




Re: Fix proposal for comparaison bugs in PostgreSQL::Version

От
Jehan-Guillaume de Rorthais
Дата:
On Tue, 5 Jul 2022 09:59:42 -0400
Andrew Dunstan <andrew@dunslane.net> wrote:

> On 2022-07-03 Su 16:12, Jehan-Guillaume de Rorthais wrote:
> > On Sun, 3 Jul 2022 10:40:21 -0400
> > Andrew Dunstan <andrew@dunslane.net> wrote:
> >  
> >> On 2022-06-29 We 05:09, Jehan-Guillaume de Rorthais wrote:  
> >>> On Tue, 28 Jun 2022 18:17:40 -0400
> >>> Andrew Dunstan <andrew@dunslane.net> wrote:
> >>>    
> >>>> On 2022-06-28 Tu 16:53, Jehan-Guillaume de Rorthais wrote:    
> >>>>> ...
> >>>>> A better fix would be to store the version internally as version_num
> >>>>> that are trivial to compute and compare. Please, find in attachment an
> >>>>> implementation of this.
> >>>>>
> >>>>> The patch is a bit bigger because it improved the devel version to
> >>>>> support rc/beta/alpha comparison like 14rc2 > 14rc1.
> >>>>>
> >>>>> Moreover, it adds a bunch of TAP tests to check various use cases.      
> >>>> Nice catch, but this looks like massive overkill. I think we can very
> >>>> simply fix the test in just a few lines of code, instead of a 190 line
> >>>> fix and a 130 line TAP test.    
> >>> I explained why the patch was a little bit larger than required: it fixes
> >>> the bugs and do a little bit more. The _version_cmp sub is shorter and
> >>> easier to understand, I use multi-line code where I could probably fold
> >>> them in a one-liner, added some comments... Anyway, I don't feel the
> >>> number of line changed is "massive". But I can probably remove some code
> >>> and shrink some other if it is really important...
> >>>
> >>> Moreover, to be honest, I don't mind the number of additional lines of TAP
> >>> tests. Especially since it runs really, really fast and doesn't hurt
> >>> day-to-day devs as it is independent from other TAP tests anyway. It could
> >>> be 1k, if it runs fast, is meaningful and helps avoiding futur
> >>> regressions, I would welcome the addition.    
> >>
> >> I don't see the point of having a TAP test at all. We have TAP tests for
> >> testing the substantive products we test, not for the test suite
> >> infrastructure. Otherwise, where will we stop? Shall we have tests for
> >> the things that test the test suite?  
> > Tons of perl module have regression tests. When questioning where testing
> > should stop, it seems the Test::More module itself is not the last frontier:
> > https://github.com/Test-More/test-more/tree/master/t
> >
> > Moreover, the PostgreSQL::Version is not a TAP test module, but a module to
> > deal with PostgreSQL versions and compare them.
> >
> > Testing makes development faster as well when it comes to test the code.
> > Instead of testing vaguely manually, you can test a whole bunch of
> > situations and add accumulate some more when you think about a new one or
> > when a bug is reported. Having TAP test helps to make sure the code work as
> > expected.
> >
> > It helped me when creating my patch. With all due respect, I just don't
> > understand your arguments against them. The number of lines or questioning
> > when testing should stop doesn't hold much.  
> 
> 
> There is not a single TAP test in our source code that is aimed at
> testing our test infrastructure as opposed to testing what we are
> actually in the business of building, and I'm not about to add one.

Whatever, it helped me during the dev process of fixing this bug. Remove
them if you are uncomfortable with them.

> Every added test consumes buildfarm cycles and space on the buildfarm
> server for the report, be it ever so small.

They were not supposed to enter the buildfarm cycles. I wrote it earlier, they
do not interfere with day-to-day dev activity.

> Every added test needs maintenance, be it ever so small. There's no such
> thing as a free test (apologies to Heinlein and others).

This is the first argument I can understand.

> > ...
> > But anyway, this is not the point. Using an array to compare versions where
> > we can use version_num seems like useless and buggy convolutions to me.
> 
> I think we'll just have to agree to disagree about it.

Noted.

Cheers,



Re: Fix proposal for comparaison bugs in PostgreSQL::Version

От
Justin Pryzby
Дата:
On Tue, Jun 28, 2022 at 06:17:40PM -0400, Andrew Dunstan wrote:
> Nice catch, but this looks like massive overkill. I think we can very
> simply fix the test in just a few lines of code, instead of a 190 line
> fix and a 130 line TAP test.
> 
> It was never intended to be able to compare markers like rc1 vs rc2, and
> I don't see any need for it. If you can show me a sane use case I'll
> have another look, but right now it seems quite unnecessary.
> 
> Here's my proposed fix.
> 
> diff --git a/src/test/perl/PostgreSQL/Version.pm b/src/test/perl/PostgreSQL/Version.pm
> index 8f70491189..8d4dbbf694 100644
> --- a/src/test/perl/PostgreSQL/Version.pm

Is this still an outstanding issue ?

-- 
Justin



Re: Fix proposal for comparaison bugs in PostgreSQL::Version

От
Jehan-Guillaume de Rorthais
Дата:
On Thu, 3 Nov 2022 13:11:18 -0500
Justin Pryzby <pryzby@telsasoft.com> wrote:

> On Tue, Jun 28, 2022 at 06:17:40PM -0400, Andrew Dunstan wrote:
> > Nice catch, but this looks like massive overkill. I think we can very
> > simply fix the test in just a few lines of code, instead of a 190 line
> > fix and a 130 line TAP test.
> > 
> > It was never intended to be able to compare markers like rc1 vs rc2, and
> > I don't see any need for it. If you can show me a sane use case I'll
> > have another look, but right now it seems quite unnecessary.
> > 
> > Here's my proposed fix.
> > 
> > diff --git a/src/test/perl/PostgreSQL/Version.pm
> > b/src/test/perl/PostgreSQL/Version.pm index 8f70491189..8d4dbbf694 100644
> > --- a/src/test/perl/PostgreSQL/Version.pm  
> 
> Is this still an outstanding issue ?

The issue still exists on current HEAD:

  $ perl -Isrc/test/perl/ -MPostgreSQL::Version -le \
      'print "bug" if PostgreSQL::Version->new("9.6") <= 9.0'
  bug

Regards,




Re: Fix proposal for comparaison bugs in PostgreSQL::Version

От
Andrew Dunstan
Дата:
On 2022-11-04 Fr 10:06, Jehan-Guillaume de Rorthais wrote:
> On Thu, 3 Nov 2022 13:11:18 -0500
> Justin Pryzby <pryzby@telsasoft.com> wrote:
>
>> On Tue, Jun 28, 2022 at 06:17:40PM -0400, Andrew Dunstan wrote:
>>> Nice catch, but this looks like massive overkill. I think we can very
>>> simply fix the test in just a few lines of code, instead of a 190 line
>>> fix and a 130 line TAP test.
>>>
>>> It was never intended to be able to compare markers like rc1 vs rc2, and
>>> I don't see any need for it. If you can show me a sane use case I'll
>>> have another look, but right now it seems quite unnecessary.
>>>
>>> Here's my proposed fix.
>>>
>>> diff --git a/src/test/perl/PostgreSQL/Version.pm
>>> b/src/test/perl/PostgreSQL/Version.pm index 8f70491189..8d4dbbf694 100644
>>> --- a/src/test/perl/PostgreSQL/Version.pm  
>> Is this still an outstanding issue ?
> The issue still exists on current HEAD:
>
>   $ perl -Isrc/test/perl/ -MPostgreSQL::Version -le \
>       'print "bug" if PostgreSQL::Version->new("9.6") <= 9.0'
>   bug
>
> Regards,
>

Oops. this slipped off mt radar. I'll apply a fix shortly, thanks for
the reminder.


cheers


andrew


--
Andrew Dunstan
EDB: https://www.enterprisedb.com




Re: Fix proposal for comparaison bugs in PostgreSQL::Version

От
Andrew Dunstan
Дата:
On 2022-11-17 Th 17:11, Andrew Dunstan wrote:
> On 2022-11-04 Fr 10:06, Jehan-Guillaume de Rorthais wrote:
>> On Thu, 3 Nov 2022 13:11:18 -0500
>> Justin Pryzby <pryzby@telsasoft.com> wrote:
>>
>>> On Tue, Jun 28, 2022 at 06:17:40PM -0400, Andrew Dunstan wrote:
>>>> Nice catch, but this looks like massive overkill. I think we can very
>>>> simply fix the test in just a few lines of code, instead of a 190 line
>>>> fix and a 130 line TAP test.
>>>>
>>>> It was never intended to be able to compare markers like rc1 vs rc2, and
>>>> I don't see any need for it. If you can show me a sane use case I'll
>>>> have another look, but right now it seems quite unnecessary.
>>>>
>>>> Here's my proposed fix.
>>>>
>>>> diff --git a/src/test/perl/PostgreSQL/Version.pm
>>>> b/src/test/perl/PostgreSQL/Version.pm index 8f70491189..8d4dbbf694 100644
>>>> --- a/src/test/perl/PostgreSQL/Version.pm  
>>> Is this still an outstanding issue ?
>> The issue still exists on current HEAD:
>>
>>   $ perl -Isrc/test/perl/ -MPostgreSQL::Version -le \
>>       'print "bug" if PostgreSQL::Version->new("9.6") <= 9.0'
>>   bug
>>
>> Regards,
>>
> Oops. this slipped off mt radar. I'll apply a fix shortly, thanks for
> the reminder.
>
>

Done.


cheers


andrew


--
Andrew Dunstan
EDB: https://www.enterprisedb.com