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.

If you want to compare with my (object-oriented version of the) code,
you'll find it here for the moment:
http://lists.debian.org/debian-dpkg/2007/10/msg00136.html
(the relevant part is in the version_implies function)

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. So the 
end
result is:
    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;
        } elsif ($$p[2] eq '=') {
            return Dep::versions_lte($$p[3], $$q[3]) ? 1 : 0;
        } else {
            return Dep::versions_lte($$p[3], $$q[3]) ? 1 : undef;
        }
    }

You must make similar changes in the 3 other cases (all except the "=" one).

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 
'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.22-2-686 (SMP w/1 CPU core)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages lintian depends on:
ii  binutils               2.18-1            The GNU assembler, linker and bina
ii  diffstat               1.45-2            produces graph of changes introduc
ii  dpkg-dev               1.14.8            package building tools for Debian
ii  file                   4.21-3            Determines file type using "magic"
ii  gettext                0.16.1-2          GNU Internationalization utilities
ii  intltool-debian        0.35.0+20060710.1 Help i18n of RFC822 compliant conf
ii  libparse-debianchangel 1.1.1-1           parse Debian changelogs and output
ii  man-db                 2.5.0-3           on-line manual pager
ii  perl [libdigest-md5-pe 5.8.8-11          Larry Wall's Practical Extraction 

lintian recommends no packages.

-- no debconf information



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to