selinux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paul Moore <paul@paul-moore.com>
To: Stephen Smalley <sds@tycho.nsa.gov>
Cc: selinux@vger.kernel.org
Subject: Re: [PATCH] selinux-testsuite: fix old python shebang in tests/overlay/access
Date: Fri, 21 Jun 2019 11:44:50 -0400	[thread overview]
Message-ID: <CAHC9VhQViswrAHWZ6b4a4iAmErrumLLYHeNrZenqXrT+0FxP7w@mail.gmail.com> (raw)
In-Reply-To: <a11f8817-ac26-ce5c-1b1d-20c310777a03@tycho.nsa.gov>

On Wed, Jun 19, 2019 at 12:04 PM Stephen Smalley <sds@tycho.nsa.gov> wrote:
> On 6/19/19 10:40 AM, Paul Moore wrote:
> > On Wed, Jun 19, 2019 at 10:26 AM Stephen Smalley <sds@tycho.nsa.gov> 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@tycho.nsa.gov>
> >> ---
> >>   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.

[SIDE NOTE: for some reason my mail is acting a bit odd - this got
buried in a folder and didn't bubble up like normal - my apologies on
the delay, I didn't see it until I was checking for patches today.]

Yes, I saw that too but considering that we are about six months away
from python2 going EOL I think it is reasonable to ignore python2 for
upstream work at this point.

> 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.

My initial reaction was that we should "/usr/bin/env" until I saw that
bit in the Fedora guidelines, which I honestly don't understand.  Does
anyone with a better understanding of cross-distro userspace know why
"/usr/bin/env" is bad?

> 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

Fair enough, I'll go ahead and merge it since it does fix a real
problem.  I did make once change to convert the "Fixes: #46" to use
the full URL, e.g. "Fixes: https://github.com..."; I think this helps
provide some necessary context (what if 10yrs from now we aren't on
github, what does "#46" reference?).

This is starting to stretch the topic a bit, but as far as "use
whatever" is concerned, I'd really like to see us keep moving towards
a more distro agnostic approach when it comes to upstream
development/testing/etc.  While SELinux has always had a "special"
relationship with Fedora/RH, we've seen SELinux grow quite a bit over
the years and I think it would be good to start trying to bring other
distros up to the same level as Fedora when it comes to SELinux
support.  I think one easy first step is to start looking beyond the
Fedora guidelines and see what other distros do/recommend.

> >> 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
> >
>


-- 
paul moore
www.paul-moore.com

  reply	other threads:[~2019-06-21 15:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-19 14:26 [PATCH] selinux-testsuite: fix old python shebang in tests/overlay/access Stephen Smalley
2019-06-19 14:40 ` Paul Moore
2019-06-19 16:04   ` Stephen Smalley
2019-06-21 15:44     ` Paul Moore [this message]
2019-06-23 17:01       ` Nicolas Iooss

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAHC9VhQViswrAHWZ6b4a4iAmErrumLLYHeNrZenqXrT+0FxP7w@mail.gmail.com \
    --to=paul@paul-moore.com \
    --cc=sds@tycho.nsa.gov \
    --cc=selinux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).