Use /usr/bin/env python for virtualenv (#1025)

This helps with virtualenv although it can open
up another security hole if you end up using an
unexpected python interpreter.

Overall it seems to make sense to err on the side
of usability but it's good to be aware of security.

However, for the remaining utility scripts that require
python 2, we explicitly note this with #!/usr/bin/python2.
This commit is contained in:
lantz
2021-02-05 07:42:50 -08:00
committed by GitHub
parent a882d68a5f
commit f0c726a42f
39 changed files with 53 additions and 57 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/env python
""" """
Mininet runner Mininet runner
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/env python
"This example doesn't use OpenFlow, but attempts to run sshd in a namespace." "This example doesn't use OpenFlow, but attempts to run sshd in a namespace."
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/env python
""" """
bind.py: Bind mount example bind.py: Bind mount example
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/env python
""" """
cluster.py: prototyping/experimentation for distributed Mininet, cluster.py: prototyping/experimentation for distributed Mininet,
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/env python
"CLI for Mininet Cluster Edition prototype demo" "CLI for Mininet Cluster Edition prototype demo"
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/env python
"clusterdemo.py: demo of Mininet Cluster Edition prototype" "clusterdemo.py: demo of Mininet Cluster Edition prototype"
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/env python
"clusterperf.py compare the maximum throughput between SSH and GRE tunnels" "clusterperf.py compare the maximum throughput between SSH and GRE tunnels"
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/env python
""" """
consoles.py: bring up a bunch of miniature consoles on a virtual network consoles.py: bring up a bunch of miniature consoles on a virtual network
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/env python
""" """
Create a network where different switches are connected to Create a network where different switches are connected to
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/env python
""" """
This example creates a multi-controller network from semi-scratch by This example creates a multi-controller network from semi-scratch by
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/env python
""" """
controlnet.py: Mininet with a custom control network controlnet.py: Mininet with a custom control network
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/env python
""" """
cpu.py: test iperf bandwidth for varying cpu limits cpu.py: test iperf bandwidth for varying cpu limits
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/env python
""" """
This example shows how to create an empty Mininet object This example shows how to create an empty Mininet object
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/env python
""" """
This example shows how to add an interface (for example a real This example shows how to add an interface (for example a real
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/env python
''' '''
example of using various TCIntf options. example of using various TCIntf options.
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/env python
""" """
limit.py: example of using link and CPU limits limit.py: example of using link and CPU limits
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/env python
""" """
Test bandwidth (using iperf) on linear networks of varying size, Test bandwidth (using iperf) on linear networks of varying size,
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/env python
""" """
linuxrouter.py: Example network with Linux IP router linuxrouter.py: Example network with Linux IP router
+1 -1
View File
@@ -1704,7 +1704,7 @@ class MiniEdit( Frame ):
# debug( "Now saving under %s\n" % fileName ) # debug( "Now saving under %s\n" % fileName )
f = open(fileName, 'wb') f = open(fileName, 'wb')
f.write("#!/usr/bin/python\n") f.write("#!/usr/bin/env python\n")
f.write("\n") f.write("\n")
f.write("from mininet.net import Mininet\n") f.write("from mininet.net import Mininet\n")
f.write("from mininet.node import Controller, RemoteController, OVSController\n") f.write("from mininet.node import Controller, RemoteController, OVSController\n")
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/env python
""" """
Simple example of Mobility with Mininet Simple example of Mobility with Mininet
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/env python
""" """
This is a simple example that demonstrates multiple links This is a simple example that demonstrates multiple links
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/env python
""" """
multiping.py: monitor multiple sets of hosts using ping multiping.py: monitor multiple sets of hosts using ping
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/env python
""" """
Simple example of sending output to multiple files and Simple example of sending output to multiple files and
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/env python
""" """
This example shows how to create a network and run multiple tests. This example shows how to create a network and run multiple tests.
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/env python
""" """
Example to create a Mininet topology and connect it to the internet via NAT Example to create a Mininet topology and connect it to the internet via NAT
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/env python
""" """
natnet.py: Example network with NATs natnet.py: Example network with NATs
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/env python
""" """
Create a network with 5 hosts, numbered 1-4 and 9. Create a network with 5 hosts, numbered 1-4 and 9.
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/env python
""" """
This example monitors a number of hosts using host.popen() and This example monitors a number of hosts using host.popen() and
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/env python
"Monitor multiple hosts using popen()/pmonitor()" "Monitor multiple hosts using popen()/pmonitor()"
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/env python
""" """
Build a simple network from scratch, using mininet primitives. Build a simple network from scratch, using mininet primitives.
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/env python
""" """
Build a simple network from scratch, using mininet primitives. Build a simple network from scratch, using mininet primitives.
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/env python
""" """
Simple example of setting network and CPU parameters Simple example of setting network and CPU parameters
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/env python
""" """
Create a network and start sshd(8) on each host. Create a network and start sshd(8) on each host.
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/env python
""" """
Create a 1024-host network, and run the CLI on it. Create a 1024-host network, and run the CLI on it.
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/env python
"Create a 64-node tree network, and test connectivity using ping." "Create a 64-node tree network, and test connectivity using ping."
+1 -5
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python2
""" """
Convert simple documentation to epydoc/pydoctor-compatible markup Convert simple documentation to epydoc/pydoctor-compatible markup
@@ -83,7 +83,3 @@ if __name__ == '__main__':
infile.close() infile.close()
os.close( outfid ) os.close( outfid )
call( [ 'doxypy', outname ] ) call( [ 'doxypy', outname ] )
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python2
""" """
Translate from PEP8 Python style to Mininet (i.e. Arista-like) Translate from PEP8 Python style to Mininet (i.e. Arista-like)
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/env python
from subprocess import check_output as co from subprocess import check_output as co
from sys import exit, version_info from sys import exit, version_info
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python2.7 #!/usr/bin/python2
""" """
build.py: build a Mininet VM build.py: build a Mininet VM