SELinuxProject / selinux-testsuite

This is the upstream SELinux testsuite which is designed as a basic set of regression tests for the SELinux kernel functionality.
GNU General Public License v2.0
53 stars 43 forks source link

BUG: old python shebang in tests/overlay/access is causing unexpected failures #46

Closed lulinqing closed 5 years ago

lulinqing commented 5 years ago

Source

https://github.com/SELinuxProject/selinux-testsuite/blob/0f0e241bb8c06042da1bf5d2d33ee4f8639d3ab8/tests/overlay/access#L1

Problem

Current shebang #!/bin/python cannot find proper version of Python on some distro thus failing all calls from overlay/test to overlay/access:

overlay/test ................ 1/119 runcon: ‘overlay/access’: No such file or directory

#   Failed test at overlay/test line 491.
runcon: ‘overlay/access’: No such file or directory

#   Failed test at overlay/test line 498.
runcon: ‘overlay/access’: No such file or directory

#   Failed test at overlay/test line 505.
runcon: ‘overlay/access’: No such file or directory

#   Failed test at overlay/test line 512.
runcon: ‘overlay/access’: No such file or directory

#   Failed test at overlay/test line 526.
runcon: ‘overlay/access’: No such file or directory

#   Failed test at overlay/test line 533.
runcon: ‘overlay/access’: No such file or directory

#   Failed test at overlay/test line 540.
runcon: ‘overlay/access’: No such file or directory

#   Failed test at overlay/test line 547.
runcon: ‘overlay/access’: No such file or directory

#   Failed test at overlay/test line 491.
runcon: ‘overlay/access’: No such file or directory

#   Failed test at overlay/test line 498.
runcon: ‘overlay/access’: No such file or directory

#   Failed test at overlay/test line 505.
runcon: ‘overlay/access’: No such file or directory

#   Failed test at overlay/test line 519.
runcon: ‘overlay/access’: No such file or directory

#   Failed test at overlay/test line 526.
runcon: ‘overlay/access’: No such file or directory

#   Failed test at overlay/test line 533.
runcon: ‘overlay/access’: No such file or directory

#   Failed test at overlay/test line 540.
runcon: ‘overlay/access’: No such file or directory

#   Failed test at overlay/test line 547.
# Looks like you failed 16 tests of 119.
overlay/test ................ Dubious, test returned 16 (wstat 4096, 0x1000)
Failed 16/119 subtests 

Proposal

Use #!/usr/bin/env python3 shebang instead of #!/bin/python. #!/usr/bin/env python2 is less ideal but also works due to overlay/access is simple & compatible across python2/3.