From c92ece1a7309d762bcf424f4ab0f1427d520d207 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 8 Jun 2016 22:40:53 +0200 Subject: drop Dpkg::MaxArgs in favor of Dpkg::MaxArgsBytes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We had an old FIXME saying that it is probably pointless to do this if we limit by length of the commandline already and I completely agree. The splitting is bad enough if it must be done, so we should only do it if we have to (as in absolute length of commandline) and, but that is just a remark, it is unlikely that we ever have/had a call triggering this as the default value was ~32000 items… --- apt-pkg/deb/dpkgpm.cc | 32 +++++--------------------------- 1 file changed, 5 insertions(+), 27 deletions(-) (limited to 'apt-pkg/deb/dpkgpm.cc') diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 4591049a9..f8855526c 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -1231,9 +1231,6 @@ bool pkgDPkgPM::Go(APT::Progress::PackageManager *progress) fd_set rfds; struct timespec tv; - // FIXME: do we really need this limit when we have MaxArgBytes? - unsigned int const MaxArgs = _config->FindI("Dpkg::MaxArgs",32*1024); - // try to figure out the max environment size int OSArgMax = sysconf(_SC_ARG_MAX); if(OSArgMax < 0) @@ -1305,33 +1302,14 @@ bool pkgDPkgPM::Go(APT::Progress::PackageManager *progress) for (; J != List.end() && J->Op == I->Op; ++J) /* nothing */; - // keep track of allocated strings for multiarch package names - std::vector Packages; + auto const size = (J - I) + 10; // start with the baseset of arguments - unsigned long Size = StartSize; + auto Size = StartSize; Args.erase(Args.begin() + BaseArgs, Args.end()); - - // Now check if we are within the MaxArgs limit - // - // this code below is problematic, because it may happen that - // the argument list is split in a way that A depends on B - // and they are in the same "--configure A B" run - // - with the split they may now be configured in different - // runs, using Immediate-Configure-All can help prevent this. - if (J - I > (signed)MaxArgs) - { - J = I + MaxArgs; - unsigned long const size = MaxArgs + 10; - Args.reserve(size); - Packages.reserve(size); - } - else - { - unsigned long const size = (J - I) + 10; - Args.reserve(size); - Packages.reserve(size); - } + Args.reserve(size); + // keep track of allocated strings for multiarch package names + std::vector Packages(size, nullptr); int fd[2]; if (pipe(fd) != 0) -- cgit v1.2.3