On 6/19/19 10:40 AM, Paul Moore wrote:
On Wed, Jun 19, 2019 at 10:26 AM Stephen Smalley <sds@xxxxxxxxxxxxx> wrote:
/usr/bin/python is no longer installed by default, so this test
script fails on default installs.
Best practice guidance appears to be to switch to using
/usr/bin/python3 instead, per
https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/
Fixes: #46
Signed-off-by: Stephen Smalley <sds@xxxxxxxxxxxxx>
---
tests/overlay/access | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
I think it would be better to reference the Python upstream guidance
regarding "python3" instead of the Fedora packaging guidelines.
Keeping things distro agnostic is a good goal whenever possible.
* https://www.python.org/dev/peps/pep-0394
When I looked for guidance in response to the github issue for
selinux-testsuite [1], there seemed to be some ambiguity left by pep-0394:
1) It says "One exception to this is scripts that are deliberately
written to be source compatible with both Python 2.x and 3.x. Such
scripts may continue to use python on their shebang line.". This leaves
open the possibility of staying with "/usr/bin/python" as far as the pep
is concerned since the script itself is not version-specific in any way,
but doing so is not permitted by the Fedora guidelines and breaks on
default installs of Fedora.
2) It doesn't specify whether or not one should use "/usr/bin/env
python3" or just "/usr/bin/python3". The github issue reported had
originally suggested the former, but this is also prohibited by the
Fedora guidelines.
That's why I went with the Fedora guidelines. Happy to use whatever but
at least that particular PEP doesn't clearly motivate the use of
"/usr/bin/python3" here.
[1] https://github.com/SELinuxProject/selinux-testsuite/issues/46
diff --git a/tests/overlay/access b/tests/overlay/access
index 5a47eb145904..e50d5b402ebd 100755
--- a/tests/overlay/access
+++ b/tests/overlay/access
@@ -1,4 +1,4 @@
-#!/bin/python
+#!/usr/bin/python3
import os, sys
try:
acc=eval("os.%s" % sys.argv[2])
--
2.20.1