From b6f1b480164b454661ddd4fdd3968302c6a3ebf6 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 10 Feb 2016 12:26:49 +0100 Subject: get dpkg lock in build-dep if cache was invalid again MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Regression introduced in a249b3e6fd798935a02b769149c9791a6fa6ef16, which in the case of an invalid cache would build the first part unlocked and later pick up the (still unlocked) cache for further processing, so the system got never locked and apt would end up complaining about being unable to release the lock at shutdown. The far more common case of having a valid cache worked as expected and hence covered up the problem – especially as tests who would have noticed it are simulations only, which do not lock. Closes: 814139 Reported-By: Balint Reczey Reported-By: Helmut Grohne on IRC --- ...est-bug-814139-pickup-of-different-cache-states | 58 ++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100755 test/integration/test-bug-814139-pickup-of-different-cache-states (limited to 'test/integration/test-bug-814139-pickup-of-different-cache-states') diff --git a/test/integration/test-bug-814139-pickup-of-different-cache-states b/test/integration/test-bug-814139-pickup-of-different-cache-states new file mode 100755 index 000000000..a6c84d6cd --- /dev/null +++ b/test/integration/test-bug-814139-pickup-of-different-cache-states @@ -0,0 +1,58 @@ +#!/bin/sh +set -e + +TESTDIR="$(readlink -f "$(dirname "$0")")" +. "$TESTDIR/framework" + +setupenvironment +configarchitecture 'amd64' + +insertinstalledpackage 'build-essential' 'amd64' '1' + +buildsimplenativepackage 'foo' 'all' '1' 'stable' 'Build-Depends: bar' +buildsimplenativepackage 'bar' 'all' '1' 'stable' + +setupaptarchive + +cp rootdir/var/lib/dpkg/status status.backup + +testrun() { + cp status.backup rootdir/var/lib/dpkg/status + cleanup + testdpkgnotinstalled 'bar' + testsuccess aptget build-dep foo -y + testdpkginstalled 'bar' + cleanup + testsuccess aptget source foo + testsuccess test -s foo_1.tar.xz -a -s foo_1.dsc + rm foo_1.tar.xz foo_1.dsc + testsuccess test -d foo-1 + rm -rf foo-1 + cleanup + testsuccess aptget install foo -y +} + +msgmsg 'Caches fully up-to-date' +cleanup() { + rm -f rootdir/var/cache/apt/*.bin + testsuccess aptcache gencaches +} +testrun + +msgmsg 'pkgcache.bin is missing' +cleanup() { + rm -f rootdir/var/cache/apt/*.bin + testsuccess aptcache gencaches + rm rootdir/var/cache/apt/pkgcache.bin +} +testrun + +msgmsg 'Caches are not writeable' +rm rootdir/var/cache/apt/*.bin +addtrap 'prefix' 'chmod 755 rootdir/var/cache/apt;' +chmod 555 rootdir/var/cache/apt +testsuccess aptcache gencaches +cleanup() { + testfilestats "${TMPWORKINGDIRECTORY}/rootdir/var/cache/apt" '%a' '=' '555' +} +testrun -- cgit v1.2.3