summaryrefslogtreecommitdiff
path: root/examples/userchroot.py
diff options
context:
space:
mode:
authorHelmut Grohne <helmut@subdivi.de>2025-06-28 09:11:42 +0200
committerHelmut Grohne <helmut@subdivi.de>2025-06-28 09:18:36 +0200
commit823b6754d68b01a6d30431411506cc9084560e68 (patch)
tree921b01e364b660d438231db2db8a65c748ac2023 /examples/userchroot.py
parent7d6895d7ca0fe472c64964793b12f8ea536decde (diff)
downloadpython-linuxnamespaces-823b6754d68b01a6d30431411506cc9084560e68.tar.gz
change/improve populate_dev API
populate_dev may be used before unsharing a pid namespace with the intention of unsharing it. Then, /dev/pts should not be mounted and instead that mount needs to happen inside the newly created pid namespace. To allow for this usage, rename the pidns argument to pts and turn it into a literal. It may also be desired to have a /dev without pts, so add that option as well. It's a breaking change, but it does add clarity.
Diffstat (limited to 'examples/userchroot.py')
-rwxr-xr-xexamples/userchroot.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/examples/userchroot.py b/examples/userchroot.py
index 2caea33..4006dc6 100755
--- a/examples/userchroot.py
+++ b/examples/userchroot.py
@@ -39,7 +39,7 @@ def main() -> None:
linuxnamespaces.bind_mount(chrootdir, "/mnt", recursive=True)
linuxnamespaces.bind_mount("/proc", "/mnt/proc", recursive=True)
linuxnamespaces.bind_mount("/sys", "/mnt/sys", recursive=True)
- linuxnamespaces.populate_dev("/", "/mnt", pidns=False)
+ linuxnamespaces.populate_dev("/", "/mnt", pts="host")
os.chdir("/mnt")
linuxnamespaces.pivot_root(".", ".")
linuxnamespaces.umount(".", linuxnamespaces.UmountFlags.DETACH)