diff options
Diffstat (limited to 'test/integration')
17 files changed, 699 insertions, 32 deletions
diff --git a/test/integration/framework b/test/integration/framework index 44dedb10b..e30fa066c 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -585,10 +585,14 @@ configdpkg() { # the arch apt treats as native might be foreign for dpkg for ARCH in ${ARCHS}; do if [ "${ARCH}" != "${DPKGARCH}" ]; then - if ! dpkg --add-architecture ${ARCH} >/dev/null 2>&1; then - # old-style used e.g. in Ubuntu-P – and as it seems travis - echo "DPKG::options:: \"--foreign-architecture\";" >> rootdir/etc/apt/apt.conf.d/00foreigndpkg - echo "DPKG::options:: \"${ARCH}\";" >> rootdir/etc/apt/apt.conf.d/00foreigndpkg + if ! dpkg --add-architecture ${ARCH} >rootdir/tmp/dpkgaddarch.output 2>&1; then + if grep -q 'pkg-config-dpkghook' rootdir/tmp/dpkgaddarch.output; then + msgwarn 'Ignoring failure of dpkg --add-architecture as it is likely due to pkg-config-dpkghook (see #824774)' + else + # old-style used e.g. in Ubuntu-P – and as it seems travis + echo "DPKG::options:: \"--foreign-architecture\";" >> rootdir/etc/apt/apt.conf.d/00foreigndpkg + echo "DPKG::options:: \"${ARCH}\";" >> rootdir/etc/apt/apt.conf.d/00foreigndpkg + fi fi fi done diff --git a/test/integration/test-bug-549968-install-depends-of-not-installed b/test/integration/test-bug-549968-install-depends-of-not-installed index fab67c4e9..90ce58a33 100755 --- a/test/integration/test-bug-549968-install-depends-of-not-installed +++ b/test/integration/test-bug-549968-install-depends-of-not-installed @@ -17,7 +17,7 @@ setupaptarchive testsuccessequal "Reading package lists... Building dependency tree... MarkInstall coolstuff:i386 < none -> 1.0 @un puN IPb > FU=1 - Ignore MarkInstall of extracoolstuff:i386 < none | 1.0 @hn puH > as its mode (Keep) is protected + coolstuff:i386 Recommends on extracoolstuff:i386 < none | 1.0 @hn puH > can't be satisfied! (dep) Package 'extracoolstuff' is not installed, so not removed Recommended packages: extracoolstuff diff --git a/test/integration/test-bug-604222-new-and-autoremove b/test/integration/test-bug-604222-new-and-autoremove index 6009ca0d2..aaeac09a8 100755 --- a/test/integration/test-bug-604222-new-and-autoremove +++ b/test/integration/test-bug-604222-new-and-autoremove @@ -59,12 +59,10 @@ The following package was automatically installed and is no longer required: libvtk5.4 Use '$AUTOREMOVE' to remove it. The following additional packages will be installed: - libavcodec52 libopenal-dev libvtk5.4 + libavcodec52 libopenal-dev The following NEW packages will be installed: dummy-archive libavcodec52 libopenal-dev -The following packages will be upgraded: - libvtk5.4 -1 upgraded, 3 newly installed, 0 to remove and 0 not upgraded. +0 upgraded, 3 newly installed, 0 to remove and 1 not upgraded. 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 testequal "Reading package lists... @@ -73,12 +71,10 @@ Reading state information... 1 package was automatically installed and is no longer required. Use '$AUTOREMOVE' to remove it. The following additional packages will be installed: - libavcodec52 libopenal-dev libvtk5.4 + libavcodec52 libopenal-dev The following NEW packages will be installed: dummy-archive libavcodec52 libopenal-dev -The following packages will be upgraded: - libvtk5.4 -1 upgraded, 3 newly installed, 0 to remove and 0 not upgraded. +0 upgraded, 3 newly installed, 0 to remove and 1 not upgraded. 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 @@ -88,12 +84,11 @@ rm -f rootdir/var/lib/apt/extended_states CONFLICTING='Reading package lists... Building dependency tree... MarkInstall dummy-archive:i386 < none -> 0.invalid.0 @un puN Ib > FU=1 - MarkInstall libvtk5-dev:i386 < none -> 5.4.2-8 @un uN Ib > FU=0 - MarkInstall libvtk5.4:i386 < none -> 5.4.2-8 @un uN > FU=0 - MarkKeep libvtk5-dev:i386 < none -> 5.4.2-8 @un uN > FU=0 - MarkKeep libvtk5-dev:i386 < none -> 5.4.2-8 @un uN > FU=0 + MarkInstall libavcodec52:i386 < none -> 4:0.5.2-6 @un puN > FU=0 + MarkInstall libopenal-dev:i386 < none -> 1:1.12.854-2 @un puN > FU=0 + Ignore MarkGarbage of libopenal-dev:i386 < none -> 1:1.12.854-2 @un puN > as its mode (Install) is protected Ignore MarkGarbage of libavcodec52:i386 < none -> 4:0.5.2-6 @un puN > as its mode (Install) is protected - MarkDelete libvtk5.4:i386 < none -> 5.4.2-8 @un ugN > FU=0 + Ignore MarkGarbage of libopenal-dev:i386 < none -> 1:1.12.854-2 @un puN > as its mode (Install) is protected Ignore MarkGarbage of libavcodec52:i386 < none -> 4:0.5.2-6 @un puN > as its mode (Install) is protected The following additional packages will be installed: libavcodec52 libopenal-dev diff --git a/test/integration/test-bug-618848-always-respect-user-requests b/test/integration/test-bug-618848-always-respect-user-requests index 230683a99..1e144f1ee 100755 --- a/test/integration/test-bug-618848-always-respect-user-requests +++ b/test/integration/test-bug-618848-always-respect-user-requests @@ -13,11 +13,12 @@ insertpackage 'unstable' 'exim4-daemon-heavy' 'all' '1.0' 'Depends: libdb4.8' setupaptarchive -testsuccessequal 'Reading package lists... +testsuccessequal "Reading package lists... Building dependency tree... MarkDelete libdb4.8:i386 < 1.0 @ii pmK > FU=1 MarkDelete exim4-daemon-light:i386 < 1.0 @ii mK Ib > FU=0 MarkInstall exim4-daemon-heavy:i386 < none -> 1.0 @un uN Ib > FU=0 + exim4-daemon-heavy:i386 Depends on libdb4.8:i386 < 1.0 @ii pmR > can't be satisfied! (dep) MarkDelete exim4:i386 < 1.0 @ii mK Ib > FU=0 The following packages will be REMOVED: exim4 exim4-daemon-light libdb4.8 @@ -27,4 +28,4 @@ Remv exim4 [1.0] MarkDelete exim4-daemon-light:i386 < 1.0 @ii K > FU=1 Remv exim4-daemon-light [1.0] MarkDelete libdb4.8:i386 < 1.0 @ii K > FU=1 -Remv libdb4.8 [1.0]' aptget remove libdb4.8 -s -o Debug::pkgDepCache::Marker=1 +Remv libdb4.8 [1.0]" aptget remove libdb4.8 -s -o Debug::pkgDepCache::Marker=1 diff --git a/test/integration/test-bug-735967-lib32-to-i386-unavailable b/test/integration/test-bug-735967-lib32-to-i386-unavailable index 9dbd17bfd..b836451fd 100755 --- a/test/integration/test-bug-735967-lib32-to-i386-unavailable +++ b/test/integration/test-bug-735967-lib32-to-i386-unavailable @@ -53,7 +53,7 @@ The following information may help to resolve the situation: The following packages have unmet dependencies: libfoo : Depends: libfoo-bin but it is not installable -E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.' aptget install foo -s +E: Unable to correct problems, you have held broken packages.' aptget install foo -s # activate multiarch configarchitecture 'amd64' 'i386' diff --git a/test/integration/test-bug-960705-propagate-protected-to-satisfied-conflict b/test/integration/test-bug-960705-propagate-protected-to-satisfied-conflict new file mode 100755 index 000000000..ad1501b66 --- /dev/null +++ b/test/integration/test-bug-960705-propagate-protected-to-satisfied-conflict @@ -0,0 +1,53 @@ +#!/bin/sh +set -e + +TESTDIR="$(readlink -f "$(dirname "$0")")" +. "$TESTDIR/framework" +setupenvironment +configarchitecture 'amd64' + +insertpackage 'unstable' 'runit-init' 'all' '1' 'Conflicts: systemd-sysv, sysvinit-core, runit-init' +# note how the rest do not know of runit-init +insertpackage 'unstable' 'sysvinit-core' 'all' '1' 'Conflicts: systemd-sysv, sysvinit-core' +insertpackage 'unstable,installed' 'systemd-sysv' 'all' '1' 'Conflicts: systemd-sysv, sysvinit-core' +insertpackage 'unstable,installed' 'init' 'all' '1' 'Pre-Depends: systemd-sysv | sysvinit-core +Important: yes' + +setupaptarchive + +testsuccessequal "Reading package lists... +Building dependency tree... + Removing: systemd-sysv:amd64 as upgrade is not an option for runit-init:amd64 (1) + MarkDelete systemd-sysv:amd64 < 1 @ii mK > FU=0 + MarkInstall runit-init:amd64 < none -> 1 @un puN > FU=1 +Starting pkgProblemResolver with broken count: 1 +Starting 2 pkgProblemResolver with broken count: 1 +Investigating (0) init:amd64 < 1 @ii mK Ib > +Broken init:amd64 PreDepends on systemd-sysv:amd64 < 1 @ii pmR > + Considering systemd-sysv:amd64 0 as a solution to init:amd64 5100 + Added systemd-sysv:amd64 to the remove list +Broken init:amd64 PreDepends on sysvinit-core:amd64 < none @un pH > + Considering sysvinit-core:amd64 0 as a solution to init:amd64 5100 + Ignore MarkKeep of systemd-sysv:amd64 < 1 @ii pmR > as its mode (Delete) is protected +Investigating (1) init:amd64 < 1 @ii mK Ib > +Broken init:amd64 PreDepends on systemd-sysv:amd64 < 1 @ii pmR > + Considering systemd-sysv:amd64 5100 as a solution to init:amd64 5100 +Broken init:amd64 PreDepends on sysvinit-core:amd64 < none @un pH > + Considering sysvinit-core:amd64 0 as a solution to init:amd64 5100 + Or group remove for init:amd64 + MarkDelete init:amd64 < 1 @ii mK Ib > FU=0 +Done +The following packages will be REMOVED: + init systemd-sysv +The following NEW packages will be installed: + runit-init +WARNING: The following essential packages will be removed. +This should NOT be done unless you know exactly what you are doing! + init systemd-sysv (due to init) + MarkDelete init:amd64 < 1 @ii K > FU=1 +0 upgraded, 1 newly installed, 2 to remove and 0 not upgraded. +Remv init [1] + MarkDelete systemd-sysv:amd64 < 1 | none @ii H > FU=1 +Remv systemd-sysv [1] +Inst runit-init (1 unstable [all]) +Conf runit-init (1 unstable [all])" apt install runit-init -so Debug::pkgProblemResolver=1 -o Debug::pkgDepCache::Marker=1 -o Debug::pkgDepCache::AutoInstall=1 diff --git a/test/integration/test-bug-960705-propagate-protected-to-satisfied-depends b/test/integration/test-bug-960705-propagate-protected-to-satisfied-depends new file mode 100755 index 000000000..ca6bf8d7c --- /dev/null +++ b/test/integration/test-bug-960705-propagate-protected-to-satisfied-depends @@ -0,0 +1,45 @@ +#!/bin/sh +set -e + +TESTDIR="$(readlink -f "$(dirname "$0")")" +. "$TESTDIR/framework" +setupenvironment +configarchitecture 'amd64' + +# without requires-foo it is sadly not as clear cut what should happen +insertpackage 'unstable' 'foobar' 'all' '1' 'Depends: foo | bar, requires-foo, conflicts-foo | fine-foo' +insertpackage 'unstable' 'foo' 'all' '1' 'Depends: foo-depends' +insertpackage 'unstable' 'foo-depends' 'all' '1' +insertpackage 'unstable' 'bar' 'all' '1' +insertpackage 'unstable' 'requires-foo' 'all' '1' 'Depends: foo' +insertpackage 'unstable' 'conflicts-foo' 'all' '1' 'Conflicts: foo' +insertpackage 'unstable' 'fine-foo' 'all' '1' + + +setupaptarchive + +testsuccessequal "Reading package lists... +Building dependency tree... + Installing foo:amd64 as Depends of foobar:amd64 + Installing foo-depends:amd64 as Depends of foo:amd64 + Installing requires-foo:amd64 as Depends of foobar:amd64 + Installing conflicts-foo:amd64 as Depends of foobar:amd64 + Installing fine-foo:amd64 as Depends of foobar:amd64 +Starting pkgProblemResolver with broken count: 0 +Starting 2 pkgProblemResolver with broken count: 0 +Done +The following additional packages will be installed: + fine-foo foo foo-depends requires-foo +The following NEW packages will be installed: + fine-foo foo foo-depends foobar requires-foo +0 upgraded, 5 newly installed, 0 to remove and 0 not upgraded. +Inst fine-foo (1 unstable [all]) +Inst foo-depends (1 unstable [all]) +Inst foo (1 unstable [all]) +Inst requires-foo (1 unstable [all]) +Inst foobar (1 unstable [all]) +Conf fine-foo (1 unstable [all]) +Conf foo-depends (1 unstable [all]) +Conf foo (1 unstable [all]) +Conf requires-foo (1 unstable [all]) +Conf foobar (1 unstable [all])" apt install foobar -so Debug::pkgProblemResolver=1 -o Debug::pkgDepCache::AutoInstall=1 diff --git a/test/integration/test-bug-961266-hold-means-hold b/test/integration/test-bug-961266-hold-means-hold new file mode 100755 index 000000000..89c18ba85 --- /dev/null +++ b/test/integration/test-bug-961266-hold-means-hold @@ -0,0 +1,124 @@ +#!/bin/sh +set -e + +TESTDIR="$(readlink -f "$(dirname "$0")")" +. "$TESTDIR/framework" +setupenvironment +configarchitecture 'amd64' 'i386' + +insertinstalledpackage 'git' 'amd64' '1:2.25.1-1' 'Multi-Arch: foreign' +insertinstalledpackage 'git-cvs' 'amd64' '1:2.25.1-1' 'Depends: git (>> 1:2.25.1), git (<< 1:2.25.1-.)' + + +insertpackage 'unstable' 'git' 'amd64,i386' '1:2.26.2-1' 'Multi-Arch: foreign' +insertpackage 'unstable' 'git-cvs' 'amd64,i386' '1:2.26.2-1' 'Depends: git (>> 1:2.26.2), git (<< 1:2.26.2-.)' +insertpackage 'unstable' 'git-ng' 'amd64,i386' '1:2.26.2-1' 'Depends: git (>> 1:2.26.2), git (<< 1:2.26.2-.)' + +setupaptarchive + +msgmsg 'The setup is' 'fine' +UPGRADE='Reading package lists... +Building dependency tree... +Calculating upgrade... +The following packages will be upgraded: + git git-cvs +2 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. +Inst git-cvs [1:2.25.1-1] (1:2.26.2-1 unstable [amd64]) [] +Inst git [1:2.25.1-1] (1:2.26.2-1 unstable [amd64]) +Conf git-cvs (1:2.26.2-1 unstable [amd64]) +Conf git (1:2.26.2-1 unstable [amd64])' +testsuccessequal "$UPGRADE" apt upgrade -s +testsuccessequal "$UPGRADE" aptget upgrade -s +testsuccessequal "$UPGRADE" apt full-upgrade -s +testsuccessequal "$UPGRADE" aptget dist-upgrade -s + +testsuccessequal 'Reading package lists... +Building dependency tree... +The following additional packages will be installed: + git git-cvs +The following NEW packages will be installed: + git-ng +The following packages will be upgraded: + git git-cvs +2 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. +Inst git-cvs [1:2.25.1-1] (1:2.26.2-1 unstable [amd64]) [] +Inst git [1:2.25.1-1] (1:2.26.2-1 unstable [amd64]) +Inst git-ng (1:2.26.2-1 unstable [amd64]) +Conf git-cvs (1:2.26.2-1 unstable [amd64]) +Conf git (1:2.26.2-1 unstable [amd64]) +Conf git-ng (1:2.26.2-1 unstable [amd64])' apt install git-ng -s + + +msgmsg 'Now mix it up by' 'holding git' +testsuccessequal 'git set on hold.' aptmark hold git +testsuccessequal 'git' aptmark showholds + +NOUPGRADE='Reading package lists... +Building dependency tree... +Calculating upgrade... +The following packages have been kept back: + git git-cvs +0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.' + +testsuccessequal "$NOUPGRADE" apt upgrade -s +testsuccessequal "$NOUPGRADE" apt full-upgrade -s +testsuccessequal "$NOUPGRADE" aptget dist-upgrade -s +testsuccessequal "$NOUPGRADE" aptget upgrade -s + +testfailureequal 'Reading package lists... +Building dependency tree... +Some packages could not be installed. This may mean that you have +requested an impossible situation or if you are using the unstable +distribution that some required packages have not yet been created +or been moved out of Incoming. +The following information may help to resolve the situation: + +The following packages have unmet dependencies: + git-ng : Depends: git (> 1:2.26.2) +E: Unable to correct problems, you have held broken packages.' apt install git-ng -s + + +msgmsg 'Now mix it up by' 'holding git-cvs' +testsuccessequal 'Canceled hold on git.' aptmark unhold git +testsuccessequal 'git-cvs set on hold.' aptmark hold git-cvs +testsuccessequal 'git-cvs' aptmark showholds + +testsuccessequal "$NOUPGRADE" apt upgrade -s +testsuccessequal "$NOUPGRADE" apt full-upgrade -s +testsuccessequal "$NOUPGRADE" aptget upgrade -s +testsuccessequal "$NOUPGRADE" aptget dist-upgrade -s + +testfailureequal 'Reading package lists... +Building dependency tree... +Some packages could not be installed. This may mean that you have +requested an impossible situation or if you are using the unstable +distribution that some required packages have not yet been created +or been moved out of Incoming. +The following information may help to resolve the situation: + +The following packages have unmet dependencies: + git-cvs : Depends: git (< 1:2.25.1-.) +E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.' apt install git-ng -s + + +msgmsg 'Now mix it up by' 'holding both' +testsuccessequal 'git set on hold.' aptmark hold git +testsuccessequal 'git +git-cvs' aptmark showholds + +testsuccessequal "$NOUPGRADE" apt upgrade -s +testsuccessequal "$NOUPGRADE" apt full-upgrade -s +testsuccessequal "$NOUPGRADE" aptget upgrade -s +testsuccessequal "$NOUPGRADE" aptget dist-upgrade -s + +testfailureequal 'Reading package lists... +Building dependency tree... +Some packages could not be installed. This may mean that you have +requested an impossible situation or if you are using the unstable +distribution that some required packages have not yet been created +or been moved out of Incoming. +The following information may help to resolve the situation: + +The following packages have unmet dependencies: + git-ng : Depends: git (> 1:2.26.2) +E: Unable to correct problems, you have held broken packages.' apt install git-ng -s diff --git a/test/integration/test-dpkg-i-apt-install-fix-broken b/test/integration/test-dpkg-i-apt-install-fix-broken new file mode 100755 index 000000000..8d800ffb7 --- /dev/null +++ b/test/integration/test-dpkg-i-apt-install-fix-broken @@ -0,0 +1,34 @@ +#!/bin/sh +set -e + +TESTDIR="$(readlink -f "$(dirname "$0")")" +. "$TESTDIR/framework" +setupenvironment +configarchitecture 'amd64' + +buildsimplenativepackage 'autopkgtest-satdep' 'amd64' '1' 'stable' 'Depends: debhelper-compat (= 12)' +buildsimplenativepackage 'debhelper' 'all' '1' 'stable' 'Provides: debhelper-compat (= 12)' + +setupaptarchive + +testfailure dpkg -i incoming/autopkgtest-*.deb +testsuccessequal 'Reading package lists... +Building dependency tree... +Correcting dependencies... MarkInstall autopkgtest-satdep:amd64 < 1 @iU mK Nb Ib > FU=0 + MarkInstall debhelper:amd64 < none -> 1 @un uN > FU=0 +Starting pkgProblemResolver with broken count: 0 +Starting 2 pkgProblemResolver with broken count: 0 +Done + Done +Starting pkgProblemResolver with broken count: 0 +Starting 2 pkgProblemResolver with broken count: 0 +Done +The following additional packages will be installed: + debhelper +The following NEW packages will be installed: + debhelper +0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. +1 not fully installed or removed. +Inst debhelper (1 stable [all]) +Conf debhelper (1 stable [all]) +Conf autopkgtest-satdep (1 stable [amd64])' apt install -fso Debug::pkgProblemResolver=1 -o DEbug::pkgDepCache::Marker=1 diff --git a/test/integration/test-dpkg-protected b/test/integration/test-dpkg-protected new file mode 100755 index 000000000..3d0994d89 --- /dev/null +++ b/test/integration/test-dpkg-protected @@ -0,0 +1,20 @@ +#!/bin/sh +set -e + +TESTDIR="$(readlink -f "$(dirname "$0")")" +. "$TESTDIR/framework" +setupenvironment +configarchitecture 'amd64' + +insertinstalledpackage 'protected-package' 'native' '1' 'Protected: yes' + +setupaptarchive + + +if dpkg --assert-protected-field 2>/dev/null; then + testsuccess aptget remove protected-package "$@" -o Debug::pkgDpkgPm=1 -y --allow-remove-essential + cp rootdir/tmp/testsuccess.output rootdir/tmp/output + testsuccess grep -- '--force-remove-protected' rootdir/tmp/output +else + msgskip "dpkg does not support protected field" +fi diff --git a/test/integration/test-explore-or-groups-in-markinstall b/test/integration/test-explore-or-groups-in-markinstall index 5669e47b3..ba3376cf6 100755 --- a/test/integration/test-explore-or-groups-in-markinstall +++ b/test/integration/test-explore-or-groups-in-markinstall @@ -9,16 +9,17 @@ configarchitecture 'amd64' insertpackage 'unstable' 'okay' 'all' '1' insertpackage 'unstable' 'upgrade' 'all' '2' insertpackage 'unstable' 'unneeded' 'all' '1' +insertpackage 'unstable' 'unneeded2' 'all' '1' 'Depends: bad-level1' insertpackage 'unstable' 'later' 'all' '1' insertpackage 'unstable' 'bad-level0' 'all' '1' 'Depends: unneeded, unknown' insertpackage 'unstable' 'bad-level1' 'all' '1' 'Depends: bad-level0' insertpackage 'unstable' 'bad-upgrade-level0' 'all' '2' 'Depends: unneeded, unknown' -insertpackage 'unstable' 'bad-upgrade-level1' 'all' '2' 'Depends: bad-upgrade-level0 (>= 2)' +insertpackage 'unstable' 'bad-upgrade-level1' 'all' '2' 'Depends: bad-upgrade-level0 (>= 2), unneeded2' insertpackage 'unstable' 'bad-conflict-level0' 'all' '1' 'Depends: unneeded Conflicts: bad-conflict-level2' insertpackage 'unstable' 'bad-conflict-level1' 'all' '1' 'Depends: bad-conflict-level0' -insertpackage 'unstable' 'bad-conflict-level2' 'all' '1' 'Depends: bad-conflict-level1' +insertpackage 'unstable' 'bad-conflict-level2' 'all' '1' 'Depends: bad-conflict-level1, unneeded2' insertinstalledpackage 'upgrade' 'all' '1' insertinstalledpackage 'bad-upgrade' 'all' '1' @@ -41,16 +42,24 @@ insertfoos 'r' 'Recommends' setupaptarchive -testsuccessheadequal() { - msggroup 'testsuccessheadequal' +_testsuccessheadtailequal() { + local TYPE="$1" + shift + msggroup "testsuccess${TYPE}equal" local HEADLINES="$1" local CMP="$2" shift 2 testsuccesswithglobalerror 'testsuccess' 'EW' "$@" - cp "${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output" "${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccessheadequal.output" - testsuccessequal "$CMP" head -n "$HEADLINES" "${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccessheadequal.output" + cp "${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output" "${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess${TYPE}equal.output" + testsuccessequal "$CMP" "${TYPE}" -n "$HEADLINES" "${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess${TYPE}equal.output" msggroup } +testsuccessheadequal() { + _testsuccessheadtailequal 'head' "$@" +} +testsuccesstailequal() { + _testsuccessheadtailequal 'tail' "$@" +} checkfoos() { msgmsg 'Install checks with foos dependency type' "$2" for level in 0 1 2; do @@ -61,6 +70,7 @@ The following additional packages will be installed: The following NEW packages will be installed: foo-${1}-level${level} okay 0 upgraded, 2 newly installed, 0 to remove and 3 not upgraded." apt install foo-${1}-level${level} -s + if [ "$level" = '0' ]; then NOT=2; else NOT=1; fi testsuccessheadequal 9 "Reading package lists... Building dependency tree... The following additional packages will be installed: @@ -69,7 +79,7 @@ The following NEW packages will be installed: foo-${1}-upgrade-level${level} The following packages will be upgraded: upgrade -1 upgraded, 1 newly installed, 0 to remove and $((2-${level})) not upgraded." apt install foo-${1}-upgrade-level${level} -s +1 upgraded, 1 newly installed, 0 to remove and $NOT not upgraded." apt install foo-${1}-upgrade-level${level} -s done testsuccessheadequal 7 "Reading package lists... @@ -82,3 +92,58 @@ The following NEW packages will be installed: } checkfoos 'd' 'Depends' checkfoos 'r' 'Recommends' + +TEST_WITH_APTITUDE=false +msgtest 'Check if aptitude is available for additional tests' +if dpkg-checkbuilddeps -d 'aptitude' /dev/null >/dev/null 2>&1; then + TEST_WITH_APTITUDE=true + # we don't document aptitude config options + sed -i -e '/^#x-apt-configure-index/ d' "$(getaptconfig)" + msgpass +else + msgskip 'not installed' +fi + +if $TEST_WITH_APTITUDE; then + OKAYAPTITUDE='0 packages upgraded, 2 newly installed, 0 to remove and 3 not upgraded. +Need to get 0 B of archives. After unpacking 86.0 kB will be used. +Would download/install/remove packages.' + testsuccesstailequal 3 "$OKAYAPTITUDE" aptitude install foo-d-level2 -sy + testsuccesstailequal 3 "$OKAYAPTITUDE" aptitude install foo-r-level2 -sy + testsuccesstailequal 3 "$OKAYAPTITUDE" aptitude install foo-d-conflict -sy + testsuccesstailequal 3 "$OKAYAPTITUDE" aptitude install foo-r-conflict -sy +fi + +BADSOLVETEXT='Reading package lists... +Building dependency tree... +Some packages could not be installed. This may mean that you have +requested an impossible situation or if you are using the unstable +distribution that some required packages have not yet been created +or been moved out of Incoming. +The following information may help to resolve the situation: +' + +testfailureequal "$BADSOLVETEXT +The following packages have unmet dependencies: + bad-level0 : Depends: unknown but it is not installable + bad-upgrade-level0 : Depends: unknown but it is not installable +E: Unable to correct problems, you have held broken packages." apt install bad-upgrade-level1 -s +testfailureequal "$BADSOLVETEXT +The following packages have unmet dependencies: + bad-conflict-level0 : Conflicts: bad-conflict-level2 but 1 is to be installed + bad-level0 : Depends: unknown but it is not installable +E: Unable to correct problems, you have held broken packages." apt install bad-conflict-level2 -s + +if $TEST_WITH_APTITUDE; then + testsuccesstailequal 6 'The following packages have been kept back: + bad-upgrade-level1 +No packages will be installed, upgraded, or removed. +0 packages upgraded, 0 newly installed, 0 to remove and 3 not upgraded. +Need to get 0 B of archives. After unpacking 0 B will be used. +Would download/install/remove packages.' aptitude install bad-upgrade-level1 -sy + # aptitude does not show the kept back message in this case… + testsuccesstailequal 4 'No packages will be installed, upgraded, or removed. +0 packages upgraded, 0 newly installed, 0 to remove and 3 not upgraded. +Need to get 0 B of archives. After unpacking 0 B will be used. +Would download/install/remove packages.' aptitude install bad-conflict-level2 -sy +fi diff --git a/test/integration/test-external-dependency-solver-protocol b/test/integration/test-external-dependency-solver-protocol index 2c451d5f9..0091263b7 100755 --- a/test/integration/test-external-dependency-solver-protocol +++ b/test/integration/test-external-dependency-solver-protocol @@ -292,3 +292,28 @@ echo 'Error: instant-exit Message: This solver exits instantly' exit 1" 'E: External solver failed with: This solver exits instantly E: Sub-process exit1withmsg returned an error code (1)' + +configarchitecture 'amd64' 'i386' +for arch in 'amd64' 'i386' 'armel' 'armhf'; do + insertinstalledpackage "dummy-httpd-$arch" "$arch" '1' 'Provides: httpd' +done +buildsimplenativepackage 'dummy-webserver' 'all' '1' 'unstable' 'Provides: httpd +Multi-Arch: foreign' +testfailure apt install -s dummy-webserver +testsuccess apt install -s ./incoming/dummy-webserver_1_all.deb +testsuccess apt install -s ./incoming/dummy-webserver_1_all.deb --solver apt +testfailure apt install -s ./incoming/dummy-webserver_1_all.deb --solver dump + +testsuccess aptcache showpkg dummy-webserver --with-source ./incoming/dummy-webserver_1_all.deb +cp -a rootdir/tmp/testsuccess.output showpkg.output +testequal 'Reverse Depends: +Dependencies: +1 - +Provides: +1 - ./incoming/dummy-webserver_1_all.deb (= 1) httpd:armhf (= ) httpd:armel (= ) httpd:i386 (= ) httpd (= ) +Reverse Provides: ' tail -n 6 showpkg.output +testsuccessequal 'Provides: httpd +Provides: httpd +Provides: httpd +Provides: httpd +Provides: httpd' grep 'Provides:' "$APT_EDSP_DUMP_FILENAME" diff --git a/test/integration/test-github-111-invalid-armember b/test/integration/test-github-111-invalid-armember new file mode 100755 index 000000000..1e095eef3 --- /dev/null +++ b/test/integration/test-github-111-invalid-armember @@ -0,0 +1,88 @@ +#!/bin/sh +set -e + +TESTDIR="$(readlink -f "$(dirname "$0")")" +. "$TESTDIR/framework" +setupenvironment +configarchitecture "amd64" +setupaptarchive + +# this used to crash, but it should treat it as an invalid member header +touch ' ' +ar -q test.deb ' ' +testsuccessequal "E: Invalid archive member header" ${APTTESTHELPERSBINDIR}/testdeb test.deb + + +rm test.deb +touch 'x' +ar -q test.deb 'x' +testsuccessequal "E: This is not a valid DEB archive, missing 'debian-binary' member" ${APTTESTHELPERSBINDIR}/testdeb test.deb + + +# <name><size> [ other fields] - name is not nul terminated here, it ends in . +msgmsg "Unterminated ar member name" +printf '!<arch>\0120123456789ABCDE.A123456789A.01234.01234.0123456.012345678.0.' > test.deb +testsuccessequal "E: Invalid archive member header" ${APTTESTHELPERSBINDIR}/testdeb test.deb + + +# unused source code for generating $tar below +maketar() { + cat > maketar.c << EOF + #include <stdio.h> + #include <string.h> + struct tar { + char Name[100]; + char Mode[8]; + char UserID[8]; + char GroupID[8]; + char Size[12]; + char MTime[12]; + char Checksum[8]; + char LinkFlag; + char LinkName[100]; + char MagicNumber[8]; + char UserName[32]; + char GroupName[32]; + char Major[8]; + char Minor[8]; + }; + + int main(void) + { + union { + struct tar t; + char buf[512]; + } t; + for (int i = 0; i < sizeof(t.buf); i++) + t.buf[i] = '7'; + memcpy(t.t.Name, "unterminatedName", 16); + memcpy(t.t.UserName, "userName", 8); + memcpy(t.t.GroupName, "thisIsAGroupNamethisIsAGroupName", 32); + t.t.LinkFlag = 'X'; // I AM BROKEN + memcpy(t.t.Size, "000000000000", sizeof(t.t.Size)); + memset(t.t.Checksum,' ',sizeof(t.t.Checksum)); + + unsigned long sum = 0; + for (int i = 0; i < sizeof(t.buf); i++) + sum += t.buf[i]; + + int written = sprintf(t.t.Checksum, "%lo", sum); + for (int i = written; i < sizeof(t.t.Checksum); i++) + t.t.Checksum[i] = ' '; + fwrite(t.buf, sizeof(t.buf), 1, stdout); + } +EOF + + gcc maketar.c -o maketar -Wall + ./maketar +} + + +# +tar="unterminatedName77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777700000000000077777777777773544 X777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777userName777777777777777777777777thisIsAGroupNamethisIsAGroupName777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777" +printf '%s' "$tar" | gzip > control.tar.gz +cp control.tar.gz data.tar.gz +touch debian-binary +rm test.deb +ar -q test.deb debian-binary control.tar.gz data.tar.gz +testsuccessequal "W: Unknown TAR header type 88" ${APTTESTHELPERSBINDIR}/testdeb test.deb diff --git a/test/integration/test-multiarch-allowed b/test/integration/test-multiarch-allowed index b74853993..a091635f0 100755 --- a/test/integration/test-multiarch-allowed +++ b/test/integration/test-multiarch-allowed @@ -66,13 +66,12 @@ testfailureequal "$BADPREFIX The following packages have unmet dependencies: foo : Conflicts: foo:i386 but 1 is to be installed foo:i386 : Conflicts: foo but 1 is to be installed -E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages." aptget install needsfoo:i386 foo:amd64 -s +E: Unable to correct problems, you have held broken packages." aptget install needsfoo:i386 foo:amd64 -s testfailureequal "$BADPREFIX The following packages have unmet dependencies: foo : Conflicts: foo:i386 but 1 is to be installed foo:i386 : Conflicts: foo but 1 is to be installed -E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages." aptget install needsfoo foo:i386 -s -exit +E: Unable to correct problems, you have held broken packages." aptget install needsfoo foo:i386 -s solveableinsinglearch1() { testsuccessequal "Reading package lists... diff --git a/test/integration/test-no-fds-leaked-to-maintainer-scripts b/test/integration/test-no-fds-leaked-to-maintainer-scripts index 85b3d0ee1..4606408fc 100755 --- a/test/integration/test-no-fds-leaked-to-maintainer-scripts +++ b/test/integration/test-no-fds-leaked-to-maintainer-scripts @@ -40,7 +40,7 @@ testsuccess aptget install -y fdleaks -qq < /dev/null checkfdleak() { msgtest 'Check if fds were not' "leaked: expect $1" - if [ "$(grep 'root root' rootdir/tmp/testsuccess.output | wc -l)" = "$1" ]; then + if [ "$(grep -e 'root root' -e "$(id -un) $(id -gn)" rootdir/tmp/testsuccess.output | wc -l)" = "$1" ]; then msgpass else echo diff --git a/test/integration/test-resolver-delays-remove-decisions b/test/integration/test-resolver-delays-remove-decisions new file mode 100755 index 000000000..d8dfd7c9a --- /dev/null +++ b/test/integration/test-resolver-delays-remove-decisions @@ -0,0 +1,107 @@ +#!/bin/sh +set -e + +TESTDIR="$(readlink -f "$(dirname "$0")")" +. "$TESTDIR/framework" +setupenvironment +configarchitecture 'amd64' 'i386' + +insertinstalledpackage 'stuff' 'all' '1' + +insertpackage 'unstable' 'foobar' 'all' '1' 'Depends: foo | bar' +insertpackage 'unstable' 'foo' 'all' '1' 'Conflicts: stuff +Depends: foo-dep' +insertpackage 'unstable' 'foo-dep' 'all' '1' 'Depends: uninstallable' + +insertpackage 'unstable' 'bar' 'all' '1' + +setupaptarchive + +# We are needlessly removing "stuff" if we don't delay its marking here +# as we do not question the remove later on +testsuccessequal "Reading package lists... +Building dependency tree... + MarkInstall foobar:amd64 < none -> 1 @un puN Ib > FU=1 + Installing foo:amd64 as Depends of foobar:amd64 + Delayed Removing: stuff:amd64 as upgrade is not an option for foo:amd64 (1) + MarkInstall foo:amd64 < none -> 1 @un uN Ib > FU=0 + Installing foo-dep:amd64 as Depends of foo:amd64 + foo-dep:amd64 Depends on uninstallable:amd64 < none @un H > can't be satisfied! + foo:amd64 Depends on foo-dep:amd64 < none @un H > can't be satisfied! (dep) + Installing bar:amd64 as Depends of foobar:amd64 + MarkInstall bar:amd64 < none -> 1 @un uN > FU=0 +Starting pkgProblemResolver with broken count: 0 +Starting 2 pkgProblemResolver with broken count: 0 +Done +The following additional packages will be installed: + bar +The following NEW packages will be installed: + bar foobar +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst bar (1 unstable [all]) +Inst foobar (1 unstable [all]) +Conf bar (1 unstable [all]) +Conf foobar (1 unstable [all])" apt install foobar -s -o Debug::pkgProblemResolver=1 -o Debug::pkgDepCache::Marker=1 -o Debug::pkgDepCache::AutoInstall=1 + +insertinstalledpackage 'uninstallable' 'all' '1' + +testsuccessequal "Reading package lists... +Building dependency tree... + MarkInstall foobar:amd64 < none -> 1 @un puN Ib > FU=1 + Installing foo:amd64 as Depends of foobar:amd64 + Delayed Removing: stuff:amd64 as upgrade is not an option for foo:amd64 (1) + MarkInstall foo:amd64 < none -> 1 @un uN Ib > FU=0 + Installing foo-dep:amd64 as Depends of foo:amd64 + MarkInstall foo-dep:amd64 < none -> 1 @un uN > FU=0 + MarkDelete stuff:amd64 < 1 @ii mK > FU=0 +Starting pkgProblemResolver with broken count: 0 +Starting 2 pkgProblemResolver with broken count: 0 +Done +The following additional packages will be installed: + foo foo-dep +The following packages will be REMOVED: + stuff +The following NEW packages will be installed: + foo foo-dep foobar + MarkDelete stuff:amd64 < 1 @ii K > FU=1 +0 upgraded, 3 newly installed, 1 to remove and 0 not upgraded. +Remv stuff [1] +Inst foo-dep (1 unstable [all]) +Inst foo (1 unstable [all]) +Inst foobar (1 unstable [all]) +Conf foo-dep (1 unstable [all]) +Conf foo (1 unstable [all]) +Conf foobar (1 unstable [all])" apt install foobar -s -o Debug::pkgProblemResolver=1 -o Debug::pkgDepCache::Marker=1 -o Debug::pkgDepCache::AutoInstall=1 + +# Same solution but the installs are considered protected now as there is no other solution +testsuccessequal "Reading package lists... +Building dependency tree... + MarkInstall foobar:amd64 < none -> 1 @un puN Ib > FU=1 + Installing foo:amd64 as Depends of foobar:amd64 + Removing: stuff:amd64 as upgrade is not an option for foo:amd64 (1) + MarkDelete stuff:amd64 < 1 @ii mK > FU=0 + MarkInstall foo:amd64 < none -> 1 @un puN Ib > FU=0 + Installing foo-dep:amd64 as Depends of foo:amd64 + MarkInstall foo-dep:amd64 < none -> 1 @un puN > FU=0 + MarkInstall uninstallable:amd64 < 1 @ii pmK > FU=0 +Starting pkgProblemResolver with broken count: 0 +Starting 2 pkgProblemResolver with broken count: 0 +Done + Ignore MarkGarbage of foo:amd64 < none -> 1 @un puN > as its mode (Install) is protected + Ignore MarkGarbage of foo:amd64 < none -> 1 @un puN > as its mode (Install) is protected +Package 'bar' is not installed, so not removed +The following additional packages will be installed: + foo foo-dep +The following packages will be REMOVED: + stuff +The following NEW packages will be installed: + foo foo-dep foobar + MarkDelete stuff:amd64 < 1 | none @ii H > FU=1 +0 upgraded, 3 newly installed, 1 to remove and 0 not upgraded. +Remv stuff [1] +Inst foo-dep (1 unstable [all]) +Inst foo (1 unstable [all]) +Inst foobar (1 unstable [all]) +Conf foo-dep (1 unstable [all]) +Conf foo (1 unstable [all]) +Conf foobar (1 unstable [all])" apt install foobar bar- -q=0 -s -o Debug::pkgProblemResolver=1 -o Debug::pkgDepCache::Marker=1 -o Debug::pkgDepCache::AutoInstall=1 diff --git a/test/integration/test-resolver-provider-exchange b/test/integration/test-resolver-provider-exchange new file mode 100755 index 000000000..3f5310fa6 --- /dev/null +++ b/test/integration/test-resolver-provider-exchange @@ -0,0 +1,107 @@ +#!/bin/sh +set -e + +TESTDIR="$(readlink -f "$(dirname "$0")")" +. "$TESTDIR/framework" +setupenvironment +configarchitecture 'amd64' + +insertinstalledpackage 'fuse' 'all' '2' +insertpackage 'unstable' 'fuse3' 'all' '3' 'Conflicts: fuse +Provides: fuse' + +insertpackage 'unstable' 'foobar-d' 'all' '1' 'Depends: fuse' +insertpackage 'unstable' 'foobar-d2' 'all' '1' 'Depends: fuse +Conflicts: fuse3' +insertpackage 'unstable' 'foobar-d3' 'all' '1' 'Depends: fuse3' +insertpackage 'unstable' 'foobar-r' 'all' '1' 'Recommends: fuse' +insertpackage 'unstable' 'foobar-r2' 'all' '1' 'Recommends: fuse +Conflicts: fuse3' +insertpackage 'unstable' 'foobar-r3' 'all' '1' 'Recommends: fuse3' + +setupaptarchive + +installfoobars() { + testsuccessequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + foobar-d +0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. +Inst foobar-d (1 unstable [all]) +Conf foobar-d (1 unstable [all])' apt install -s foobar-d + testsuccessequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + foobar-d2 +0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. +Inst foobar-d2 (1 unstable [all]) +Conf foobar-d2 (1 unstable [all])' apt install -s foobar-d2 + testsuccessequal "Reading package lists... +Building dependency tree... +The following additional packages will be installed: + fuse3 +The following packages will be REMOVED: + fuse +The following NEW packages will be installed: + foobar-d3 fuse3 +0 upgraded, 2 newly installed, 1 to remove and 0 not upgraded. +Remv fuse [2]$1 +Inst fuse3 (3 unstable [all]) +Inst foobar-d3 (1 unstable [all]) +Conf fuse3 (3 unstable [all]) +Conf foobar-d3 (1 unstable [all])" apt install -s foobar-d3 + + testsuccessequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + foobar-r +0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. +Inst foobar-r (1 unstable [all]) +Conf foobar-r (1 unstable [all])' apt install -s foobar-r + testsuccessequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + foobar-r2 +0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. +Inst foobar-r2 (1 unstable [all]) +Conf foobar-r2 (1 unstable [all])' apt install -s foobar-r2 + if [ -z "$1" ]; then + testsuccessequal "Reading package lists... +Building dependency tree... +The following additional packages will be installed: + fuse3 +The following packages will be REMOVED: + fuse +The following NEW packages will be installed: + foobar-r3 fuse3 +0 upgraded, 2 newly installed, 1 to remove and 0 not upgraded. +Remv fuse [2]$1 +Inst foobar-r3 (1 unstable [all]) +Inst fuse3 (3 unstable [all]) +Conf foobar-r3 (1 unstable [all]) +Conf fuse3 (3 unstable [all])" apt install -s foobar-r3 + else + testsuccessequal "Reading package lists... +Building dependency tree... +The following additional packages will be installed: + fuse3 +The following packages will be REMOVED: + fuse +The following NEW packages will be installed: + foobar-r3 fuse3 +0 upgraded, 2 newly installed, 1 to remove and 0 not upgraded. +Remv fuse [2]$1 +Inst fuse3 (3 unstable [all]) +Inst foobar-r3 (1 unstable [all]) +Conf fuse3 (3 unstable [all]) +Conf foobar-r3 (1 unstable [all])" apt install -s foobar-r3 + fi +} +msgmsg 'fuse has no installed dependers' +installfoobars + +for i in $(seq 0 10); do + insertinstalledpackage "stuff$i" 'all' '1' 'Depends: fuse' +done +msgmsg 'fuse has many dependers installed' +installfoobars ' [stuff10:amd64 stuff0:amd64 stuff1:amd64 stuff2:amd64 stuff3:amd64 stuff4:amd64 stuff5:amd64 stuff6:amd64 stuff7:amd64 stuff8:amd64 stuff9:amd64 ]' |