Description: lxc-ubuntu: use relative path as target for bind mount
 An absolute path will be interpreted as absolute with respect to the
 parent's namespace.
 This patch will be forwarded.
Author: Serge Hallyn <serge.hallyn@ubuntu.com>
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/968371
Forwarded: no

Index: lxc-0.7.5/templates/lxc-ubuntu.in
===================================================================
--- lxc-0.7.5.orig/templates/lxc-ubuntu.in	2012-03-29 22:05:46.000000000 +0000
+++ lxc-0.7.5/templates/lxc-ubuntu.in	2012-03-30 02:59:02.738912355 +0000
@@ -515,7 +515,12 @@
     # bind-mount the user's path into the container's /home
     h=`getent passwd $user | cut -d: -f 6`
     mkdir -p $rootfs/$h
-    echo "$h $h none bind 0 0" >> $path/fstab
+	# use relative path in container
+	h2=${h#/}
+	while [ ${h2:0:1} = "/" ]; do
+		h2=${h2#/}
+	done
+    echo "$h $h2 none bind 0 0" >> $path/fstab
 
     # Make sure the group exists in container
     grp=`echo $pwd | cut -d: -f 4`  # group number for $user
