Skip to contentSkip to conversation

python/sepolicy: drop python shebang from the module

PATCH In review Nicolas Iooss 3 participants 6 messages Feb 17, 2019 – Feb 20, 2019 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 python/sepolicy: drop python shebang from the module

The files in sepolicy's module directory are not supposed to used as executable files. The shebang line is therefore not needed.

---
 python/sepolicy/sepolicy/__init__.py    | 2 --
 python/sepolicy/sepolicy/booleans.py    | 1 -
 python/sepolicy/sepolicy/communicate.py | 1 -
 python/sepolicy/sepolicy/generate.py    | 2 --
 python/sepolicy/sepolicy/gui.py         | 2 --
 python/sepolicy/sepolicy/interface.py   | 2 --
 python/sepolicy/sepolicy/manpage.py     | 1 -
 python/sepolicy/sepolicy/network.py     | 1 -
 python/sepolicy/sepolicy/transition.py  | 1 -
 9 files changed, 13 deletions(-)
python/sepolicy/sepolicy/__init__.py +0 -2
index 6f7294726be4..6aed31bddf1e 100644
@@ -1,5 +1,3 @@
-#!/usr/bin/python
-
 # Author: Dan Walsh <[email protected]>
 # Author: Ryan Hallisey <[email protected]>
 # Author: Jason Zaman <[email protected]>
python/sepolicy/sepolicy/booleans.py +0 -1
index cf5f1ffc6469..ad07ab045d3e 100644
@@ -1,4 +1,3 @@
-#! /usr/bin/python -Es
 # Copyright (C) 2012 Red Hat
 # see file 'COPYING' for use and warranty information
 #
python/sepolicy/sepolicy/communicate.py +0 -1
index 299316e0bf27..374002204f84 100755
@@ -1,4 +1,3 @@
-#! /usr/bin/python -Es
 # Copyright (C) 2012 Red Hat
 # see file 'COPYING' for use and warranty information
 #
python/sepolicy/sepolicy/generate.py +0 -2
index 5a2195b8033f..019e7836c597 100644
@@ -1,5 +1,3 @@
-#!/usr/bin/python -Es
-#
 # Copyright (C) 2007-2012 Red Hat
 # see file 'COPYING' for use and warranty information
 #
python/sepolicy/sepolicy/gui.py +0 -2
index d4bf3b48e629..00fd7a11dab8 100644
@@ -1,5 +1,3 @@
-#!/usr/bin/python -Es
-#
 # Copyright (C) 2013 Red Hat
 # see file 'COPYING' for use and warranty information
 #
python/sepolicy/sepolicy/interface.py +0 -2
index 27c37bb8e1f8..583091ae18aa 100644
@@ -1,5 +1,3 @@
-#!/usr/bin/python -Es
-#
 # Copyright (C) 2012 Red Hat
 # see file 'COPYING' for use and warranty information
 #
python/sepolicy/sepolicy/manpage.py +0 -1
index af18b6ffc12f..1d367962365a 100755
@@ -1,4 +1,3 @@
-#! /usr/bin/python -Es
 # Copyright (C) 2012-2013 Red Hat
 # AUTHOR: Dan Walsh <[email protected]>
 # AUTHOR: Miroslav Grepl <[email protected]>
python/sepolicy/sepolicy/network.py +0 -1
index 115f6b8778d5..34267d929b0d 100755
@@ -1,4 +1,3 @@
-#! /usr/bin/python -Es
 # Copyright (C) 2012 Red Hat
 # see file 'COPYING' for use and warranty information
 #
python/sepolicy/sepolicy/transition.py +0 -1
index 7dea80597dc1..6414a765d0fa 100755
@@ -1,4 +1,3 @@
-#! /usr/bin/python -Es
 # Copyright (C) 2011 Red Hat
 # see file 'COPYING' for use and warranty information
 #
Signature · 1 line
2.20.1
#1 lore raw

PATCH 2/2 python: always use python3 in the shebang of programs using setools

setools 4.2.0 dropped support for Python 2. On systems where /usr/bin/python is Python 2, several tools are now broken because of this. Update the shebang of these tools to /usr/bin/python3.

For future reference, as semanage/seobject.py, sepolicy and sepolgen import setools, every program that uses one of these modules need to be run with Python 3. The following programs do not use any of these modules so their shebangs have not been modified:

