summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apt-pkg/acquire.cc10
-rw-r--r--debian/tests/control3
-rw-r--r--test/integration/framework21
-rwxr-xr-xtest/integration/test-apt-update-simple4
4 files changed, 33 insertions, 5 deletions
diff --git a/apt-pkg/acquire.cc b/apt-pkg/acquire.cc
index 6cf8b4c83..776c82b3b 100644
--- a/apt-pkg/acquire.cc
+++ b/apt-pkg/acquire.cc
@@ -307,7 +307,7 @@ static bool CheckForBadItemAndFailIt(pkgAcquire::Item * const Item,
void pkgAcquire::Enqueue(ItemDesc &Item)
{
// Determine which queue to put the item in
- const MethodConfig *Config;
+ const MethodConfig *Config = nullptr;
string Name = QueueName(Item.URI,Config);
if (Name.empty() == true)
{
@@ -387,14 +387,16 @@ string pkgAcquire::QueueName(string Uri,MethodConfig const *&Config)
{
constexpr int DEFAULT_HOST_LIMIT = 10;
URI U(Uri);
- // Access mode forces all methods to be Single-Instance
- if (QueueMode == QueueAccess)
- return U.Access;
+ // Note that this gets written through the reference to the caller.
Config = GetConfig(U.Access);
if (Config == nullptr)
return {};
+ // Access mode forces all methods to be Single-Instance
+ if (QueueMode == QueueAccess)
+ return U.Access;
+
// Single-Instance methods get exactly one queue per URI
if (Config->SingleInstance == true)
return U.Access;
diff --git a/debian/tests/control b/debian/tests/control
index a12ae6f99..c6cc75648 100644
--- a/debian/tests/control
+++ b/debian/tests/control
@@ -6,4 +6,5 @@ Depends: @, @builddeps@, dpkg, fakeroot, wget, stunnel4, lsof, db-util,
gpgv (>= 2) | gpgv2,
gpgv1 | gpgv (<< 2),
libfile-fcntllock-perl, python3-apt, aptitude,
- pkg-config
+ pkg-config,
+ valgrind
diff --git a/test/integration/framework b/test/integration/framework
index e7b82c273..44dedb10b 100644
--- a/test/integration/framework
+++ b/test/integration/framework
@@ -229,6 +229,27 @@ gdb() {
fi
runapt command gdb --quiet -ex "directory '$SOURCEDIRECTORY'" -ex run "$CMD" --args "$CMD" "$@"
}
+
+valgrind() {
+ local CMD
+ case "$1" in
+ aptget) CMD="apt-get";;
+ aptcache) CMD="apt-cache";;
+ aptcdrom) CMD="apt-cdrom";;
+ aptconfig) CMD="apt-config";;
+ aptmark) CMD="apt-mark";;
+ apthelper) CMD="apt-helper";;
+ aptftparchive) CMD="apt-ftparchive";;
+ dpkg) shift; runapt "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/gdb-dpkg" "$@"; return;;
+ *) CMD="$1";;
+ esac
+ shift
+ if [ "${CMD##*/}" = "$CMD" ]; then
+ CMD="${BUILDDIRECTORY}/${CMD}"
+ fi
+ runapt command valgrind "$CMD" "$@"
+}
+
lastmodification() {
date -u -d "@$(stat -c '%Y' "${TMPWORKINGDIRECTORY}/$1")" -R
}
diff --git a/test/integration/test-apt-update-simple b/test/integration/test-apt-update-simple
index ccf719790..6855f1d1f 100755
--- a/test/integration/test-apt-update-simple
+++ b/test/integration/test-apt-update-simple
@@ -31,3 +31,7 @@ main/binary-amd64/Packages
main/binary-all/Packages
main/i18n/Translation-en
main/i18n/Translation-de' aptget indextargets --format '$(METAKEY)'
+
+# Check that -o Acquire::Queue-Mode=access does not crash
+find rootdir/var/lib/apt/lists/ -type f -delete
+testsuccess valgrind aptget update -o Acquire::Queue-Mode=access