enter_chroot: bind mount /dev/pts

All devpts mounts are actually shared, even if you do:
	mount -t devpts none /dev/pts
	mount -t devpts none /mnt/foo
	mount -t devpts none /mnt/asdfasdf
These all provide the same data.

This is problematic because most distros mount their host devpts like so:
	mount -t devpts devpts /dev/pts -o mode=620,gid=5

But when cros_sdk runs, it uses:
	mount -t devpts none /dev/pts

We aren't specifying a mode/gid, so it ends up using the defaults, and
this resets the host devpts mount as well.

Since we've already assumed that the system has devpts available, it's
fine to also assume that the system has it mounted at /dev/pts and we
can simply bind mount it.

BUG=None
TEST=`cros_sdk` no longer messes up host perms on /dev/pts

Change-Id: Ib594fc5e47707f296d97ac1edce32659ed2b2273
Reviewed-on: https://gerrit.chromium.org/gerrit/48018
Reviewed-by: Steev Klimaszewski <threeway@gmail.com>
Reviewed-by: David James <davidjames@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
This commit is contained in:
Mike Frysinger 2013-04-12 13:47:01 -04:00 committed by Michael Marineau
parent a7627f70d9
commit 7f30c14bdc

View File

@ -213,7 +213,7 @@ setup_env() {
setup_mount none "-t proc" /proc
setup_mount none "-t sysfs" /sys
setup_mount /dev "--bind" /dev
setup_mount none "-t devpts" /dev/pts
setup_mount /dev/pts "--bind" /dev/pts
if [[ -d /run ]]; then
setup_mount /run "--bind" /run
if [[ -d /run/shm && ! -L /run/shm ]]; then