dbus/selinux_server.py
libsemanage/utils/semanage_migrate_store
mcstrans/share/util/mlscolor-test
mcstrans/share/util/mlstrans-test
sandbox/start

---
 gui/polgengui.py                  | 2 +-
 gui/system-config-selinux.py      | 2 +-
 python/audit2allow/audit2allow    | 2 +-
 python/audit2allow/sepolgen-ifgen | 2 +-
 python/chcat/chcat                | 2 +-
 python/sepolicy/sepolicy.py       | 2 +-
 sandbox/sandbox                   | 2 +-
 7 files changed, 7 insertions(+), 7 deletions(-)
gui/polgengui.py +1 -1
index 1601dbef0e8d..b1cc99372434 100644
@@ -1,4 +1,4 @@
-#!/usr/bin/python -Es
+#!/usr/bin/python3 -Es
 #
 # polgengui.py - GUI for SELinux Config tool in system-config-selinux
 #
gui/system-config-selinux.py +1 -1
index ce7c74b1333c..c42301b626fc 100644
@@ -1,4 +1,4 @@
-#!/usr/bin/python -Es
+#!/usr/bin/python3 -Es
 #
 # system-config-selinux.py - GUI for SELinux Config tool in system-config-selinux
 #
python/audit2allow/audit2allow +1 -1
index 18fe0a531d02..09b06f664bc4 100644
@@ -1,4 +1,4 @@
-#! /usr/bin/python -Es
+#!/usr/bin/python3 -Es
 # Authors: Karl MacMillan <[email protected]>
 # Authors: Dan Walsh <[email protected]>
 #
python/audit2allow/sepolgen-ifgen +1 -1
index c482f227193f..be2d093be597 100644
@@ -1,4 +1,4 @@
-#! /usr/bin/python -Es
+#!/usr/bin/python3 -Es
 #
 # Authors: Karl MacMillan <[email protected]>
 #
python/chcat/chcat +1 -1
index 5bef0073b7a4..ba398684376d 100755
@@ -1,4 +1,4 @@
-#! /usr/bin/python -Es
+#!/usr/bin/python3 -Es
 # Copyright (C) 2005 Red Hat
 # see file 'COPYING' for use and warranty information
 #
python/sepolicy/sepolicy.py +1 -1
index 8cc7e8cc5c1c..1934cd8620b0 100755
@@ -1,4 +1,4 @@
-#! /usr/bin/python -Es
+#!/usr/bin/python3 -Es
 # Copyright (C) 2012 Red Hat
 # AUTHOR: Dan Walsh <[email protected]>
 # see file 'COPYING' for use and warranty information
sandbox/sandbox +1 -1
index c07a1d812a13..1dec07acdcb8 100644
@@ -1,4 +1,4 @@
-#! /usr/bin/python -Es
+#!/usr/bin/python3 -Es
 # Authors: Dan Walsh <[email protected]>
 # Authors: Thomas Liu <[email protected]>
 # Authors: Josh Cogliati
Signature · 1 line
2.20.1
Acked-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] python: always use python3 in the shebang of programs using setools

Quoted 9 lines · Nicolas Iooss

setools 4.2.0 dropped support for Python 2. On systems where /usr/bin/python is Python 2, several tools are now broken because of this. Update the shebang of these tools to /usr/bin/python3.

For future reference, as semanage/seobject.py, sepolicy and sepolgen import setools, every program that uses one of these modules need to be run with Python 3. The following programs do not use any of these modules so their shebangs have not been modified:

Quoted 7 lines

dbus/selinux_server.py
libsemanage/utils/semanage_migrate_store
mcstrans/share/util/mlscolor-test
mcstrans/share/util/mlstrans-test
sandbox/start

Quoted 82 lines
---
 gui/polgengui.py                  | 2 +-
 gui/system-config-selinux.py      | 2 +-
 python/audit2allow/audit2allow    | 2 +-
 python/audit2allow/sepolgen-ifgen | 2 +-
 python/chcat/chcat                | 2 +-
 python/sepolicy/sepolicy.py       | 2 +-
 sandbox/sandbox                   | 2 +-
 7 files changed, 7 insertions(+), 7 deletions(-)
gui/polgengui.py +1 -1
index 1601dbef0e8d..b1cc99372434 100644
@@ -1,4 +1,4 @@
-#!/usr/bin/python -Es
+#!/usr/bin/python3 -Es
 #
 # polgengui.py - GUI for SELinux Config tool in 
 system-config-selinux

#

