From e250a8d8d8ef2f8f8c5e2041f7645c49fba7aa36 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 4 Aug 2017 12:51:34 +0200 Subject: don't hang if multiple sources use unavailable method MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit APT clients always noticed if a method isn't supported and nowadays generate a message of the form: E: The method driver …/foobar could not be found. N: Is the package apt-transport-foobar installed? This only worked if a single source was using such an unavailable method through as we were registering the failed config the first round and the second would try to send requests to the not started method, which wouldn't work and hang instead (+ hiding the error messages as they would be shown only at the end of the execution). Closes: 870675 --- apt-pkg/acquire.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/acquire.cc b/apt-pkg/acquire.cc index 9272c2402..c26e4e07c 100644 --- a/apt-pkg/acquire.cc +++ b/apt-pkg/acquire.cc @@ -459,13 +459,16 @@ pkgAcquire::MethodConfig *pkgAcquire::GetConfig(string Access) // Create the new config class Conf = new MethodConfig; Conf->Access = Access; - Conf->Next = Configs; - Configs = Conf; // Create the worker to fetch the configuration Worker Work(Conf); if (Work.Start() == false) - return 0; + { + delete Conf; + return nullptr; + } + Conf->Next = Configs; + Configs = Conf; /* if a method uses DownloadLimit, we switch to SingleInstance mode */ if(_config->FindI("Acquire::"+Access+"::Dl-Limit",0) > 0) -- cgit v1.2.3