summaryrefslogtreecommitdiffstats
path: root/py
diff options
context:
space:
mode:
authorClark Williams <williams@redhat.com>2009-11-23 08:47:15 -0600
committerClark Williams <williams@redhat.com>2009-11-23 08:47:15 -0600
commit57fa3712cb4801e37c7a72fc82e86937f311c89e (patch)
tree25094b838a707d5c1e32f17aa00fac73fdbe0da2 /py
parent2122aa41ad7376a3409fc180c5a158983eebde7a (diff)
downloadmock-57fa3712cb4801e37c7a72fc82e86937f311c89e.tar.gz
mock-57fa3712cb4801e37c7a72fc82e86937f311c89e.tar.xz
mock-57fa3712cb4801e37c7a72fc82e86937f311c89e.zip
reworked devpts handling {BZ 510183}
changed setup of devpts inside chroot so that /dev/ptmx is a symlink to /dev/pty/ptmx and that it's mounted with all read/write permissions so that pty's are usable inside the chroot. Also called devSetup when running interactive shell, so that shell chroot matches build chroot environment. Signed-off-by: Clark Williams <williams@redhat.com>
Diffstat (limited to 'py')
-rwxr-xr-xpy/mock.py1
-rw-r--r--py/mock/backend.py6
2 files changed, 5 insertions, 2 deletions
diff --git a/py/mock.py b/py/mock.py
index a09e6d8..7d82175 100755
--- a/py/mock.py
+++ b/py/mock.py
@@ -569,6 +569,7 @@ def main(ret):
if not os.path.exists(chroot.makeChrootPath()):
raise RuntimeError, "chroot %s not initialized!" % chroot.makeChrootPath()
try:
+ chroot._setupDev()
chroot._mountall()
cmd = ' '.join(args)
status = os.system("PS1='mock-chroot> ' /usr/sbin/chroot %s %s" % (chroot.makeChrootPath(), cmd))
diff --git a/py/mock/backend.py b/py/mock/backend.py
index 3f60a08..ef4d90b 100644
--- a/py/mock/backend.py
+++ b/py/mock/backend.py
@@ -311,7 +311,6 @@ class Root(object):
(stat.S_IFCHR | 0444, os.makedev(1, 9), "dev/urandom"),
(stat.S_IFCHR | 0666, os.makedev(5, 0), "dev/tty"),
(stat.S_IFCHR | 0600, os.makedev(5, 1), "dev/console"),
- (stat.S_IFCHR | 0666, os.makedev(5, 2), "dev/ptmx"),
)
for i in devFiles:
# create node
@@ -325,6 +324,7 @@ class Root(object):
os.symlink("/proc/self/fd/0", self.makeChrootPath("dev/stdin"))
os.symlink("/proc/self/fd/1", self.makeChrootPath("dev/stdout"))
os.symlink("/proc/self/fd/2", self.makeChrootPath("dev/stderr"))
+ os.symlink("/dev/pts/ptmx", self.makeChrootPath("dev/ptmx"))
os.umask(prevMask)
# mount/umount
@@ -334,7 +334,7 @@ class Root(object):
if devUnmtCmd not in self.umountCmds:
self.umountCmds.append(devUnmtCmd)
- mountopt = 'gid=%d,mode=620' % grp.getgrnam('tty').gr_gid
+ mountopt = 'gid=%d,mode=0620,ptmxmode=0666' % grp.getgrnam('tty').gr_gid
if os.uname()[2] >= '2.6.29':
mountopt += ',newinstance'
@@ -410,6 +410,7 @@ class Root(object):
self._callHooks('earlyprebuild')
try:
+ self._setupDev()
self._mountall()
self.uidManager.becomeUser(self.chrootuid, self.chrootgid)
self.state("setup")
@@ -433,6 +434,7 @@ class Root(object):
spec = specs[0] # if there's more than one then someone is an idiot
chrootspec = spec.replace(self.makeChrootPath(), '') # get rid of rootdir prefix
# Completely/Permanently drop privs while running the following:
+
self.doChroot(
["bash", "--login", "-c", 'rpmbuild -bs --target %s --nodeps %s' % (self.rpmbuild_arch, chrootspec)],
shell=False,