[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#715494: apt-pkg: out-of-date pkgcache.bin: /var/lib/dpkg/status updated more than once in one second



On Tue, Jul 9, 2013 at 7:05 PM, Philipp Hahn <hahn@univention.de> wrote:
> If /var/lib/dpkg/status is updated more than once in one second, apt-pkg
> does not detect that and does not update its /var/cache/apt/pkgcache.bin
> file.
> "dpkg-query -W" and "apt-cache policy" then display different versions
> for the currently installed version.

That's bad indeed. All sorts of strange stuff can happen then APT and
dpkg have a different view on the world.

> I tracked it down to apt-pkg/pkgcache.cc and apt-pkg/deb/debindexfile.cc
> only using 'stat.mtime' without the nano-second resolution in 'tv_nsec',
> which more modern Linux kernels do provide.

Documentation says tv_nsec is specified in POSIX.1-2008, so that will
be fine and should be kernel-independent. APT uses other POSIX.1-2008
stuff already, so this isn't raising any invisible requirement bars either.
Supporting filesystems seems to be the bigger limitation but we can't fix that.

> Would you accept a patch which adds (conditional) support for that, or
> do you prefer a different solution.

The alternative would be going with checksums and at that point it would
be probably faster to just parse it all the time rather than doing checksums,
so yes, if you have a patch please feel free to share it with us. :)

Without checking I presume this is a binary incompatible change though
as it changes internal structures, so this has to wait for an abi-break
(we usually collect a bunch of stuff as they tend to be painful) and can't
be backported to stable.


> The bug is more likely to happen on fast machines and in virtual
> machines, where the expensive disk sync get filtered out.

You seem to be extra-ordinary "lucky", as the file needs to retain
the same size as well.


> The full bug information is available in our public Bugzilla at
> <https://forge.univention.org/bugzilla/show_bug.cgi?id=31773>

I would suggest disabling at least one of the binary caches as a
workaround instead:
echo 'Dir::Cache::pkgcache "";' > /etc/apt/apt.conf.d/nocache
Its the cache combining the data parsed from the sources
(called srcpkgcache – so it has nothing to do with source packages!)
with the data parsed from the status file. Caches which aren't
created can't be out-of-date. ;)


Best regards

David Kalnischkies


Reply to: