From 49f9cfba5567cd034bf729a63b3f6e9badd9bc35 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 31 Aug 2022 16:26:48 +0200 Subject: Report failures back from debSystem::AddStatusFiles Failing to properly create the status file class should be reported back to the caller so it can proceed accordingly instead of proceeding into more failures. This gives us: E: flAbsPath on /var/lib/dpkg/status failed - realpath (2: No such file or directory) E: The package lists or status file could not be parsed or opened. instead of: E: flAbsPath on /var/lib/dpkg/status failed - realpath (2: No such file or directory) E: Could not open file - open (2: No such file or directory) E: Problem opening E: The package lists or status file could not be parsed or opened. and valgrind reporting actions on uninitialised values. --- apt-pkg/deb/debsystem.cc | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/apt-pkg/deb/debsystem.cc b/apt-pkg/deb/debsystem.cc index c9c6a7e85..65a27f72f 100644 --- a/apt-pkg/deb/debsystem.cc +++ b/apt-pkg/deb/debsystem.cc @@ -335,8 +335,20 @@ signed debSystem::Score(Configuration const &Cnf) /* */ bool debSystem::AddStatusFiles(std::vector &List) { - if (d->StatusFile == 0) - d->StatusFile = new debStatusIndex(_config->FindFile("Dir::State::status")); + if (d->StatusFile == nullptr) + { + auto dpkgstatus = _config->FindFile("Dir::State::status"); + _error->PushToStack(); + d->StatusFile = new debStatusIndex(std::move(dpkgstatus)); + bool const errored = _error->PendingError(); + _error->MergeWithStack(); + if (errored) + { + delete d->StatusFile; + d->StatusFile = nullptr; + return false; + } + } List.push_back(d->StatusFile); return true; } -- cgit v1.2.3-70-g09d2 From 3498fbedafbf30e5c91deeaefa6a60d1e387593a Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 31 Aug 2022 21:49:33 +0200 Subject: Avoid dealing with a fake dpkg stanza in the tests We needed a fake dpkg in our status file for dpkg --assert-multi-arch to work in the past, but recent dpkg versions do not require this anymore, so we can remove this somewhat surprising hackery in favour of better hidden hackery we only use if we work with an older dpkg (e.g. on current Debian stable). --- test/integration/framework | 60 ++++++++++++++++++---- test/integration/test-apt-cache | 10 ++-- test/integration/test-apt-cli-json-hooks | 16 +++--- test/integration/test-apt-cli-list | 2 - test/integration/test-apt-get-changelog | 26 +++++----- test/integration/test-apt-mark | 9 +--- .../test-apt-move-and-forget-manual-sections | 6 +-- test/integration/test-apt-never-markauto-sections | 12 ++--- test/integration/test-apt-patterns | 2 - test/integration/test-apt-update-nofallback | 3 +- test/integration/test-apt-update-rollback | 6 +-- test/integration/test-bug-728500-tempdir | 3 +- test/integration/test-bug-753297-upgradable | 1 - .../test-external-dependency-solver-protocol | 2 +- .../test-external-installation-planner-protocol | 2 +- ...prevent-markinstall-multiarch-same-versionscrew | 2 +- .../test-ubuntu-bug-1876495-pkgnames-virtual | 8 ++- 17 files changed, 96 insertions(+), 74 deletions(-) diff --git a/test/integration/framework b/test/integration/framework index 8bb8c00d6..5e1e68a98 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -473,10 +473,56 @@ if [ -r '${TMPWORKINGDIRECTORY}/noopchroot.so' ]; then export LD_PRELOAD="noopchroot.so" fi fi +EXEC='exec' EOF cp "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/gdb-dpkg" + local DPKG_VERSION="$(command dpkg-query --showformat '${VERSION}' --show dpkg)" + if command dpkg --compare-versions "${DPKG_VERSION}" '<<' '1.21.0'; then + cat >> "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" </dev/null 2>&1; then + EXEC='' + ORIGINAL="${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status" + BACKUP="${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status.apt-backup" + restoredpkgstatus() { + if [ -n "\$BACKUP" ]; then + if [ -e "\$BACKUP" ]; then + mv -f "\$BACKUP" "\$ORIGINAL" + else + rm -f "\$ORIGINAL" + fi + BACKUP='' + fi + } + trap "restoredpkgstatus;" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM + if [ -e "\$ORIGINAL" ]; then + cp -a "\$ORIGINAL" "\$BACKUP" + fi + cat >> "${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status" << EOS + +Package: dpkg +Architecture: all +Version: ${DPKG_VERSION}+fake +Status: install ok installed +Maintainer: Joe Sixpack +Installed-Size: 42 +Description: tells dpkg it supports what we need + Some versions of dpkg check its own version from the status file + to know if it supports multi-arch and stuff in --assert-*. + +EOS +fi +EOF + fi cat >> "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" < rootdir/etc/apt/apt.conf.d/99dpkg { - if ! command dpkg --assert-multi-arch >/dev/null 2>&1; then - echo "DPKG::options:: \"--force-architecture\";" # Added to test multiarch before dpkg is ready for it… - fi echo 'quiet "0";' echo 'quiet::NoUpdate "true";' echo 'quiet::NoStatistic "true";' @@ -588,12 +631,6 @@ configdpkg() { fi fi rm -f rootdir/etc/apt/apt.conf.d/00foreigndpkg - # make sure dpkg can detect itself as capable of it - if [ "0" = "$(dpkg -l dpkg 2> /dev/null | grep '^i' | wc -l)" ]; then - # dpkg doesn't really check the version as long as it is fully installed, - # but just to be sure we choose one above the required version - insertinstalledpackage 'dpkg' "all" '1.16.2+fake' - fi if dpkg --assert-multi-arch >/dev/null 2>&1 ; then local ARCHS="$(getarchitectures)" local DPKGARCH="$(dpkg --print-architecture)" @@ -613,6 +650,9 @@ configdpkg() { fi fi done + else + # test multiarch before dpkg is ready for it… + echo "DPKG::options:: \"--force-architecture\";" > rootdir/etc/apt/apt.conf.d/00foreigndpkg fi } diff --git a/test/integration/test-apt-cache b/test/integration/test-apt-cache index 56c3268fb..c003fba8c 100755 --- a/test/integration/test-apt-cache +++ b/test/integration/test-apt-cache @@ -22,9 +22,9 @@ Replaces: foo:i386 (<< 1)' "$DESCR" setupaptarchive -# dpkg is installed by our framework -testdpkginstalled 'dpkg' -testempty aptcache unmet dpkg +insertinstalledpackage 'awesome' 'all' '1' +testdpkginstalled 'awesome' +testempty aptcache unmet awesome # FIXME: Find some usecase for unmet as it seems kinda useless/broken #testsuccess aptcache unmet @@ -46,9 +46,9 @@ testsuccess aptcache dump cp rootdir/tmp/testsuccess.output dump.output testsuccess test -s dump.output -testsuccessequal 'dpkg -bar +testsuccessequal 'bar foo +awesome specific fancy' aptcache pkgnames testsuccessequal 'bar' aptcache pkgnames bar diff --git a/test/integration/test-apt-cli-json-hooks b/test/integration/test-apt-cli-json-hooks index 17bd17814..9a3208c3c 100755 --- a/test/integration/test-apt-cli-json-hooks +++ b/test/integration/test-apt-cli-json-hooks @@ -169,7 +169,7 @@ Calculating upgrade... HOOK: HELLO HOOK: request {"jsonrpc":"2.0","method":"org.debian.apt.hooks.hello","id":0,"params":{"versions":["0.1","0.2"]}} HOOK: empty -HOOK: request {"jsonrpc":"2.0","method":"org.debian.apt.hooks.install.pre-prompt","params":{"command":"dist-upgrade","search-terms":[],"unknown-packages":[],"packages":[{"id":1,"name":"upgrade","architecture":"i386","mode":"upgrade","automatic":false,"versions":{"candidate":{"id":1,"version":"2.0","architecture":"i386","pin":500,"origins":[{"archive":"testing","codename":"testing","origin":"Oranges","label":"Lemons","site":""}]},"install":{"id":1,"version":"2.0","architecture":"i386","pin":500,"origins":[{"archive":"testing","codename":"testing","origin":"Oranges","label":"Lemons","site":""}]},"current":{"id":4,"version":"1.0","architecture":"i386","pin":100,"origins":[]}}}]}} +HOOK: request {"jsonrpc":"2.0","method":"org.debian.apt.hooks.install.pre-prompt","params":{"command":"dist-upgrade","search-terms":[],"unknown-packages":[],"packages":[{"id":1,"name":"upgrade","architecture":"i386","mode":"upgrade","automatic":false,"versions":{"candidate":{"id":1,"version":"2.0","architecture":"i386","pin":500,"origins":[{"archive":"testing","codename":"testing","origin":"Oranges","label":"Lemons","site":""}]},"install":{"id":1,"version":"2.0","architecture":"i386","pin":500,"origins":[{"archive":"testing","codename":"testing","origin":"Oranges","label":"Lemons","site":""}]},"current":{"id":3,"version":"1.0","architecture":"i386","pin":100,"origins":[]}}}]}} HOOK: empty HOOK: BYE The following packages will be upgraded: @@ -177,14 +177,14 @@ The following packages will be upgraded: HOOK: HELLO HOOK: request {"jsonrpc":"2.0","method":"org.debian.apt.hooks.hello","id":0,"params":{"versions":["0.1","0.2"]}} HOOK: empty -HOOK: request {"jsonrpc":"2.0","method":"org.debian.apt.hooks.install.package-list","params":{"command":"dist-upgrade","search-terms":[],"unknown-packages":[],"packages":[{"id":1,"name":"upgrade","architecture":"i386","mode":"upgrade","automatic":false,"versions":{"candidate":{"id":1,"version":"2.0","architecture":"i386","pin":500,"origins":[{"archive":"testing","codename":"testing","origin":"Oranges","label":"Lemons","site":""}]},"install":{"id":1,"version":"2.0","architecture":"i386","pin":500,"origins":[{"archive":"testing","codename":"testing","origin":"Oranges","label":"Lemons","site":""}]},"current":{"id":4,"version":"1.0","architecture":"i386","pin":100,"origins":[]}}}]}} +HOOK: request {"jsonrpc":"2.0","method":"org.debian.apt.hooks.install.package-list","params":{"command":"dist-upgrade","search-terms":[],"unknown-packages":[],"packages":[{"id":1,"name":"upgrade","architecture":"i386","mode":"upgrade","automatic":false,"versions":{"candidate":{"id":1,"version":"2.0","architecture":"i386","pin":500,"origins":[{"archive":"testing","codename":"testing","origin":"Oranges","label":"Lemons","site":""}]},"install":{"id":1,"version":"2.0","architecture":"i386","pin":500,"origins":[{"archive":"testing","codename":"testing","origin":"Oranges","label":"Lemons","site":""}]},"current":{"id":3,"version":"1.0","architecture":"i386","pin":100,"origins":[]}}}]}} HOOK: empty HOOK: BYE 1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. HOOK: HELLO HOOK: request {"jsonrpc":"2.0","method":"org.debian.apt.hooks.hello","id":0,"params":{"versions":["0.1","0.2"]}} HOOK: empty -HOOK: request {"jsonrpc":"2.0","method":"org.debian.apt.hooks.install.statistics","params":{"command":"dist-upgrade","search-terms":[],"unknown-packages":[],"packages":[{"id":1,"name":"upgrade","architecture":"i386","mode":"upgrade","automatic":false,"versions":{"candidate":{"id":1,"version":"2.0","architecture":"i386","pin":500,"origins":[{"archive":"testing","codename":"testing","origin":"Oranges","label":"Lemons","site":""}]},"install":{"id":1,"version":"2.0","architecture":"i386","pin":500,"origins":[{"archive":"testing","codename":"testing","origin":"Oranges","label":"Lemons","site":""}]},"current":{"id":4,"version":"1.0","architecture":"i386","pin":100,"origins":[]}}}]}} +HOOK: request {"jsonrpc":"2.0","method":"org.debian.apt.hooks.install.statistics","params":{"command":"dist-upgrade","search-terms":[],"unknown-packages":[],"packages":[{"id":1,"name":"upgrade","architecture":"i386","mode":"upgrade","automatic":false,"versions":{"candidate":{"id":1,"version":"2.0","architecture":"i386","pin":500,"origins":[{"archive":"testing","codename":"testing","origin":"Oranges","label":"Lemons","site":""}]},"install":{"id":1,"version":"2.0","architecture":"i386","pin":500,"origins":[{"archive":"testing","codename":"testing","origin":"Oranges","label":"Lemons","site":""}]},"current":{"id":3,"version":"1.0","architecture":"i386","pin":100,"origins":[]}}}]}} HOOK: empty HOOK: BYE Inst upgrade [1.0] (2.0 Lemons:testing [i386]) @@ -192,7 +192,7 @@ Conf upgrade (2.0 Lemons:testing [i386]) HOOK: HELLO HOOK: request {"jsonrpc":"2.0","method":"org.debian.apt.hooks.hello","id":0,"params":{"versions":["0.1","0.2"]}} HOOK: empty -HOOK: request {"jsonrpc":"2.0","method":"org.debian.apt.hooks.install.post","params":{"command":"dist-upgrade","search-terms":[],"unknown-packages":[],"packages":[{"id":1,"name":"upgrade","architecture":"i386","mode":"upgrade","automatic":false,"versions":{"candidate":{"id":1,"version":"2.0","architecture":"i386","pin":500,"origins":[{"archive":"testing","codename":"testing","origin":"Oranges","label":"Lemons","site":""}]},"install":{"id":1,"version":"2.0","architecture":"i386","pin":500,"origins":[{"archive":"testing","codename":"testing","origin":"Oranges","label":"Lemons","site":""}]},"current":{"id":4,"version":"1.0","architecture":"i386","pin":100,"origins":[]}}}]}} +HOOK: request {"jsonrpc":"2.0","method":"org.debian.apt.hooks.install.post","params":{"command":"dist-upgrade","search-terms":[],"unknown-packages":[],"packages":[{"id":1,"name":"upgrade","architecture":"i386","mode":"upgrade","automatic":false,"versions":{"candidate":{"id":1,"version":"2.0","architecture":"i386","pin":500,"origins":[{"archive":"testing","codename":"testing","origin":"Oranges","label":"Lemons","site":""}]},"install":{"id":1,"version":"2.0","architecture":"i386","pin":500,"origins":[{"archive":"testing","codename":"testing","origin":"Oranges","label":"Lemons","site":""}]},"current":{"id":3,"version":"1.0","architecture":"i386","pin":100,"origins":[]}}}]}} HOOK: empty HOOK: BYE' apt dist-upgrade -s @@ -206,7 +206,7 @@ Calculating upgrade... HOOK: HELLO HOOK: request {"jsonrpc":"2.0","method":"org.debian.apt.hooks.hello","id":0,"params":{"versions":["0.1","0.2"]}} HOOK: empty -HOOK: request {"jsonrpc":"2.0","method":"org.debian.apt.hooks.install.pre-prompt","params":{"command":"dist-upgrade","search-terms":[],"unknown-packages":[],"packages":[{"id":1,"name":"upgrade","architecture":"i386","mode":"install","automatic":false,"versions":{"candidate":{"id":1,"version":"2.0","architecture":"i386","pin":500,"origins":[{"archive":"testing","codename":"testing","origin":"Oranges","label":"Lemons","site":""}]},"install":{"id":1,"version":"2.0","architecture":"i386","pin":500,"origins":[{"archive":"testing","codename":"testing","origin":"Oranges","label":"Lemons","site":""}]},"current":{"id":4,"version":"1.0","architecture":"i386","pin":100,"origins":[]}}}]}} +HOOK: request {"jsonrpc":"2.0","method":"org.debian.apt.hooks.install.pre-prompt","params":{"command":"dist-upgrade","search-terms":[],"unknown-packages":[],"packages":[{"id":1,"name":"upgrade","architecture":"i386","mode":"install","automatic":false,"versions":{"candidate":{"id":1,"version":"2.0","architecture":"i386","pin":500,"origins":[{"archive":"testing","codename":"testing","origin":"Oranges","label":"Lemons","site":""}]},"install":{"id":1,"version":"2.0","architecture":"i386","pin":500,"origins":[{"archive":"testing","codename":"testing","origin":"Oranges","label":"Lemons","site":""}]},"current":{"id":3,"version":"1.0","architecture":"i386","pin":100,"origins":[]}}}]}} HOOK: empty HOOK: BYE The following packages will be upgraded: @@ -214,14 +214,14 @@ The following packages will be upgraded: HOOK: HELLO HOOK: request {"jsonrpc":"2.0","method":"org.debian.apt.hooks.hello","id":0,"params":{"versions":["0.1","0.2"]}} HOOK: empty -HOOK: request {"jsonrpc":"2.0","method":"org.debian.apt.hooks.install.package-list","params":{"command":"dist-upgrade","search-terms":[],"unknown-packages":[],"packages":[{"id":1,"name":"upgrade","architecture":"i386","mode":"install","automatic":false,"versions":{"candidate":{"id":1,"version":"2.0","architecture":"i386","pin":500,"origins":[{"archive":"testing","codename":"testing","origin":"Oranges","label":"Lemons","site":""}]},"install":{"id":1,"version":"2.0","architecture":"i386","pin":500,"origins":[{"archive":"testing","codename":"testing","origin":"Oranges","label":"Lemons","site":""}]},"current":{"id":4,"version":"1.0","architecture":"i386","pin":100,"origins":[]}}}]}} +HOOK: request {"jsonrpc":"2.0","method":"org.debian.apt.hooks.install.package-list","params":{"command":"dist-upgrade","search-terms":[],"unknown-packages":[],"packages":[{"id":1,"name":"upgrade","architecture":"i386","mode":"install","automatic":false,"versions":{"candidate":{"id":1,"version":"2.0","architecture":"i386","pin":500,"origins":[{"archive":"testing","codename":"testing","origin":"Oranges","label":"Lemons","site":""}]},"install":{"id":1,"version":"2.0","architecture":"i386","pin":500,"origins":[{"archive":"testing","codename":"testing","origin":"Oranges","label":"Lemons","site":""}]},"current":{"id":3,"version":"1.0","architecture":"i386","pin":100,"origins":[]}}}]}} HOOK: empty HOOK: BYE 1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. HOOK: HELLO HOOK: request {"jsonrpc":"2.0","method":"org.debian.apt.hooks.hello","id":0,"params":{"versions":["0.1","0.2"]}} HOOK: empty -HOOK: request {"jsonrpc":"2.0","method":"org.debian.apt.hooks.install.statistics","params":{"command":"dist-upgrade","search-terms":[],"unknown-packages":[],"packages":[{"id":1,"name":"upgrade","architecture":"i386","mode":"install","automatic":false,"versions":{"candidate":{"id":1,"version":"2.0","architecture":"i386","pin":500,"origins":[{"archive":"testing","codename":"testing","origin":"Oranges","label":"Lemons","site":""}]},"install":{"id":1,"version":"2.0","architecture":"i386","pin":500,"origins":[{"archive":"testing","codename":"testing","origin":"Oranges","label":"Lemons","site":""}]},"current":{"id":4,"version":"1.0","architecture":"i386","pin":100,"origins":[]}}}]}} +HOOK: request {"jsonrpc":"2.0","method":"org.debian.apt.hooks.install.statistics","params":{"command":"dist-upgrade","search-terms":[],"unknown-packages":[],"packages":[{"id":1,"name":"upgrade","architecture":"i386","mode":"install","automatic":false,"versions":{"candidate":{"id":1,"version":"2.0","architecture":"i386","pin":500,"origins":[{"archive":"testing","codename":"testing","origin":"Oranges","label":"Lemons","site":""}]},"install":{"id":1,"version":"2.0","architecture":"i386","pin":500,"origins":[{"archive":"testing","codename":"testing","origin":"Oranges","label":"Lemons","site":""}]},"current":{"id":3,"version":"1.0","architecture":"i386","pin":100,"origins":[]}}}]}} HOOK: empty HOOK: BYE Inst upgrade [1.0] (2.0 Lemons:testing [i386]) @@ -229,7 +229,7 @@ Conf upgrade (2.0 Lemons:testing [i386]) HOOK: HELLO HOOK: request {"jsonrpc":"2.0","method":"org.debian.apt.hooks.hello","id":0,"params":{"versions":["0.1","0.2"]}} HOOK: empty -HOOK: request {"jsonrpc":"2.0","method":"org.debian.apt.hooks.install.post","params":{"command":"dist-upgrade","search-terms":[],"unknown-packages":[],"packages":[{"id":1,"name":"upgrade","architecture":"i386","mode":"install","automatic":false,"versions":{"candidate":{"id":1,"version":"2.0","architecture":"i386","pin":500,"origins":[{"archive":"testing","codename":"testing","origin":"Oranges","label":"Lemons","site":""}]},"install":{"id":1,"version":"2.0","architecture":"i386","pin":500,"origins":[{"archive":"testing","codename":"testing","origin":"Oranges","label":"Lemons","site":""}]},"current":{"id":4,"version":"1.0","architecture":"i386","pin":100,"origins":[]}}}]}} +HOOK: request {"jsonrpc":"2.0","method":"org.debian.apt.hooks.install.post","params":{"command":"dist-upgrade","search-terms":[],"unknown-packages":[],"packages":[{"id":1,"name":"upgrade","architecture":"i386","mode":"install","automatic":false,"versions":{"candidate":{"id":1,"version":"2.0","architecture":"i386","pin":500,"origins":[{"archive":"testing","codename":"testing","origin":"Oranges","label":"Lemons","site":""}]},"install":{"id":1,"version":"2.0","architecture":"i386","pin":500,"origins":[{"archive":"testing","codename":"testing","origin":"Oranges","label":"Lemons","site":""}]},"current":{"id":3,"version":"1.0","architecture":"i386","pin":100,"origins":[]}}}]}} HOOK: empty HOOK: BYE' apt dist-upgrade -s diff --git a/test/integration/test-apt-cli-list b/test/integration/test-apt-cli-list index 3a9ca2c15..e81a3b7b3 100755 --- a/test/integration/test-apt-cli-list +++ b/test/integration/test-apt-cli-list @@ -26,7 +26,6 @@ setupaptarchive testsuccessequal "Listing... bar/now 1.0 i386 [installed,local] baz/unstable 2.0 all [upgradable from: 0.1] -dpkg/now 1.16.2+fake all [installed,local] foo/unstable 1.0 all foobar/unstable 2.0 i386 [upgradable from: 1.0] foreign/unstable 2.0 armel [upgradable from: 1.0] @@ -48,7 +47,6 @@ foreign/unstable 2.0 armel [upgradable from: 1.0]" apt list --upgradable testsuccessequal "Listing... bar/now 1.0 i386 [installed,local] baz/now 0.1 all [installed,upgradable to: 2.0] -dpkg/now 1.16.2+fake all [installed,local] foobar/now 1.0 i386 [installed,upgradable to: 2.0] foreign/now 1.0 armel [installed,upgradable to: 2.0]" apt list --installed diff --git a/test/integration/test-apt-get-changelog b/test/integration/test-apt-get-changelog index 9ac9b063a..b216f6f9a 100755 --- a/test/integration/test-apt-get-changelog +++ b/test/integration/test-apt-get-changelog @@ -7,7 +7,7 @@ TESTDIR="$(readlink -f "$(dirname "$0")")" setupenvironment configarchitecture 'native' -buildsimplenativepackage 'dpkg' 'native' '42' 'stable' +buildsimplenativepackage 'awesome' 'native' '42' 'stable' buildsimplenativepackage 'foo' 'all' '1.0' 'stable' buildsimplenativepackage 'libbar' 'all' '1.0' 'stable' @@ -118,20 +118,20 @@ testdpkgnotinstalled 'foo' testsuccessequal "'http://localhost:${APTHTTPPORT}/pool/main/f/foo/foo_1.0/changelog' foo.changelog" apt changelog foo --print-uris -o Acquire::Changelogs::AlwaysOnline=false testsuccessequal "'http://localhost:${APTHTTPPORT}/pool/main/f/foo/foo_1.0/changelog' foo.changelog" apt changelog foo --print-uris -o Acquire::Changelogs::AlwaysOnline=true -testsuccess apt install dpkg -y +testsuccess apt install awesome -y # at this moment, we still have the Releasefile claim to be origin:ubuntu echo 'Acquire::Changelogs::AlwaysOnline::Origin::Ubuntu "false";' >> rootdir/etc/apt/apt.conf.d/nooriginchangelogs -testsuccessequal "'http://localhost:${APTHTTPPORT}/pool/main/d/dpkg/dpkg_42/changelog' dpkg.changelog" apt changelog dpkg --print-uris -testsuccessequal "'copy://${TMPWORKINGDIRECTORY}/rootdir/usr/share/doc/dpkg/changelog' dpkg.changelog" apt changelog dpkg --print-uris -o Acquire::Changelogs::AlwaysOnline=false -testsuccessequal "'http://localhost:${APTHTTPPORT}/pool/main/d/dpkg/dpkg_42/changelog' dpkg.changelog" apt changelog dpkg --print-uris -o Acquire::Changelogs::AlwaysOnline=true -testsuccessequal "'http://localhost:${APTHTTPPORT}/pool/main/d/dpkg/dpkg_42/changelog' dpkg.changelog" apt changelog dpkg --print-uris -o Acquire::Changelogs::AlwaysOnline=false -o Acquire::Changelogs::AlwaysOnline::Origin::Ubuntu=true -testsuccessequal "'copy://${TMPWORKINGDIRECTORY}/rootdir/usr/share/doc/dpkg/changelog' dpkg.changelog" apt changelog dpkg --print-uris -o Acquire::Changelogs::AlwaysOnline=false -o Acquire::Changelogs::AlwaysOnline::Origin::Debian=true - -testsuccess apt changelog dpkg -d -testfilestats 'dpkg.changelog' '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:644" -head -n 3 dpkg.changelog > dpkg.change -testfileequal 'dpkg.change' "$(apthelper cat-file 'rootdir/usr/share/doc/dpkg/changelog' | head -n 3)" -rm -f dpkg.change dpkg.changelog +testsuccessequal "'http://localhost:${APTHTTPPORT}/pool/main/a/awesome/awesome_42/changelog' awesome.changelog" apt changelog awesome --print-uris +testsuccessequal "'copy://${TMPWORKINGDIRECTORY}/rootdir/usr/share/doc/awesome/changelog' awesome.changelog" apt changelog awesome --print-uris -o Acquire::Changelogs::AlwaysOnline=false +testsuccessequal "'http://localhost:${APTHTTPPORT}/pool/main/a/awesome/awesome_42/changelog' awesome.changelog" apt changelog awesome --print-uris -o Acquire::Changelogs::AlwaysOnline=true +testsuccessequal "'http://localhost:${APTHTTPPORT}/pool/main/a/awesome/awesome_42/changelog' awesome.changelog" apt changelog awesome --print-uris -o Acquire::Changelogs::AlwaysOnline=false -o Acquire::Changelogs::AlwaysOnline::Origin::Ubuntu=true +testsuccessequal "'copy://${TMPWORKINGDIRECTORY}/rootdir/usr/share/doc/awesome/changelog' awesome.changelog" apt changelog awesome --print-uris -o Acquire::Changelogs::AlwaysOnline=false -o Acquire::Changelogs::AlwaysOnline::Origin::Debian=true + +testsuccess apt changelog awesome -d +testfilestats 'awesome.changelog' '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:644" +head -n 3 awesome.changelog > awesome.change +testfileequal 'awesome.change' "$(apthelper cat-file 'rootdir/usr/share/doc/awesome/changelog' | head -n 3)" +rm -f awesome.change awesome.changelog # no package specified testfailureequal 'E: No packages found' aptget changelog diff --git a/test/integration/test-apt-mark b/test/integration/test-apt-mark index 630a0d460..d1c65ad7c 100755 --- a/test/integration/test-apt-mark +++ b/test/integration/test-apt-mark @@ -15,14 +15,10 @@ insertinstalledpackage 'bar' 'amd64' '1' setupaptarchive -# dpkg is "installed" by our test framework -testdpkginstalled dpkg - testnoautopkg() { testempty aptmark showauto testempty aptcache -q=1 showauto testsuccessequal 'bar -dpkg foo' aptmark showmanual testsuccessequal 'bar foo' aptmark showmanual bar foo uninstalled @@ -32,8 +28,7 @@ testfooisauto() { testsuccessequal 'foo' aptcache -q=1 showauto testsuccessequal 'foo' aptmark showauto foo testsuccessequal 'foo' aptcache -q=1 showauto foo - testsuccessequal 'bar -dpkg' aptmark showmanual + testsuccessequal 'bar' aptmark showmanual testsuccessequal 'bar' aptmark showmanual bar } testmarkonpkgasauto() { @@ -59,8 +54,6 @@ testmarkonpkgasauto 'aptget' 'markauto' 'unmarkauto' testnoholdpkg() { testempty aptmark showhold testempty aptmark showholds # typical "typo" - testempty aptmark showhold dpkg - testempty aptmark showholds dpkg } testpkgonhold() { testsuccessequal "$1" aptmark showhold diff --git a/test/integration/test-apt-move-and-forget-manual-sections b/test/integration/test-apt-move-and-forget-manual-sections index 69a7d9f1d..4617abab3 100755 --- a/test/integration/test-apt-move-and-forget-manual-sections +++ b/test/integration/test-apt-move-and-forget-manual-sections @@ -15,17 +15,17 @@ buildsimplenativepackage 'libdef' 'native' '1' 'unstable' '' '' 'libs' setupaptarchive testmarkedauto -testmarkedmanual 'dpkg' +testmarkedmanual testsuccess aptget install libabc/stable -y testdpkginstalled 'libabc' testdpkgnotinstalled 'libdef' -testmarkedmanual 'dpkg' 'libabc' +testmarkedmanual 'libabc' testmarkedauto testsuccess aptget dist-upgrade -y testdpkginstalled 'libabc' 'libdef' testmarkedauto 'libabc' -testmarkedmanual 'dpkg' 'libdef' +testmarkedmanual 'libdef' diff --git a/test/integration/test-apt-never-markauto-sections b/test/integration/test-apt-never-markauto-sections index 6ad89c506..a77d6b22b 100755 --- a/test/integration/test-apt-never-markauto-sections +++ b/test/integration/test-apt-never-markauto-sections @@ -25,11 +25,11 @@ setupaptarchive testsuccess aptcache show nosection testfailure grep 'Section' rootdir/tmp/testsuccess.output -testequal 'dpkg' aptmark showmanual +testempty aptmark showmanual testsuccess aptget install mydesktop -y -o Debug::pkgProblemResolver=1 -o Debug::pkgDepCache::Marker=1 -o Debug::pkgDepCache::AutoInstall=1 -testmarkedmanual 'dpkg' 'mydesktop' +testmarkedmanual 'mydesktop' testmarkedauto 'mydesktop-core' 'foreignpkg:i386' 'texteditor' 'browser' 'nosection' # if the remove is from a user, don't do manual-bit passing @@ -60,22 +60,22 @@ testsuccess aptget autoremove texteditor -y testdpkgnotinstalled mydesktop mydesktop-core texteditor testdpkginstalled browser -testmarkedmanual 'browser' 'dpkg' 'foreignpkg:i386' 'nosection' +testmarkedmanual 'browser' 'foreignpkg:i386' 'nosection' testmarkedauto # test that installed/upgraded auto-pkgs are not set to manual testsuccess aptget install browser=41 -y --allow-downgrades -testmarkedmanual 'browser' 'dpkg' 'foreignpkg:i386' 'nosection' +testmarkedmanual 'browser' 'foreignpkg:i386' 'nosection' testmarkedauto testsuccess aptmark auto browser testmarkedauto 'browser' testsuccess aptmark auto nosection testmarkedauto 'browser' 'nosection' -testmarkedmanual 'dpkg' 'foreignpkg:i386' +testmarkedmanual 'foreignpkg:i386' testsuccess aptget install mydesktop -y -o Debug::pkgProblemResolver=1 -o Debug::pkgDepCache::Marker=1 -o Debug::pkgDepCache::AutoInstall=1 -testmarkedmanual 'dpkg' 'foreignpkg:i386' 'mydesktop' +testmarkedmanual 'foreignpkg:i386' 'mydesktop' testmarkedauto 'browser' 'mydesktop-core' 'texteditor' 'nosection' diff --git a/test/integration/test-apt-patterns b/test/integration/test-apt-patterns index b015655d9..7f202710c 100755 --- a/test/integration/test-apt-patterns +++ b/test/integration/test-apt-patterns @@ -91,7 +91,6 @@ automatic2/now 1.0 i386 [installed,local] available/unstable 1.0 all broken/now 1.0 i386 [installed,local] conf-only/now 1.0 i386 [residual-config] -dpkg/now 1.16.2+fake all [installed,local] essential/now 1.0 i386 [installed,local] foreign/unstable 2.0 amd64 manual1/now 1.0 i386 [installed,local] @@ -180,7 +179,6 @@ testsuccessequal "Listing... automatic1/now 1.0 i386 [installed,local] automatic2/now 1.0 i386 [installed,local] broken/now 1.0 i386 [installed,local] -dpkg/now 1.16.2+fake all [installed,local] essential/now 1.0 i386 [installed,local] manual1/now 1.0 i386 [installed,local] manual2/now 1.0 i386 [installed,local] diff --git a/test/integration/test-apt-update-nofallback b/test/integration/test-apt-update-nofallback index 637716543..18f12b1e3 100755 --- a/test/integration/test-apt-update-nofallback +++ b/test/integration/test-apt-update-nofallback @@ -41,8 +41,7 @@ N: See apt-secure(8) manpage for repository creation and user configuration deta assert_repo_is_intact() { - testsuccessequal "dpkg/now 1.16.2+fake all [installed,local] -foo/unstable 2.0 all" apt list -qq + testsuccessequal 'foo/unstable 2.0 all' apt list -qq testsuccess aptget install -y -s foo testfailure aptget install -y evil testsuccess aptget source foo --print-uris diff --git a/test/integration/test-apt-update-rollback b/test/integration/test-apt-update-rollback index ea431c816..8235968bb 100755 --- a/test/integration/test-apt-update-rollback +++ b/test/integration/test-apt-update-rollback @@ -39,8 +39,7 @@ start_with_good_inrelease() { create_fresh_archive testsuccess aptget update listcurrentlistsdirectory > lists.before - testsuccessequal 'dpkg/now 1.16.2+fake all [installed,local] -old/unstable 1.0 all' apt list -qq + testsuccessequal 'old/unstable 1.0 all' apt list -qq } test_inrelease_to_new_inrelease() { @@ -49,8 +48,7 @@ test_inrelease_to_new_inrelease() { add_new_package '+1hour' testsuccess aptget update -o Debug::Acquire::Transaction=1 - testsuccessequal 'dpkg/now 1.16.2+fake all [installed,local] -new/unstable 1.0 all + testsuccessequal 'new/unstable 1.0 all old/unstable 1.0 all' apt list -qq } diff --git a/test/integration/test-bug-728500-tempdir b/test/integration/test-bug-728500-tempdir index 8fab8f28f..7497ffcf8 100755 --- a/test/integration/test-bug-728500-tempdir +++ b/test/integration/test-bug-728500-tempdir @@ -18,6 +18,5 @@ export TMPDIR=/does-not-exists testsuccess aptget update -o Debug::Acquire::gpg=1 unset TMPDIR -testsuccessequal 'dpkg -coolstuff' aptcache pkgnames +testsuccessequal 'coolstuff' aptcache pkgnames testsuccess ls rootdir/var/lib/apt/lists/*InRelease diff --git a/test/integration/test-bug-753297-upgradable b/test/integration/test-bug-753297-upgradable index 353728db0..f33a6591d 100755 --- a/test/integration/test-bug-753297-upgradable +++ b/test/integration/test-bug-753297-upgradable @@ -31,5 +31,4 @@ N: There is 1 additional version. Please use the '-a' switch to see it" apt list testsuccessequal "Listing... bar/testing 2 all [upgradable from: 1] -dpkg/now 1.16.2+fake all [installed,local] foo/testing,now 1 all [installed]" apt list diff --git a/test/integration/test-external-dependency-solver-protocol b/test/integration/test-external-dependency-solver-protocol index 0091263b7..485a77068 100755 --- a/test/integration/test-external-dependency-solver-protocol +++ b/test/integration/test-external-dependency-solver-protocol @@ -213,7 +213,7 @@ APT-Candidate: yes Package: stuff Architecture: all Version: 1 -APT-ID: 8 +APT-ID: 7 Source: stuff Source-Version: 1 Priority: optional diff --git a/test/integration/test-external-installation-planner-protocol b/test/integration/test-external-installation-planner-protocol index 56a7ad1d6..192f21bb3 100755 --- a/test/integration/test-external-installation-planner-protocol +++ b/test/integration/test-external-installation-planner-protocol @@ -43,7 +43,7 @@ Remove: bar:amd64 Install: foo:amd64 libfoo:amd64 Planner: internal' head -n 6 "$EIPPLOG" aptinternalplanner < "$EIPPLOG" > planner.log || true -testsuccessequal 'Remove: 7 +testsuccessequal 'Remove: 6 Unpack: 2 Unpack: 4' grep -e '^Unpack:' -e '^Install:' -e '^Configure:' -e '^Remove:' planner.log diff --git a/test/integration/test-prevent-markinstall-multiarch-same-versionscrew b/test/integration/test-prevent-markinstall-multiarch-same-versionscrew index 63fdb88d9..796623840 100755 --- a/test/integration/test-prevent-markinstall-multiarch-same-versionscrew +++ b/test/integration/test-prevent-markinstall-multiarch-same-versionscrew @@ -97,7 +97,7 @@ Conf out-of-sync-gone-foreign (2 unstable [amd64]) Conf out-of-sync-gone-native:i386 (2 unstable [i386])' aptget dist-upgrade -s #-o Debug::pkgDepCache::Marker=1 testempty dpkg -C -rm rootdir/var/lib/dpkg/status +rm -f rootdir/var/lib/dpkg/status insertinstalledpackage 'libsame2' 'i386' '1' 'Multi-Arch: same' insertinstalledpackage 'libsame3' 'i386' '1' 'Multi-Arch: same' diff --git a/test/integration/test-ubuntu-bug-1876495-pkgnames-virtual b/test/integration/test-ubuntu-bug-1876495-pkgnames-virtual index 2391c7e2d..627bd0c78 100755 --- a/test/integration/test-ubuntu-bug-1876495-pkgnames-virtual +++ b/test/integration/test-ubuntu-bug-1876495-pkgnames-virtual @@ -14,10 +14,8 @@ setupaptarchive changetowebserver testsuccess aptget update -o Debug::Acquire::gpg=1 -testsuccessequal "dpkg -coolstuff" aptcache pkgnames +testsuccessequal 'coolstuff' aptcache pkgnames -testsuccessequal "dpkg -source-package +testsuccessequal 'source-package virtual-package -coolstuff" aptcache pkgnames --all-names +coolstuff' aptcache pkgnames --all-names -- cgit v1.2.3-70-g09d2 From f52c1ce9b31befb71016a20759b96b4946034fcb Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 1 Sep 2022 15:14:52 +0200 Subject: Allow apt to run if no dpkg/status file exists Not having a dpkg/status file used to be a hard error which from a boostrap perspective is suspect as in the beginning, there is no status so you would need to touch it into existence. We make a difference between factual non-existence and inaccessibility to catch mistakes in which the file is not readable for some reason, the testcase test-bug-254770-segfault-if-cache-not-buildable is an example of this. Note that apt has already figured out at this point that this is a Debian-like system which should have a dpkg/status file. This change does not effect the auto-detection and is not supposed to. --- apt-pkg/deb/debsystem.cc | 7 +++++++ apt-pkg/policy.cc | 14 ++++++++------ test/integration/framework | 2 -- .../integration/test-allow-scores-for-all-dependency-types | 5 ++--- test/integration/test-apt-cache-remapping | 1 + test/integration/test-apt-cli-update | 3 +-- test/integration/test-bug-604222-new-and-autoremove | 4 +--- test/integration/test-bug-673536-pre-depends-breaks-loop | 5 +---- test/integration/test-bug-782777-single-arch-weirdness | 3 +-- test/integration/test-failing-maintainer-scripts | 9 ++++----- test/integration/test-policy-pinning | 2 ++ ...st-ubuntu-bug-1130419-prefer-installed-ma-same-siblings | 3 +-- .../test-ubuntu-bug-784473-InRelease-one-message-only | 4 ++++ test/integration/test-unpack-different-version-unpacked | 5 +---- 14 files changed, 34 insertions(+), 33 deletions(-) diff --git a/apt-pkg/deb/debsystem.cc b/apt-pkg/deb/debsystem.cc index 65a27f72f..9c55e0a6e 100644 --- a/apt-pkg/deb/debsystem.cc +++ b/apt-pkg/deb/debsystem.cc @@ -338,6 +338,13 @@ bool debSystem::AddStatusFiles(std::vector &List) if (d->StatusFile == nullptr) { auto dpkgstatus = _config->FindFile("Dir::State::status"); + if (dpkgstatus.empty()) + return true; + // we ignore only if the file doesn't exist, not if it is inaccessible + // e.g. due to permissions on parent directories as FileExists would do + errno = 0; + if (access(dpkgstatus.c_str(), R_OK) != 0 && errno == ENOENT) + return true; _error->PushToStack(); d->StatusFile = new debStatusIndex(std::move(dpkgstatus)); bool const errored = _error->PendingError(); diff --git a/apt-pkg/policy.cc b/apt-pkg/policy.cc index 5fcc11b66..68b3f5e5f 100644 --- a/apt-pkg/policy.cc +++ b/apt-pkg/policy.cc @@ -70,17 +70,19 @@ pkgPolicy::pkgPolicy(pkgCache *Owner) : VerPins(nullptr), if (DefRel.empty() == false) { bool found = false; - // FIXME: make ExpressionMatches static to use it here easily - pkgVersionMatch vm("", pkgVersionMatch::None); for (pkgCache::PkgFileIterator F = Cache->FileBegin(); F != Cache->FileEnd(); ++F) { - if (vm.ExpressionMatches(DefRel, F.Archive()) || - vm.ExpressionMatches(DefRel, F.Codename()) || - vm.ExpressionMatches(DefRel, F.Version()) || + if (pkgVersionMatch::ExpressionMatches(DefRel, F.Archive()) || + pkgVersionMatch::ExpressionMatches(DefRel, F.Codename()) || + pkgVersionMatch::ExpressionMatches(DefRel, F.Version()) || (DefRel.length() > 2 && DefRel[1] == '=')) found = true; } - if (found == false) + // "now" is our internal archive name for the status file, + // which we should accept even if we have no status file at the moment + if (not found && pkgVersionMatch::ExpressionMatches(DefRel, "now")) + found = true; + if (not found) _error->Error(_("The value '%s' is invalid for APT::Default-Release as such a release is not available in the sources"), DefRel.c_str()); else CreatePin(pkgVersionMatch::Release,"",DefRel,990); diff --git a/test/integration/framework b/test/integration/framework index 5e1e68a98..d50b63518 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -626,8 +626,6 @@ configdpkg() { if tail -1 rootdir/var/lib/dpkg/status | grep -q .; then echo >> rootdir/var/lib/dpkg/status fi - else - echo -n > rootdir/var/lib/dpkg/status fi fi rm -f rootdir/etc/apt/apt.conf.d/00foreigndpkg diff --git a/test/integration/test-allow-scores-for-all-dependency-types b/test/integration/test-allow-scores-for-all-dependency-types index b8a9ed3ea..999efc04e 100755 --- a/test/integration/test-allow-scores-for-all-dependency-types +++ b/test/integration/test-allow-scores-for-all-dependency-types @@ -37,7 +37,6 @@ insertpackage 'jessie' 'login' 'amd64' '2' 'Pre-Depends: libaudit1 (>= 0)' insertpackage 'jessie' 'libaudit1' 'amd64' '2' 'Depends: libaudit-common (>= 0)' insertpackage 'jessie' 'libaudit-common' 'amd64' '2' 'Breaks: libaudit0, libaudit1 (<< 2)' -cp rootdir/var/lib/dpkg/status rootdir/var/lib/dpkg/status-backup setupaptarchive insertinstalledpackage 'libdb-dev' 'amd64' '5.1.7' 'Depends: libdb5.1-dev' @@ -73,7 +72,7 @@ Inst libdb5.3-dev (5.3.28-3 versioned [amd64]) Conf libdb-dev (5.3.0 versioned [amd64]) Conf libdb5.3-dev (5.3.28-3 versioned [amd64])' aptget dist-upgrade -st versioned -cp -f rootdir/var/lib/dpkg/status-backup rootdir/var/lib/dpkg/status +rm -f rootdir/var/lib/dpkg/status insertinstalledpackage 'foo' 'amd64' '1' insertinstalledpackage 'bar' 'amd64' '1' testsuccessequal 'Reading package lists... @@ -131,7 +130,7 @@ Conf bar (2 versioned [amd64]) Conf baz (2 versioned [amd64])' aptget install baz -st versioned # recreating the exact situation is hard, so we pull tricks to get the score -cp -f rootdir/var/lib/dpkg/status-backup rootdir/var/lib/dpkg/status +rm -f rootdir/var/lib/dpkg/status insertinstalledpackage 'gdm3' 'amd64' '1' 'Depends: libaudit0, libaudit0' insertinstalledpackage 'login' 'amd64' '1' 'Essential: yes' insertinstalledpackage 'libaudit0' 'amd64' '1' diff --git a/test/integration/test-apt-cache-remapping b/test/integration/test-apt-cache-remapping index 31a406c57..19647a6a4 100755 --- a/test/integration/test-apt-cache-remapping +++ b/test/integration/test-apt-cache-remapping @@ -8,6 +8,7 @@ setupenvironment configarchitecture 'amd64' buildsimplenativepackage 'foo' 'amd64' '1' +insertinstalledpackage 'bar' 'all' '1' # the default is 1MB – too much for our simple tests echo 'APT::Cache-Grow "1000";' > rootdir/etc/apt/apt.conf.d/limit-cachegrow.conf diff --git a/test/integration/test-apt-cli-update b/test/integration/test-apt-cli-update index cc8d051d2..810221510 100755 --- a/test/integration/test-apt-cli-update +++ b/test/integration/test-apt-cli-update @@ -8,7 +8,6 @@ setupenvironment configarchitecture "i386" insertpackage 'unstable' 'foo' 'all' '2.0' -cp rootdir/var/lib/dpkg/status dpkg.status insertinstalledpackage 'foo' 'all' '1.0' setupaptarchive --no-update @@ -18,6 +17,6 @@ testfailuremsg 'E: The update command takes no arguments' apt update arguments testempty apt update -qq -o pkgCacheFile::Generate=false testsuccessequal "1 package can be upgraded. Run 'apt list --upgradable' to see it." apt update -qq -cp dpkg.status rootdir/var/lib/dpkg/status +rm -f rootdir/var/lib/dpkg/status insertinstalledpackage 'foo' 'all' '2.0' testsuccessequal 'All packages are up to date.' apt update -qq diff --git a/test/integration/test-bug-604222-new-and-autoremove b/test/integration/test-bug-604222-new-and-autoremove index 08756e03d..47da810c6 100755 --- a/test/integration/test-bug-604222-new-and-autoremove +++ b/test/integration/test-bug-604222-new-and-autoremove @@ -19,7 +19,6 @@ insertpackage 'stable' 'libkipi-data' 'i386' '4:15.08.0-1' '' 'important' setupaptarchive -cp -a rootdir/var/lib/dpkg/status rootdir/var/lib/dpkg/status.backup insertinstalledpackage 'libvtk5.4' 'i386' '5.4.2-7' testsuccess aptmark markauto 'libvtk5.4' testmarkedauto 'libvtk5.4' @@ -80,8 +79,7 @@ Need to get 0 B/126 B of archives. After this operation, 129 kB of additional disk space will be used. E: Trivial Only specified but this is not a trivial operation." aptget install dummy-archive --trivial-only -o APT::Get::HideAutoRemove=small -cp rootdir/var/lib/dpkg/status.backup rootdir/var/lib/dpkg/status -rm -f rootdir/var/lib/apt/extended_states +rm -f rootdir/var/lib/dpkg/status rootdir/var/lib/apt/extended_states CONFLICTING='Reading package lists... Building dependency tree... diff --git a/test/integration/test-bug-673536-pre-depends-breaks-loop b/test/integration/test-bug-673536-pre-depends-breaks-loop index a4cf66973..650866ee5 100755 --- a/test/integration/test-bug-673536-pre-depends-breaks-loop +++ b/test/integration/test-bug-673536-pre-depends-breaks-loop @@ -18,11 +18,8 @@ setupaptarchive # we check with 'real' packages here as the simulation reports a 'Conf broken' # which is technical correct for the simulation, but testing errormsg is ugly -cp -a rootdir/var/lib/dpkg/status dpkg.status.backup - testloopbreak() { - cp -a dpkg.status.backup rootdir/var/lib/dpkg/status - rm -f rootdir/var/lib/apt/extended_states + rm -f rootdir/var/lib/dpkg/status rootdir/var/lib/apt/extended_states testsuccess aptget install advanced=1 -y -t "$1" testdpkginstalled advanced diff --git a/test/integration/test-bug-782777-single-arch-weirdness b/test/integration/test-bug-782777-single-arch-weirdness index 41be1e79c..695d053d3 100755 --- a/test/integration/test-bug-782777-single-arch-weirdness +++ b/test/integration/test-bug-782777-single-arch-weirdness @@ -50,7 +50,6 @@ is only available from another source E: Package 'abar:amd64' has no installation candidate E: Package 'zfoo:amd64' has no installation candidate" aptget install abar:amd64 zfoo:amd64 -s - cp -f rootdir/var/lib/dpkg/status status.backup insertinstalledpackage 'abar' 'i386' '1' insertinstalledpackage 'zfoo' 'i386' '1' @@ -62,7 +61,7 @@ zfoo set to automatically installed.' aptmark auto abar zfoo testequal 'abar zfoo' aptmark showauto abar zfoo - mv -f status.backup rootdir/var/lib/dpkg/status + rm -f rootdir/var/lib/dpkg/status } msgmsg 'Single-Arch testrun' diff --git a/test/integration/test-failing-maintainer-scripts b/test/integration/test-failing-maintainer-scripts index 8cf2380ee..c2d631634 100755 --- a/test/integration/test-failing-maintainer-scripts +++ b/test/integration/test-failing-maintainer-scripts @@ -70,22 +70,21 @@ testmyfailure() { testmarkedauto 'dependee' } -cp -a rootdir/var/lib/dpkg/status rootdir/var/lib/dpkg/status.backup testmyfailure aptget install failure-preinst -y -cp -a rootdir/var/lib/dpkg/status.backup rootdir/var/lib/dpkg/status +rm -f rootdir/var/lib/dpkg/status testmyfailure aptget install failure-postinst -y -cp -a rootdir/var/lib/dpkg/status.backup rootdir/var/lib/dpkg/status +rm -f rootdir/var/lib/dpkg/status testsuccess aptget install failure-prerm -y testdpkginstalled failure-prerm testmyfailure aptget purge failure-prerm -y -cp -a rootdir/var/lib/dpkg/status.backup rootdir/var/lib/dpkg/status +rm -f rootdir/var/lib/dpkg/status testsuccess aptget install failure-postrm -y testdpkginstalled failure-postrm testmyfailure aptget purge failure-postrm -y # FIXME: test with output going to a PTY as it usually does if false; then - cp -a rootdir/var/lib/dpkg/status.backup rootdir/var/lib/dpkg/status + rm -f rootdir/var/lib/dpkg/status apt install dependee -y || true apt install failure-postinst -y || true fi diff --git a/test/integration/test-policy-pinning b/test/integration/test-policy-pinning index fccef6da3..dc3192fe9 100755 --- a/test/integration/test-policy-pinning +++ b/test/integration/test-policy-pinning @@ -7,6 +7,8 @@ TESTDIR="$(readlink -f "$(dirname "$0")")" setupenvironment configarchitecture "i386" +insertinstalledpackage 'foobar' 'all' '1' + buildaptarchive setupflataptarchive diff --git a/test/integration/test-ubuntu-bug-1130419-prefer-installed-ma-same-siblings b/test/integration/test-ubuntu-bug-1130419-prefer-installed-ma-same-siblings index 4ac5e9060..d76602631 100755 --- a/test/integration/test-ubuntu-bug-1130419-prefer-installed-ma-same-siblings +++ b/test/integration/test-ubuntu-bug-1130419-prefer-installed-ma-same-siblings @@ -43,7 +43,6 @@ Inst steam:i386 (2 unstable [i386]) Conf libmesa:i386 (2 unstable [i386]) Conf steam:i386 (2 unstable [i386])' aptget install steam -st unstable -cp rootdir/var/lib/dpkg/status default-status.dpkg insertinstalledpackage 'libmesa' 'amd64' '1' 'Multi-Arch: same' testsuccessequal 'Reading package lists... Building dependency tree... @@ -72,7 +71,7 @@ Conf libmesa (2 unstable [amd64]) Conf libmesa:i386 (2 unstable [i386]) Conf steam:i386 (2 unstable [i386])' aptget install steam -st unstable -cp default-status.dpkg rootdir/var/lib/dpkg/status +rm -f rootdir/var/lib/dpkg/status insertinstalledpackage 'libmesa-lts' 'amd64' '1' 'Provides: libmesa Conflicts: libmesa Multi-Arch: same' diff --git a/test/integration/test-ubuntu-bug-784473-InRelease-one-message-only b/test/integration/test-ubuntu-bug-784473-InRelease-one-message-only index fe42ba83d..80e41f2c2 100755 --- a/test/integration/test-ubuntu-bug-784473-InRelease-one-message-only +++ b/test/integration/test-ubuntu-bug-784473-InRelease-one-message-only @@ -28,6 +28,10 @@ done testfailure aptget update testsuccess grep '^E:.*Clearsigned file .*NOSPLIT.*' rootdir/tmp/testfailure.output +testsuccessequal "Package files: +Pinned packages:" aptcache policy + +insertinstalledpackage 'foo' 'all' '1' ROOTDIR="$(readlink -f .)" testsuccessequal "Package files: diff --git a/test/integration/test-unpack-different-version-unpacked b/test/integration/test-unpack-different-version-unpacked index bcb483639..e7da64ceb 100755 --- a/test/integration/test-unpack-different-version-unpacked +++ b/test/integration/test-unpack-different-version-unpacked @@ -9,11 +9,8 @@ configarchitecture 'amd64' 'i386' insertpackage 'unstable' 'libqtcore4' 'i386,amd64' '2' 'Multi-Arch: same' setupaptarchive -DPKGSTATUS='rootdir/var/lib/dpkg/status' -cp $DPKGSTATUS dpkg.status - cleanstatus() { - cp dpkg.status $DPKGSTATUS + rm -f rootdir/var/lib/dpkg/status rm rootdir/var/cache/apt/*.bin } -- cgit v1.2.3-70-g09d2