Bug#833656: cme fails with dpkg error

gregor herrmann gregoa at debian.org
Sat Aug 13 22:36:03 UTC 2016


On Sat, 13 Aug 2016 15:45:36 +0200, David Kalnischkies wrote:

Thanks for looking into this issue!

> The problem for cme while caused by the same change in apt, is caused in
> a completely different way through. 

Ack, I realized this later ...

> /var/lib/apt/var/lib/dpkg/status
> suggests that apts "configuration" wasn't initialized before "system"
> is, so that Dir, Dir::State and Dir::State::Status are empty. 

Interestingly not, I checked the variables.

And the next interesting thing is that 
/usr/share/perl5/Config/Model/Dpkg/Dependency.pm
does the same as 
/usr/share/doc/libapt-pkg-perl/examples/apt-cache
the latter works, the former has an undefined $apt_cache variable.

/usr/share/perl5/Config/Model/Dpkg/Dependency.pm :

use AptPkg::Config '$_config';
use AptPkg::System '$_system';
use AptPkg::Version;
use AptPkg::Cache ;

$_config->init;
$_system = $_config->system;
my $vs = $_system->versioning;
my $apt_cache = AptPkg::Cache->new ;


/usr/share/doc/libapt-pkg-perl/examples/apt-cache :

use AptPkg::Config '$_config';
use AptPkg::System '$_system';
use AptPkg::Cache;

$_config->init;
$_system = $_config->system;
$_config->{quiet} = 2;
my $cache = AptPkg::Cache->new;


> So Dir has
> no default value in this codepath (it should have /), which results in
> Dir::State::Status being set to var/lib/dpkg/status and later then this
> setting is read it will be noticed that the setting isn't absolute, so
> Dir and Dir::State are considered which are by now set and hence result
> in a /var/lib/apt to be prefixed…

Hm, maybe Dir is empty, I only checked Dir::State::Status which was
indeed var/lib/dpkg/status.

Let's look again:

                 'Dir' => '/',
                 'Dir::State' => 'var/lib/apt/',
                 'Dir::State::status' => 'var/lib/dpkg/status',

(Same for /usr/share/doc/libapt-pkg-perl/examples/apt-cache.)

So this is still a miracle to me why $apt_cache in
Config::Model::Dpkg::Dependency is undefined but $cache in the
libapt-pkg-perl example script works.
 
> I am going to fix this in apt so that this problem will be hidden again,

Thanks!

> but I would suggest looking into initializing apt in the right order or
> you will eventually will run again into issues with config options not
> having the option set they are supposed to have, which is why I leave
> this bug here – unsure if its a cme or libapt-pkg-perl problem, I am
> just not enough of a perler to know…

Me neither, it seems :/

(cc'ing the 2 authors, maybe they find the issue quicker in their code.)


Cheers,
gregor

-- 
 .''`.  Homepage https://info.comodo.priv.at/ - OpenPGP key 0xBB3A68018649AA06
 : :' : Debian GNU/Linux user, admin, and developer -  https://www.debian.org/
 `. `'  Member of VIBE!AT & SPI, fellow of the Free Software Foundation Europe
   `-   NP: Various Artists: Theme From Harry's Game
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 949 bytes
Desc: Digital Signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-perl-maintainers/attachments/20160814/11f46759/attachment.sig>


More information about the pkg-perl-maintainers mailing list