[Deborphan-devel] Bug#813038: Priority: optionalRe: deborphan: Misinterprets 'Package-Type' field

Santiago Vila sanvila at unex.es
Sun Apr 10 20:48:30 UTC 2016


severity 813038 serious
thanks

On Thu, 28 Jan 2016, Liam O'Toole wrote:

> Package: deborphan
> Version: 1.7.28.8-0.1
> Severity: normal
> 
> Dear Maintainer,
> 
> The output of deborphan contains a spurious entry when a package contains the
> 'Package-Type' field in /var/lib/dpkg/status. The python-paramiko package, for
> example contains the following field:
> 
> 	Package-Type: deb
> 
> As a result, the output of 'deborphan -a' contains the following:
> 
> 	main/python               deb:all
> 
> Of course, the package 'deb' does not exist. Therefore the output is
> misleading. A likely explanation is that deborphan searches for '^Package' when
> looking for package names and does not consider the extra characters before the
> colon.

It's worse than that. By looking at the code, it *just* checks (after uppercasing)
that the first letter is a "P" and the third letter is a "C".

This is what I found in src/pkginfo.c:

-------------------------------------------------------

    const char c = upcase(line[0]);
    char t;

    if (strchr(line, ':') == 0) {
        exit_invalid_statusfile();
    }

    switch (c) {
    case 'P':
        t = upcase(line[2]);
        switch (t) {
        case 'I':               /* PrIority */
            get_pkg_priority(line, package);
            break;
        case 'C':               /* PaCkage */
            get_pkg_name(line, package);
            break;
        case 'O':               /* PrOvides */
            get_pkg_provides(line, package);
            break;
        case 'E':               /* PrE-depends */
            get_pkg_deps(line, package);
            break;
        }
        break;

-------------------------------------------------------

This "fuzzy" regexp matching method is a complete hack, unsuitable for
release. Please try to fix it in a stable point release.

I attach a minimal status file. To reproduce the bug please do

deborphan -a -f status

on the provided "status" file. You will see this:

main/python               deb

Thanks.
-------------- next part --------------
Package: python-paramiko
Status: install ok installed
Priority: optional
Section: python
Package-Type: deb



More information about the Deborphan-devel mailing list