gui/system-config-selinux.py +1 -1
index ce7c74b1333c..c42301b626fc 100644
@@ -1,4 +1,4 @@
-#!/usr/bin/python -Es
+#!/usr/bin/python3 -Es
 #
 # system-config-selinux.py - GUI for SELinux Config tool in 
 system-config-selinux

#

python/audit2allow/audit2allow +1 -1
index 18fe0a531d02..09b06f664bc4 100644
@@ -1,4 +1,4 @@
-#! /usr/bin/python -Es
+#!/usr/bin/python3 -Es
 # Authors: Karl MacMillan <[email protected]>
 # Authors: Dan Walsh <[email protected]>
 #
python/audit2allow/sepolgen-ifgen +1 -1
index c482f227193f..be2d093be597 100644
@@ -1,4 +1,4 @@
-#! /usr/bin/python -Es
+#!/usr/bin/python3 -Es
 #
 # Authors: Karl MacMillan <[email protected]>
 #
python/chcat/chcat +1 -1
index 5bef0073b7a4..ba398684376d 100755
@@ -1,4 +1,4 @@
-#! /usr/bin/python -Es
+#!/usr/bin/python3 -Es
 # Copyright (C) 2005 Red Hat
 # see file 'COPYING' for use and warranty information
 #
python/sepolicy/sepolicy.py +1 -1
index 8cc7e8cc5c1c..1934cd8620b0 100755
@@ -1,4 +1,4 @@
-#! /usr/bin/python -Es
+#!/usr/bin/python3 -Es
 # Copyright (C) 2012 Red Hat
 # AUTHOR: Dan Walsh <[email protected]>
 # see file 'COPYING' for use and warranty information
sandbox/sandbox +1 -1
index c07a1d812a13..1dec07acdcb8 100644
@@ -1,4 +1,4 @@
-#! /usr/bin/python -Es
+#!/usr/bin/python3 -Es
 # Authors: Dan Walsh <[email protected]>
 # Authors: Thomas Liu <[email protected]>
 # Authors: Josh Cogliati
#3 lore raw

Re: [PATCH 2/2] python: always use python3 in the shebang of programs using setools

Quoted 17 lines · Petr Lautrbach
Quoted 15 lines · Nicolas Iooss

setools 4.2.0 dropped support for Python 2. On systems where /usr/bin/python is Python 2, several tools are now broken because of this. Update the shebang of these tools to /usr/bin/python3.

For future reference, as semanage/seobject.py, sepolicy and sepolgen import setools, every program that uses one of these modules need to be run with Python 3. The following programs do not use any of these modules so their shebangs have not been modified:

dbus/selinux_server.py
libsemanage/utils/semanage_migrate_store
mcstrans/share/util/mlscolor-test
mcstrans/share/util/mlstrans-test
sandbox/start

Quoted 3 lines
Quoted 1 line

Both patches are merged already.

Quoted 83 lines
Quoted 83 lines
---
 gui/polgengui.py                  | 2 +-
 gui/system-config-selinux.py      | 2 +-
 python/audit2allow/audit2allow    | 2 +-
 python/audit2allow/sepolgen-ifgen | 2 +-
 python/chcat/chcat                | 2 +-
 python/sepolicy/sepolicy.py       | 2 +-
 sandbox/sandbox                   | 2 +-
 7 files changed, 7 insertions(+), 7 deletions(-)
gui/polgengui.py +1 -1
index 1601dbef0e8d..b1cc99372434 100644
@@ -1,4 +1,4 @@
-#!/usr/bin/python -Es
+#!/usr/bin/python3 -Es
 #
 # polgengui.py - GUI for SELinux Config tool in 
 system-config-selinux

#

gui/system-config-selinux.py +1 -1
index ce7c74b1333c..c42301b626fc 100644
@@ -1,4 +1,4 @@
-#!/usr/bin/python -Es
+#!/usr/bin/python3 -Es
 #
 # system-config-selinux.py - GUI for SELinux Config tool in

system-config-selinux
#

python/audit2allow/audit2allow +1 -1
index 18fe0a531d02..09b06f664bc4 100644
@@ -1,4 +1,4 @@
-#! /usr/bin/python -Es
+#!/usr/bin/python3 -Es
 # Authors: Karl MacMillan <[email protected]>
 # Authors: Dan Walsh <[email protected]>
 #
