[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#446768: lintian: Bug in pred_implies in lib/Dep.pm



Raphael Hertzog <hertzog@debian.org> writes:

> Package: lintian
> Version: 1.23.34
> Severity: normal

> I worked on creating a Dpkg::Deps module for dpkg and used lib/Dep.pm as
> inspiration for some parts. I think I discovered some errors in that
> code while writing Dpkg::Deps.

Hm, ideally it would be cool if lintian could use that down the road.  I
know I hurt my head when trying to expand that code to support OR and full
version implication, and the fewer times that people have to write it, the
better.

> The problem are in pred_implies(). It returns 0 in some cases where it
> should return undef.

>     if ($$q[2] eq '<=') {
>         if ($$p[2] eq '>>') {
>             return Dep::versions_gte($$p[3], $$q[3]) ? 0 : undef;
>         } elsif ($$p[2] eq '>=') {
>             return Dep::versions_gt($$p[3], $$q[3]) ? 0 : undef;
>         } else {
>             return Dep::versions_lte($$p[3], $$q[3]);
>         }
>     }

> Here in the case p=['pkg', '<', '1.6'] and q=['pkg', '<=','1.5'] you
> return 0 while you should return undef. The fix is to have this in the
> else clause:

>             return Dep::versions_lte($$p[3], $$q[3]) ? 1 : undef;

> However it also means that you would return "undef" if in the same case
> $$p[2]='=' while you should return 0 because the implication is
> obviously impossible.  For this you need to add another elsif testing
> specifically this case.

Indeed.  Thanks!  This fix will be in the next release.

-- 
Russ Allbery (rra@debian.org)               <http://www.eyrie.org/~eagle/>




Reply to: