summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClark Williams <williams@redhat.com>2009-07-08 14:36:44 -0500
committerClark Williams <williams@redhat.com>2009-07-08 14:36:44 -0500
commitcbe5e0fb94228bca7d1686160f3f43d77780ea95 (patch)
tree9a860a49e52f4d209bdf979406953bf4fc485fb8
parentdd53959146bc22d497c82ec416540af5c8427ec4 (diff)
downloadmock-cbe5e0fb94228bca7d1686160f3f43d77780ea95.tar.gz
mock-cbe5e0fb94228bca7d1686160f3f43d77780ea95.tar.xz
mock-cbe5e0fb94228bca7d1686160f3f43d77780ea95.zip
reworked /dev/pts mount command to lookup 'tty' group id and
to use the 'newinstance' mount option if the kernel version is >= 2.6.29 Signed-off-by: Clark Williams <williams@redhat.com>
-rw-r--r--py/mock/backend.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/py/mock/backend.py b/py/mock/backend.py
index a453012..04e1b1a 100644
--- a/py/mock/backend.py
+++ b/py/mock/backend.py
@@ -14,6 +14,7 @@ import os
import shutil
import stat
import uuid
+import grp
# our imports
import mock.util
@@ -328,8 +329,12 @@ class Root(object):
if devUnmtCmd not in self.umountCmds:
self.umountCmds.append(devUnmtCmd)
+ mountopt = 'gid=%d,mode=620' % grp.getgrnam('tty').gr_gid
+ if os.uname()[2] >= '2.6.29':
+ mountopt +== ',newinstance'
+
for devMntCmd in (
- 'mount -n -t devpts -o gid=5,mode=620 mock_chroot_devpts %s' % self.makeChrootPath('/dev/pts'),
+ 'mount -n -t devpts -o %s mock_chroot_devpts %s' % (mountopt, self.makeChrootPath('/dev/pts')),
'mount -n -t tmpfs mock_chroot_shmfs %s' % self.makeChrootPath('/dev/shm') ):
if devMntCmd not in self.mountCmds:
self.mountCmds.append(devMntCmd)