python/audit2allow/sepolgen-ifgen +1 -1
index c482f227193f..be2d093be597 100644
@@ -1,4 +1,4 @@
-#! /usr/bin/python -Es
+#!/usr/bin/python3 -Es
 #
 # Authors: Karl MacMillan <[email protected]>
 #
python/chcat/chcat +1 -1
index 5bef0073b7a4..ba398684376d 100755
@@ -1,4 +1,4 @@
-#! /usr/bin/python -Es
+#!/usr/bin/python3 -Es
 # Copyright (C) 2005 Red Hat
 # see file 'COPYING' for use and warranty information
 #
python/sepolicy/sepolicy.py +1 -1
index 8cc7e8cc5c1c..1934cd8620b0 100755
@@ -1,4 +1,4 @@
-#! /usr/bin/python -Es
+#!/usr/bin/python3 -Es
 # Copyright (C) 2012 Red Hat
 # AUTHOR: Dan Walsh <[email protected]>
 # see file 'COPYING' for use and warranty information
sandbox/sandbox +1 -1
index c07a1d812a13..1dec07acdcb8 100644
@@ -1,4 +1,4 @@
-#! /usr/bin/python -Es
+#!/usr/bin/python3 -Es
 # Authors: Dan Walsh <[email protected]>
 # Authors: Thomas Liu <[email protected]>
 # Authors: Josh Cogliati
Acked-by on v1 1/2
#4 lore raw
In reply to Nicolas Iooss
Quoted 4 lines · Nicolas Iooss

The files in sepolicy's module directory are not supposed to used as executable files. The shebang line is therefore not needed.

Quoted 97 lines
---
 python/sepolicy/sepolicy/__init__.py    | 2 --
 python/sepolicy/sepolicy/booleans.py    | 1 -
 python/sepolicy/sepolicy/communicate.py | 1 -
 python/sepolicy/sepolicy/generate.py    | 2 --
 python/sepolicy/sepolicy/gui.py         | 2 --
 python/sepolicy/sepolicy/interface.py   | 2 --
 python/sepolicy/sepolicy/manpage.py     | 1 -
 python/sepolicy/sepolicy/network.py     | 1 -
 python/sepolicy/sepolicy/transition.py  | 1 -
 9 files changed, 13 deletions(-)
python/sepolicy/sepolicy/__init__.py +0 -2
index 6f7294726be4..6aed31bddf1e 100644
@@ -1,5 +1,3 @@
-#!/usr/bin/python
-
 # Author: Dan Walsh <[email protected]>
 # Author: Ryan Hallisey <[email protected]>
 # Author: Jason Zaman <[email protected]>
python/sepolicy/sepolicy/booleans.py +0 -1
index cf5f1ffc6469..ad07ab045d3e 100644
@@ -1,4 +1,3 @@
-#! /usr/bin/python -Es
 # Copyright (C) 2012 Red Hat
 # see file 'COPYING' for use and warranty information
 #
python/sepolicy/sepolicy/communicate.py +0 -1
index 299316e0bf27..374002204f84 100755
@@ -1,4 +1,3 @@
-#! /usr/bin/python -Es
 # Copyright (C) 2012 Red Hat
 # see file 'COPYING' for use and warranty information
 #
python/sepolicy/sepolicy/generate.py +0 -2
index 5a2195b8033f..019e7836c597 100644
@@ -1,5 +1,3 @@
-#!/usr/bin/python -Es
-#
 # Copyright (C) 2007-2012 Red Hat
 # see file 'COPYING' for use and warranty information
 #
python/sepolicy/sepolicy/gui.py +0 -2
index d4bf3b48e629..00fd7a11dab8 100644
@@ -1,5 +1,3 @@
-#!/usr/bin/python -Es
-#
 # Copyright (C) 2013 Red Hat
 # see file 'COPYING' for use and warranty information
 #
python/sepolicy/sepolicy/interface.py +0 -2
index 27c37bb8e1f8..583091ae18aa 100644
@@ -1,5 +1,3 @@
-#!/usr/bin/python -Es
-#
 # Copyright (C) 2012 Red Hat
 # see file 'COPYING' for use and warranty information
 #
python/sepolicy/sepolicy/manpage.py +0 -1
index af18b6ffc12f..1d367962365a 100755
@@ -1,4 +1,3 @@
-#! /usr/bin/python -Es
 # Copyright (C) 2012-2013 Red Hat
 # AUTHOR: Dan Walsh <[email protected]>
 # AUTHOR: Miroslav Grepl <[email protected]>
