Package: fakechroot
Version: 2.19-3
Severity: wishlist
Tags: patch
Dear Maintainer,
As stated in the man page :
"It is important to start fake environment in proper
order. fakeroot should be started inside fakechroot"
Indeed, we get an error if not :
$ fakeroot fakechroot chroot mychroot
# mknod /tmp/nullbis c 1 3
mknod: /tmp/nullbis: No such file or directory
However, it may be convenient to use the other order in some circumstances
(e.g., in debirf) : one may swap libfakeroot and libfakechroot in
LD_PRELOAD if needed.
With the patch below :
$ fakeroot fakechroot chroot mychroot
# mknod nullbis c 1 3
# echo $?
0
# ls -AlF nullbis
crw--- 1 root root 1, 3 Feb 15 17:01 nullbis
Regards,
JH Chatenet
--- /usr/bin/fakechroot.orig
+++ /usr/bin/fakechroot
@@ -155,10 +155,30 @@
fi
fi
+# Swap libfakechroot and libfakeroot in LD_PRELOAD if needed
+# libfakeroot must come first
+# an alternate fakeroot library may be given
+# in the FAKEROOT_ALT_LIB environment variable
+if [ -n "$FAKEROOT_ALT_LIB" ]; then
+lib_libfakeroot="$FAKEROOT_ALT_LIB"
+else
+lib_libfakeroot="libfakeroot-sysv.so"
+fi
+
+for preload in $(echo "$LD_PRELOAD" | tr ':' ' '); do
+case "$preload" in
+"$lib_libfakeroot")
+lib_libfakeroot_to_preload="$preload"
+;;
+*)
+lib_to_preload="${lib_to_preload:+${lib_to_preload} }$preload"
+;;
+esac
+done
# Make sure the preload is available
fakechroot_paths="$fakechroot_paths${LD_LIBRARY_PATH:+${fakechroot_paths:+:}$LD_LIBRARY_PATH}"
-fakechroot_lib="$fakechroot_lib${LD_PRELOAD:+ $LD_PRELOAD}"
+fakechroot_lib="${lib_libfakeroot_to_preload:+${lib_libfakeroot_to_preload}
}$fakechroot_lib${lib_to_preload:+ $lib_to_preload}"
fakechroot_detect=`LD_LIBRARY_PATH="$fakechroot_paths"
LD_PRELOAD="$fakechroot_lib" FAKECHROOT_DETECT=1 /bin/echo 2>&1`
case "$fakechroot_detect" in
-- System Information:
Debian Release: 9.0
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Kernel: Linux 3.16.0-4-amd64 (SMP w/2 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/dash
Init: unable to detect
Versions of packages fakechroot depends on:
ii libfakechroot 2.19-3
fakechroot recommends no packages.
fakechroot suggests no packages.
-- no debconf information