Repository navigation
Fix installation and tests on current Ubuntu/Debian and Python 3.12+; fix mnexec bugs and test hangs - #1256
Closed
Mangesh-Bhattacharya wants to merge 1 commit into
Closed
Fix installation and tests on current Ubuntu/Debian and Python 3.12+; fix mnexec bugs and test hangs#1256Mangesh-Bhattacharya wants to merge 1 commit into
Mangesh-Bhattacharya wants to merge 1 commit into
Conversation
Mangesh-Bhattacharya
force-pushed
the
ci/debian-check
branch
from
September 18, 2026 20:37
bd2f741 to
77e5a91
Compare
…xec bugs
Mininet no longer installs or tests cleanly on Ubuntu 22.04/24.04,
Debian 12/13 or Python 3.12+. This fixes that without changing how
Mininet works.
Install and runtime:
- util/install.sh: Ubuntu 24.04 and Debian 12/13 (PEP 668, renamed and
removed packages, /etc/os-release, containers without sudo, any
checkout directory name)
- mininet/util.py: version parsing without distutils (removed in 3.12)
- mininet/node.py: OVSSwitch falls back to the userspace datapath when
the openvswitch kernel module is unavailable (containers, WSL, some
cloud kernels); MININET_OVS_DATAPATH overrides it
- Python 3 shebangs: "#!/usr/bin/env python" fails where there is no
python command (Ubuntu 22.04+, Debian 12+)
- 50 regex literals with invalid escapes ('\d') are raw strings
(SyntaxWarning since Python 3.12)
mnexec.c (runs as root):
- -c no longer closes the directory it is iterating, and frees it
- namespace fds are O_CLOEXEC and closed instead of leaking into commands
- -a validates the pid; snprintf instead of sprintf; isalnum() on
unsigned char; NULL working directory handled
- -g also works with cgroup v2 (cgroup.procs)
- Makefile builds it with FORTIFY_SOURCE, stack protector, PIE and full
RELRO
Tests:
- example tests read the example's output to EOF before pexpect wait();
wait() alone deadlocks when the child fills the pty buffer while
stopping the network (test_tree1024 hung CI for hours)
- sshd.py/baresshd.py create /run/sshd, which OpenSSH needs when started
by hand and current distributions only create for the ssh service
- example tests spawn python3
- CI: ubuntu-20.04 runners are retired and Python 2 can't be installed
on 24.04, so run-tests.yaml uses ubuntu-22.04/24.04 with python3;
code-check pins Python 3.11 for pylint 2.15; actions pinned by SHA
Packaging and docs:
- debian/: Python 3 + pybuild, debhelper compat 13, current dependency
names, hardening, DEP-5 copyright with the current BSD-3-Clause text
- util/doxify.py ported to Python 3 without doxypy (Python 2 only);
doxygen reads docstrings natively
- util/vm/install-mininet-vm.sh works on Ubuntu 22.04/24.04 and Debian
(no python2), uses /etc/sudoers.d
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Mininet 2.3.1b4 no longer installs or tests cleanly on current systems:
util/install.shfails on Ubuntu 24.04 and Debian 12/13,mnfails onPython 3.12+ (
distutilswas removed), scripts start with#!/usr/bin/env pythonalthough there is nopythoncommand onUbuntu 22.04+/Debian 12+, and CI targets the retired
ubuntu-20.04runners. This PR fixes these without changing Mininet's API or
mnoptions.
Install and runtime
util/install.sh: Ubuntu 22.04/24.04 and Debian 12/13 (PEP 668externally-managed Python, renamed/removed packages,
/etc/os-release,containers without
sudo, any checkout directory name).mininet/util.py: version parsing withoutdistutils.mininet/node.py:OVSSwitchfalls back to the userspace datapathwhen the
openvswitchkernel module is unavailable (Docker, WSL 2, somecloud kernels);
MININET_OVS_DATAPATH=kernel|useroverrides it.escapes (
'\d') made raw strings (SyntaxWarning since 3.12).mnexec.c(runs as root)-cclosed the/proc/self/fddirectory it was iterating and neverfreed it.
O_CLOEXECand closed instead of leaking intothe executed command.
-avalidates the pid;snprintfinstead ofsprintf;isalnum()gets an
unsigned char; aNULLworking directory is handled.-galso supports cgroup v2 (cgroup.procs), the default today._FORTIFY_SOURCE, stack protector, PIE andfull RELRO.
Tests
wait()afterexitwithout reading the child's output. When stopping the network fills the
pty buffer, both sides block forever;
test_tree1024hung CI for hours.Tests now read to EOF first.
sshd.py/baresshd.pycreate/run/sshd, which OpenSSH requireswhen started by hand and current distributions only create for the ssh
service (
test_sshd/test_baresshdfailed on Ubuntu 24.04).run-tests.yamlruns onubuntu-22.04andubuntu-24.04withPython 3 (Python 2 can't be installed on 24.04);
code-check.yamlpinsPython 3.11, since pylint 2.15.7 doesn't run on 3.12+. Actions are
pinned to commit SHAs.
Packaging and docs
debian/(last updated for 2.1.0 in 2013): Python 3 + pybuild,debhelper compat 13, current dependency names, hardening flags, DEP-5
copyright with the current BSD-3-Clause license.
util/doxify.pyported to Python 3; it no longer needsdoxypy(Python 2 only). doxygen reads the docstrings natively.
util/vm/install-mininet-vm.shworks on Ubuntu 22.04/24.04 andDebian (it tried to install
python2), and uses/etc/sudoers.d.Testing
Verified in GitHub Actions on Ubuntu 22.04 and 24.04:
install.sh -nv,mn --test pingall(OVS kernel and userspace datapaths, Linux bridge,TCLink), the core test suite, and every example test (
test_nat'sInternet ping is skipped on runners without outbound ICMP).
install.shwas also run from scratch in
ubuntu:22.04,ubuntu:24.04,debian:12and
debian:13containers, and the Debian package was built withdpkg-buildpackage, installed and used to run a network.Notes for reviewers
install.shis left in place; only the CI matrixand the VM script stop using it, because it can't be installed on
current releases. Happy to restore a
python2job onubuntu-22.04if you want to keep testing it.
(Mangesh-Bhattacharya/mininet)
that also adds Docker images, a browser GUI and other features. Those
are deliberately not included here. I'm glad to split this PR into
smaller ones (install, Python 3.12,
mnexec, tests, packaging) if thatis easier to review.