Bug#833656: cme fails with dpkg error

Brendan O'Dea bod at debian.org
Mon Aug 15 00:37:47 UTC 2016


reassign -1 lintian 2.5.45
thanks

On Sun, Aug 14, 2016 at 01:00:33PM +0200, David Kalnischkies wrote:
>On Sun, Aug 14, 2016 at 05:27:39PM +1000, Brendan O'Dea wrote:
>> which suggests that the _config object has been modified prior to this code
>> being run.  Not sure where, perhaps there is another use of AptPkg in cme?
>
>The first is correct, the later indicates that $_config->init was never called
>as Dir couldn't be empty in that case (and that Dir::State gets its default
>value here is actually an unattended but harmless side effect of the dpkg/status
>finding code in its current form). Given that the error message has a '/' in
>front I lean towards assuming that the configuration is eventually initialized,
>just too late.

You're correct, there is an initialisation order issue here.  I added some
debugging, and found the sequence:

  pkgInitSystem
  pkgInitConfig
  pkgInitSystem

which previously would have been fine, but with the changes to the system
initialisation that is no longer the case.

Turns out that the first pkgInitSystem is coming from lintian, which does the
following:

  use AptPkg::Config '$_config';
  my $versioning = $_config->system->versioning;

here:

  https://anonscm.debian.org/cgit/lintian/lintian.git/tree/lib/Lintian/Relation/Version.pm#n36

The simplest fix is simply to insert the following line before the call to
system:

  $_config->init;

Alternately, you don't need to use the global $_config at all if you're not
using AptPkg::Cache (it is an unfortunate implementation detail of the
underlying C++ class that the global is required).

I would be inclined to rewrite the lines above as follows:

  use AptPkg::Config;
  my $versioning = do {
    my $config = AptPkg::Config->new;
    $config->init;
    $config->system->versioning;
  };

--bod



More information about the pkg-perl-maintainers mailing list