* apt-pkg/deb/dpkgpm.cc:
authorDavid Kalnischkies <kalnischkies@gmail.com>
Wed, 14 Apr 2010 16:01:11 +0000 (18:01 +0200)
committerDavid Kalnischkies <kalnischkies@gmail.com>
Wed, 14 Apr 2010 16:01:11 +0000 (18:01 +0200)
  - remove Chroot-Directory from files passed to install commands.
    Thanks to Kel Modderman for report & patch! (Closes: #577226)

apt-pkg/deb/dpkgpm.cc
debian/changelog

index 14a4968..ca8faa8 100644 (file)
@@ -124,7 +124,19 @@ bool pkgDPkgPM::Install(PkgIterator Pkg,string File)
    if (File.empty() == true || Pkg.end() == true)
       return _error->Error("Internal Error, No file name for %s",Pkg.Name());
 
-   List.push_back(Item(Item::Install,Pkg,File));
+   // If the filename string begins with DPkg::Chroot-Directory, return the
+   // substr that is within the chroot so dpkg can access it.
+   string const chrootdir = _config->FindDir("DPkg::Chroot-Directory","/");
+   if (chrootdir != "/" && File.find(chrootdir) == 0)
+   {
+      size_t len = chrootdir.length();
+      if (chrootdir.at(len - 1) == '/')
+        len--;
+      List.push_back(Item(Item::Install,Pkg,File.substr(len)));
+   }
+   else
+      List.push_back(Item(Item::Install,Pkg,File));
+
    return true;
 }
                                                                        /*}}}*/
index 6cf0679..7d2417c 100644 (file)
@@ -18,6 +18,9 @@ apt (0.7.26~exp4) experimental; urgency=low
     - display MD5Sum in --print-uris if not forced to use another method
       instead of displaying the strongest available (Closes: #576420)
     - regex for package names executed on Grp- not PkgIterator
+  * apt-pkg/deb/dpkgpm.cc:
+    - remove Chroot-Directory from files passed to install commands.
+      Thanks to Kel Modderman for report & patch! (Closes: #577226)
 
  -- David Kalnischkies <kalnischkies@gmail.com>  Sat, 03 Apr 2010 14:58:39 +0200