Source: python-apt
Severity: normal
Tags: upstream

Hello,
while trying to install the 3rd party package
NessusAgent-6.5.6-debian6_amd64.deb with ansible, I encountered a bug
that may be caused by python-apt.

Ansible uses python-apt to check if a to-be-installed package is already
installed. The package name is "NessusAgent" (according to
DEBIAN/control) but the normal apt- and dpkg software automatically lower
cases all package names.
python-apt, however, does not lowercase it.
The call to compare_to_version_in_cache() will result in VERSION_NONE
instead of VERSION_SAME and ansible will reinstall the package although
it's already installed.

I'm aware that using upper case package names may be in violation of the
Debian Policy Manual:
https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Source

Still I think that the behaviour of python-apt should be consistent with
apt and dpkg.

Test packages:
http://wulf.eu.org/hello-traditional_2.10-3_amd64.deb
http://wulf.eu.org/HelloWorld_2.10-3_amd64.deb

Test code:
#!/usr/bin/python3

import apt.debfile

info = {
    apt.debfile.DebPackage.VERSION_NEWER: 'NEWER',
    apt.debfile.DebPackage.VERSION_NONE: 'NONE',
    apt.debfile.DebPackage.VERSION_OUTDATED: 'OUTDATED',
    apt.debfile.DebPackage.VERSION_SAME: 'SAME',
}

for pkg in [
    'hello-traditional_2.10-3_amd64.deb',
    'HelloWorld_2.10-3_amd64.deb',
]:
    deb = apt.debfile.DebPackage(pkg)
    print('Package {} is {}'.format(pkg, 
info[deb.compare_to_version_in_cache()]))


Instructions to reproduce:
- Install exactly one of the packages
- Run the python code
- It should display "SAME" for the installed package and "NONE" for the
  other.
- Uninstall the package and install the other. Rerun python code.
- You can see that "HelloWorld" is "NONE" even though it's installed.


Best Regards
Joern Heissler


-- System Information:
Debian Release: stretch/sid
  APT prefers unstable
  APT policy: (600, 'unstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.4.0-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_GB.utf8, LC_CTYPE=en_GB.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

-- no debconf information

Reply via email to