diff options
author | Steve Langasek <steve.langasek@linaro.org> | 2011-03-07 22:57:52 +0100 |
---|---|---|
committer | David Kalnischkies <kalnischkies@gmail.com> | 2011-03-07 22:57:52 +0100 |
commit | 8e11253db6070bede2ecba01dbd3fde6019c8260 (patch) | |
tree | ce27a6491daff3920821df77d66850116021539d | |
parent | 9e141dbd05e0304eada7e1eaf9a224018fa18132 (diff) | |
download | apt-8e11253db6070bede2ecba01dbd3fde6019c8260.tar.gz |
* apt-pkg/deb/dpkgpm.cc:
- make sure that for multiarch packages, we are passing the full
qualified package name to dpkg for removals. (Closes: #614298)
-rw-r--r-- | apt-pkg/deb/dpkgpm.cc | 21 | ||||
-rw-r--r-- | debian/changelog | 7 |
2 files changed, 25 insertions, 3 deletions
diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 7d0d34a4..84443447 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -881,7 +881,10 @@ bool pkgDPkgPM::Go(int OutStatusFd) // Generate the argument list const char *Args[MaxArgs + 50]; - + // keep track of allocated strings for multiarch package names + char *Packages[MaxArgs + 50]; + unsigned int pkgcount = 0; + // Now check if we are within the MaxArgs limit // // this code below is problematic, because it may happen that @@ -989,13 +992,22 @@ bool pkgDPkgPM::Go(int OutStatusFd) } else { + string const nativeArch = _config->Find("APT::Architecture"); for (;I != J && Size < MaxArgBytes; I++) { if((*I).Pkg.end() == true) continue; if (I->Op == Item::Configure && disappearedPkgs.find(I->Pkg.Name()) != disappearedPkgs.end()) continue; - Args[n++] = I->Pkg.Name(); + if (I->Pkg.Arch() == nativeArch || !strcmp(I->Pkg.Arch(), "all")) + Args[n++] = I->Pkg.Name(); + else + { + string const PkgDesc = I->Pkg.Name() + string(":") + string(I->Pkg.Arch()); + Packages[pkgcount] = new char[PkgDesc.size()+1]; + strncpy(Packages[pkgcount++],PkgDesc.c_str(),PkgDesc.size()+1); + Args[n++] = Packages[pkgcount-1]; + } Size += strlen(Args[n-1]); } } @@ -1145,6 +1157,11 @@ bool pkgDPkgPM::Go(int OutStatusFd) sigemptyset(&sigmask); sigprocmask(SIG_BLOCK,&sigmask,&original_sigmask); + /* clean up the temporary allocation for multiarch package names in + the parent, so we don't leak memory when we return. */ + for (unsigned int i = 0; i < pkgcount; i++) + delete [] Packages[i]; + // the result of the waitpid call int res; int select_ret; diff --git a/debian/changelog b/debian/changelog index 971e967a..bcafbd71 100644 --- a/debian/changelog +++ b/debian/changelog @@ -28,7 +28,12 @@ apt (0.8.11.6) UNRELEASED; urgency=low * cmdline/apt-get.cc: - reinstall dependencies of reinstalled "garbage" (Closes: #617257) - -- David Kalnischkies <kalnischkies@gmail.com> Mon, 07 Mar 2011 22:43:15 +0100 + [ Steve Langasek ] + * apt-pkg/deb/dpkgpm.cc: + - make sure that for multiarch packages, we are passing the full + qualified package name to dpkg for removals. (Closes: #614298) + + -- David Kalnischkies <kalnischkies@gmail.com> Mon, 07 Mar 2011 22:46:24 +0100 apt (0.8.11.5) unstable; urgency=low |