The following commit has been merged in the master branch:
commit 4d74ed7589590400002081ccae55bbe9e6da3394
Author: Colin Watson <[email protected]>
Date:   Tue Dec 30 16:45:44 2008 +0100

    dpkg: Change dir to / after chroot when using --instdir
    
    Closes: #509578

diff --git a/ChangeLog b/ChangeLog
index 53c64df..b3d2902 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2008-12-30  Colin Watson  <[email protected]>
+
+       * src/help.c (preexecscript): Call chdir after chroot.
+
 2008-12-23  Guillem Jover  <[email protected]>
 
        * lib/log.c (statusfd_send): Pass to write the remaining data, not
diff --git a/debian/changelog b/debian/changelog
index ceb429b..e79a9c3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -39,6 +39,8 @@ dpkg (1.15.0) UNRELEASED; urgency=low
   * Use a the warning function to uniformly print all warning messages.
   * Properly use internerr to report about programming bugs.
   * Do not log repeated strings when the write call wrote partial data.
+  * Change dir to / after chroot when using --instdir.
+    Thanks to Colin Watson <[email protected]>. Closes: #509578
 
   [ Raphael Hertzog ]
   * Enhance dpkg-shlibdeps's error message when a library can't be found to
diff --git a/src/help.c b/src/help.c
index d7d0ae9..5d62b43 100644
--- a/src/help.c
+++ b/src/help.c
@@ -155,6 +155,8 @@ static const char* preexecscript(const char *path, char 
*const *argv) {
 
   if (*instdir) {
     if (chroot(instdir)) ohshite(_("failed to chroot to `%.250s'"),instdir);
+    if (chdir("/"))
+      ohshite(_("failed to chdir to `%.255s'"), "/");
   }
   if (f_debug & dbg_scripts) {
     struct varbuf args = VARBUF_INIT;

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to