As far as I understand, /usr/bin/fakechroot sources the chroot.env 
script to setup the substitution of /usr/sbin/chroot.fakechroot for
/usr/sbin/chroot. 

At /usr/sbin/chroot invocation (through execve), 
/usr/sbin/chroot.fakechroot runs instead and parses /etc/ld.so.conf* 
in the target (fake)chroot to populate LD_LIBRARY_PATH. The 
multiarch paths are added this way. 
Eventually /usr/sbin/chroot is run, and the function chroot of 
libfakechroot adds the paths /usr/lib and /lib under the target (fake)chroot.

The syntax "fakeroot fakechroot chroot ..." fails to setup the substitution 
of /usr/sbin/chroot.fakechroot for /usr/sbin/chroot : the bottom line of 
/usr/bin/fakechroot

env LD_LIBRARY_PATH="$paths" LD_PRELOAD="$lib" "$@"

adds LD_PRELOAD to the environment of the command (ie chroot), not of env. 
Instead of the function "execve" from libfakechroot the one of libc6 is 
executed by env - hence the substitution doesn't take place.

The syntax "fakeroot fakechroot env chroot ..." fails to select automatically 
the environment script chroot.env.

And the syntax "fakeroot fakechroot -e chroot env chroot ..." works...

As an alternative, we could patch /usr/bin/fakechroot to obtain the same
result (see the following patch as an illustration). We then get the same 
value of LD_LIBRARY_PATH whatever the relative order of fakeroot and 
fakechroot :

me@here:~$ fakeroot fakechroot chroot /home/me/my_wheezy_chroot
# echo $LD_LIBRARY_PATH
/home/me/my_wheezy_chroot/usr/lib/i386-linux-gnu/libfakeroot:
/home/me/my_wheezy_chroot/usr/lib64/libfakeroot:
/home/me/my_wheezy_chroot/usr/lib32/libfakeroot:
/home/me/my_wheezy_chroot/lib/i386-linux-gnu:
/home/me/my_wheezy_chroot/usr/lib/i386-linux-gnu:
/home/me/my_wheezy_chroot/lib/i486-linux-gnu:
/home/me/my_wheezy_chroot/usr/lib/i486-linux-gnu:
/home/me/my_wheezy_chroot/usr/local/lib:
/usr/lib/i386-linux-gnu/libfakeroot:
/usr/lib64/libfakeroot:/usr/lib32/libfakeroot:
/home/me/my_wheezy_chroot/usr/lib:
/home/me/my_wheezy_chroot/lib

(breaking a long line at ":" )

me@here:~$ fakechroot fakeroot chroot /home/me/my_wheezy_chroot
# echo $LD_LIBRARY_PATH
/home/me/my_wheezy_chroot/usr/lib/i386-linux-gnu/libfakeroot:
/home/me/my_wheezy_chroot/usr/lib64/libfakeroot:
/home/me/my_wheezy_chroot/usr/lib32/libfakeroot:
/home/me/my_wheezy_chroot/lib/i386-linux-gnu:
/home/me/my_wheezy_chroot/usr/lib/i386-linux-gnu:
/home/me/my_wheezy_chroot/lib/i486-linux-gnu:
/home/me/my_wheezy_chroot/usr/lib/i486-linux-gnu:
/home/me/my_wheezy_chroot/usr/local/lib:
/usr/lib/i386-linux-gnu/libfakeroot:
/usr/lib64/libfakeroot:/usr/lib32/libfakeroot:
/home/me/my_wheezy_chroot/usr/lib:
/home/me/my_wheezy_chroot/lib


Regards,
JH Chatenet

--- a/scripts/fakechroot.sh     2011-12-11 13:05:34.000000000 +0100
+++ b/scripts/fakechroot.sh     2013-08-24 14:27:27.000000000 +0200
@@ -136,10 +136,10 @@
 
 # Execute command
 if [ -z "$*" ]; then
-    env LD_LIBRARY_PATH="$paths" LD_PRELOAD="$lib" ${SHELL:-/bin/sh}
+    LD_LIBRARY_PATH="$paths" LD_PRELOAD="$lib" env ${SHELL:-/bin/sh}
     result=$?
 else
-    env LD_LIBRARY_PATH="$paths" LD_PRELOAD="$lib" "$@"
+    LD_LIBRARY_PATH="$paths" LD_PRELOAD="$lib" env "$@"
     result=$?
 fi
 


-- 
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