Explorar el Código

ensure that dpkg binary doesn't have the chroot-directory prefixed

David Kalnischkies hace 14 años
padre
commit
734a672769
Se han modificado 2 ficheros con 13 adiciones y 2 borrados
  1. 11 1
      apt-pkg/deb/dpkgpm.cc
  2. 2 1
      debian/changelog

+ 11 - 1
apt-pkg/deb/dpkgpm.cc

@@ -836,7 +836,17 @@ bool pkgDPkgPM::Go(int OutStatusFd)
    // Generate the base argument list for dpkg
    // Generate the base argument list for dpkg
    std::vector<const char *> Args;
    std::vector<const char *> Args;
    unsigned long StartSize = 0;
    unsigned long StartSize = 0;
-   string const Tmp = _config->Find("Dir::Bin::dpkg","dpkg");
+   string Tmp = _config->Find("Dir::Bin::dpkg","dpkg");
+   {
+      string const dpkgChrootDir = _config->FindDir("DPkg::Chroot-Directory", "/");
+      size_t dpkgChrootLen = dpkgChrootDir.length();
+      if (dpkgChrootDir != "/" && Tmp.find(dpkgChrootDir) == 0)
+      {
+	 if (dpkgChrootDir[dpkgChrootLen - 1] == '/')
+	    --dpkgChrootLen;
+	 Tmp = Tmp.substr(dpkgChrootLen);
+      }
+   }
    Args.push_back(Tmp.c_str());
    Args.push_back(Tmp.c_str());
    StartSize += Tmp.length();
    StartSize += Tmp.length();
 
 

+ 2 - 1
debian/changelog

@@ -3,8 +3,9 @@ apt (0.8.16~exp12+nmu1) experimental; urgency=low
   [ David Kalnischkies ]
   [ David Kalnischkies ]
   * apt-pkg/deb/dpkgpm.cc:
   * apt-pkg/deb/dpkgpm.cc:
     - chroot if needed before dpkg --assert-multi-arch
     - chroot if needed before dpkg --assert-multi-arch
+    - ensure that dpkg binary doesn't have the chroot-directory prefixed
 
 
- -- David Kalnischkies <kalnischkies@gmail.com>  Sun, 29 Jan 2012 12:58:24 +0100
+ -- David Kalnischkies <kalnischkies@gmail.com>  Sun, 29 Jan 2012 13:08:58 +0100
 
 
 apt (0.8.16~exp12) experimental; urgency=low
 apt (0.8.16~exp12) experimental; urgency=low