tags 548691 patch
thanks

I've just come across this. The problem is that the narrow_chroot_path
macro that applies the chroot to a particular path uses a substring
match and so misses the path if it contains extra "/./" type components.
Patch below. It seems to work. I haven't touched the test suite.

Robie.


diff --git a/src/libfakechroot.c b/src/libfakechroot.c
index e92ff1d..b319100 100644
--- a/src/libfakechroot.c
+++ b/src/libfakechroot.c
@@ -1212,6 +1212,18 @@ int chroot (const char *path)
         }
     }
 
+    ptr = tmp = dir;
+    for(ptr=tmp=dir; *ptr; ptr++) {
+       if (*ptr == '/' &&
+               *(ptr+1) && *(ptr+1) == '.' &&
+               (!*(ptr+2) || (*(ptr+2) == '/'))) {
+           ptr++;
+       } else {
+           *(tmp++) = *ptr;
+       }
+    }
+    *tmp = 0;
+
 #if defined(HAVE_SETENV)
     setenv("FAKECHROOT_BASE", dir, 1);
 #else



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to