Package: fakechroot
Version: 2.19-3
Severity: normal
Tags: patch
Dear Maintainer,
I get the following error chrooting twice (and the second time into the root of
the (fake)chroot ) :
$ fakechroot fakeroot -s .fakeroot.state -i .fakeroot.state chroot mychroot
# pwd
/
# chroot .
/usr/sbin/chroot: cannot change root directory to '': No such file or directory
# echo $?
125
# exit
$ fakechroot fakeroot -s .fakeroot.state -i .fakeroot.state chroot mychroot
# chroot /
/usr/sbin/chroot: cannot change root directory to '': No such file or directory
# echo $?
125
# exit
This error doesn't occur anymore with the patch below :
$ fakechroot fakeroot -s .fakeroot.state -i .fakeroot.state chroot mychroot
# pwd
/
# chroot .
# echo $?
0
# pwd
/
# exit
exit
# chroot /
# echo $?
0
# pwd
/
# exit
exit
# exit
exit
$
Regards,
JH Chatenet
--- /usr/sbin/chroot.fakechroot.orig
+++ /usr/sbin/chroot.fakechroot
@@ -94,11 +94,18 @@
fakechroot_chroot_paths="${fakechroot_chroot_paths#:}"
fi
+# Correct newroot if we chroot into the root
+if [ -n "$FAKECHROOT_BASE_ORIG" -a "$fakechroot_chroot_newroot" =
"$FAKECHROOT_BASE_ORIG" ]; then
+ fakechroot_chroot_final_newroot="/"
+else
+
fakechroot_chroot_final_newroot="${fakechroot_chroot_newroot#$FAKECHROOT_BASE_ORIG}"
+fi
+
# call real chroot
if [ -n "$fakechroot_chroot_newroot" ] && ( test "$1" = "${@:1:$((1+0))}" )
2>/dev/null && [ $fakechroot_chroot_n -le $# ]; then
# shell with arrays and built-in expr
env -u FAKECHROOT_BASE_ORIG FAKECHROOT_CMD_ORIG=
LD_LIBRARY_PATH="$fakechroot_chroot_paths"
FAKECHROOT_BASE="$fakechroot_chroot_base" \
- "$fakechroot_chroot_chroot" "${@:1:$(($fakechroot_chroot_n - 1))}"
"${fakechroot_chroot_newroot#$FAKECHROOT_BASE_ORIG}"
"${@:$(($fakechroot_chroot_n + 1))}"
+ "$fakechroot_chroot_chroot" "${@:1:$(($fakechroot_chroot_n - 1))}"
"$fakechroot_chroot_final_newroot" "${@:$(($fakechroot_chroot_n + 1))}"
exit $?
else
# POSIX shell
-- 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