python/sepolicy/sepolicy/network.py +0 -1
index 115f6b8778d5..34267d929b0d 100755
@@ -1,4 +1,3 @@
-#! /usr/bin/python -Es
 # Copyright (C) 2012 Red Hat
 # see file 'COPYING' for use and warranty information
 #
python/sepolicy/sepolicy/transition.py +0 -1
index 7dea80597dc1..6414a765d0fa 100755
@@ -1,4 +1,3 @@
-#! /usr/bin/python -Es
 # Copyright (C) 2011 Red Hat
 # see file 'COPYING' for use and warranty information
 #
Acked-by on v1 1/2
#5 lore raw
In reply to Nicolas Iooss
Quoted 4 lines · Nicolas Iooss

The files in sepolicy's module directory are not supposed to used as executable files. The shebang line is therefore not needed.

For both these patches:

Quoted 100 lines
---
 python/sepolicy/sepolicy/__init__.py    | 2 --
 python/sepolicy/sepolicy/booleans.py    | 1 -
 python/sepolicy/sepolicy/communicate.py | 1 -
 python/sepolicy/sepolicy/generate.py    | 2 --
 python/sepolicy/sepolicy/gui.py         | 2 --
 python/sepolicy/sepolicy/interface.py   | 2 --
 python/sepolicy/sepolicy/manpage.py     | 1 -
 python/sepolicy/sepolicy/network.py     | 1 -
 python/sepolicy/sepolicy/transition.py  | 1 -
 9 files changed, 13 deletions(-)
python/sepolicy/sepolicy/__init__.py +0 -2
index 6f7294726be4..6aed31bddf1e 100644
@@ -1,5 +1,3 @@
-#!/usr/bin/python
-
 # Author: Dan Walsh <[email protected]>
 # Author: Ryan Hallisey <[email protected]>
 # Author: Jason Zaman <[email protected]>
python/sepolicy/sepolicy/booleans.py +0 -1
index cf5f1ffc6469..ad07ab045d3e 100644
@@ -1,4 +1,3 @@
-#! /usr/bin/python -Es
 # Copyright (C) 2012 Red Hat
 # see file 'COPYING' for use and warranty information
 #
python/sepolicy/sepolicy/communicate.py +0 -1
index 299316e0bf27..374002204f84 100755
@@ -1,4 +1,3 @@
-#! /usr/bin/python -Es
 # Copyright (C) 2012 Red Hat
 # see file 'COPYING' for use and warranty information
 #
python/sepolicy/sepolicy/generate.py +0 -2
index 5a2195b8033f..019e7836c597 100644
@@ -1,5 +1,3 @@
-#!/usr/bin/python -Es
-#
 # Copyright (C) 2007-2012 Red Hat
 # see file 'COPYING' for use and warranty information
 #
python/sepolicy/sepolicy/gui.py +0 -2
index d4bf3b48e629..00fd7a11dab8 100644
@@ -1,5 +1,3 @@
-#!/usr/bin/python -Es
-#
 # Copyright (C) 2013 Red Hat
 # see file 'COPYING' for use and warranty information
 #
python/sepolicy/sepolicy/interface.py +0 -2
index 27c37bb8e1f8..583091ae18aa 100644
@@ -1,5 +1,3 @@
-#!/usr/bin/python -Es
-#
 # Copyright (C) 2012 Red Hat
 # see file 'COPYING' for use and warranty information
 #
python/sepolicy/sepolicy/manpage.py +0 -1
index af18b6ffc12f..1d367962365a 100755
@@ -1,4 +1,3 @@
-#! /usr/bin/python -Es
 # Copyright (C) 2012-2013 Red Hat
 # AUTHOR: Dan Walsh <[email protected]>
 # AUTHOR: Miroslav Grepl <[email protected]>
python/sepolicy/sepolicy/network.py +0 -1
index 115f6b8778d5..34267d929b0d 100755
@@ -1,4 +1,3 @@
-#! /usr/bin/python -Es
 # Copyright (C) 2012 Red Hat
 # see file 'COPYING' for use and warranty information
 #
python/sepolicy/sepolicy/transition.py +0 -1
index 7dea80597dc1..6414a765d0fa 100755
@@ -1,4 +1,3 @@
-#! /usr/bin/python -Es
 # Copyright (C) 2011 Red Hat
 # see file 'COPYING' for use and warranty information
 #
Signature · 1 line
2.20.1