Skip to contentSkip to conversation

python/sepolicy: silence new flake8 warnings

PATCH Applied Nicolas Iooss 3 participants 4 messages May 12, 2020 – May 13, 2020 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 python/sepolicy: silence new flake8 warnings

pyflakes 2.2.0 improved the way format strings are analyzed, which triggers new warnings in flake8:

python/sepolicy/sepolicy/manpage.py:1046:23: F999 '...' % ... has unused named argument(s): type

python/sepolicy/sepolicy/manpage.py:1225:23: F999 '...' % ... has unused named argument(s): user

Remove the unused arguments in order to silence these warnings.

This fixes failures in Travis-CI such as
https://travis-ci.org/github/SELinuxProject/selinux/jobs/686230518#L5153

---
 python/sepolicy/sepolicy/manpage.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
python/sepolicy/sepolicy/manpage.py +2 -2
index 442608191cc8..3e8a3be907e3 100755
@@ -1074,7 +1074,7 @@ If you wanted to change the default user mapping to use the %(user)s_u user, you
 
 .B semanage login -m -s %(user)s_u __default__
 
-""" % {'desc': self.desc, 'type': self.type, 'user': self.domainname, 'range': self._get_users_range()})
+""" % {'desc': self.desc, 'user': self.domainname, 'range': self._get_users_range()})
 
         if "login_userdomain" in self.attributes and "login_userdomain" in self.all_attributes:
             self.fd.write("""
@@ -1245,7 +1245,7 @@ Execute the following to see the types that the SELinux user %(type)s can execut
 
 .B $ sesearch -A -s %(type)s -c process -p transition
 
-""" % {'user': self.domainname, 'type': self.type})
+""" % {'type': self.type})
 
     def _role_header(self):
         self.fd.write('.TH  "%(user)s_selinux"  "8"  "%(user)s" "[email protected]" "%(user)s SELinux Policy documentation"'
Signature · 1 line
2.26.2
Acked-by on v1 1/1
#1 lore raw
Quoted 49 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Nicolas Iooss
Sent: Tuesday, May 12, 2020 2:30 PM
To: [email protected]
Subject: [PATCH] python/sepolicy: silence new flake8 warnings

pyflakes 2.2.0 improved the way format strings are analyzed, which triggers new warnings in flake8:

python/sepolicy/sepolicy/manpage.py:1046:23: F999 '...' % ... has unused named argument(s): type

python/sepolicy/sepolicy/manpage.py:1225:23: F999 '...' % ... has unused named argument(s): user

Remove the unused arguments in order to silence these warnings.

This fixes failures in Travis-CI such as
https://travis-ci.org/github/SELinuxProject/selinux/jobs/686230518#L5153

---
 python/sepolicy/sepolicy/manpage.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
python/sepolicy/sepolicy/manpage.py +0 -0
index 442608191cc8..3e8a3be907e3 100755
@@ -1074,7 +1074,7 @@ If you wanted to change the default user mapping to

use the %(user)s_u user, you

.B semanage login -m -s %(user)s_u __default__

-""" % {'desc': self.desc, 'type': self.type, 'user': self.domainname, 'range':
self._get_users_range()})
+""" % {'desc': self.desc, 'user': self.domainname, 'range':
+self._get_users_range()})

if "login_userdomain" in self.attributes and "login_userdomain" in
self.all_attributes:

             self.fd.write("""
python/sepolicy/sepolicy/manpage.py +0 -0
@@ -1245,7 +1245,7 @@ Execute the following to see the types that the SELinux

user %(type)s can execut

.B $ sesearch -A -s %(type)s -c process -p transition

Quoted 8 lines

-""" % {'user': self.domainname, 'type': self.type}) +""" % {'type': self.type})

     def _role_header(self):
         self.fd.write('.TH  "%(user)s_selinux"  "8"  "%(user)s" "[email protected]"

"%(user)s SELinux Policy documentation"'
--
2.26.2

I just hit this issue in the CI, good timing.

#2 lore raw
Quoted 61 lines · William C
Quoted 50 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Nicolas Iooss
Sent: Tuesday, May 12, 2020 2:30 PM
To: [email protected]
Subject: [PATCH] python/sepolicy: silence new flake8 warnings

pyflakes 2.2.0 improved the way format strings are analyzed, which triggers new warnings in flake8:

python/sepolicy/sepolicy/manpage.py:1046:23: F999 '...' % ... has unused named argument(s): type

python/sepolicy/sepolicy/manpage.py:1225:23: F999 '...' % ... has unused named argument(s): user

Remove the unused arguments in order to silence these warnings.

This fixes failures in Travis-CI such as
https://travis-ci.org/github/SELinuxProject/selinux/jobs/686230518#L5153

---
 python/sepolicy/sepolicy/manpage.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
python/sepolicy/sepolicy/manpage.py +0 -0
index 442608191cc8..3e8a3be907e3 100755
@@ -1074,7 +1074,7 @@ If you wanted to change the default user mapping to

use the %(user)s_u user, you

.B semanage login -m -s %(user)s_u __default__

-""" % {'desc': self.desc, 'type': self.type, 'user': self.domainname, 'range':
self._get_users_range()})
+""" % {'desc': self.desc, 'user': self.domainname, 'range':
+self._get_users_range()})

if "login_userdomain" in self.attributes and "login_userdomain" in
self.all_attributes:

             self.fd.write("""
python/sepolicy/sepolicy/manpage.py +0 -0
@@ -1245,7 +1245,7 @@ Execute the following to see the types that the SELinux

user %(type)s can execut

.B $ sesearch -A -s %(type)s -c process -p transition

Quoted 8 lines

-""" % {'user': self.domainname, 'type': self.type}) +""" % {'type': self.type})

     def _role_header(self):
         self.fd.write('.TH  "%(user)s_selinux"  "8"  "%(user)s" "[email protected]"

"%(user)s SELinux Policy documentation"'
--
2.26.2

I just hit this issue in the CI, good timing.

Quoted 1 line

So did I, while wanting to test the last patches that have been sent to the mailing list
(https://travis-ci.org/github/fishilico/selinux/builds/686257022). As the CI worked fine at least 4 days ago, it is a very recent change. I reproduced it easily on my Arch Linux development system by updating it, and downgrading python-pyflakes to its previous version (2.1.1) made the issue disappear. This is why I am sure this is caused by the latest release of pyflakes.

Cheers,
Nicolas

#3 lore raw
In reply to Nicolas Iooss
Quoted 9 lines · Nicolas Iooss

pyflakes 2.2.0 improved the way format strings are analyzed, which triggers new warnings in flake8:

python/sepolicy/sepolicy/manpage.py:1046:23: F999 '...' % ... has unused named argument(s): type

python/sepolicy/sepolicy/manpage.py:1225:23: F999 '...' % ... has unused named argument(s): user

Quoted 7 lines

Remove the unused arguments in order to silence these warnings.

This fixes failures in Travis-CI such as
https://travis-ci.org/github/SELinuxProject/selinux/jobs/686230518#L5153

Applied.

Quoted 26 lines
---
 python/sepolicy/sepolicy/manpage.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
python/sepolicy/sepolicy/manpage.py +2 -2
index 442608191cc8..3e8a3be907e3 100755
@@ -1074,7 +1074,7 @@ If you wanted to change the default user mapping to use the %(user)s_u user, you
 
 .B semanage login -m -s %(user)s_u __default__
 
-""" % {'desc': self.desc, 'type': self.type, 'user': self.domainname, 'range': self._get_users_range()})
+""" % {'desc': self.desc, 'user': self.domainname, 'range': self._get_users_range()})
 
         if "login_userdomain" in self.attributes and "login_userdomain" in self.all_attributes:
             self.fd.write("""
@@ -1245,7 +1245,7 @@ Execute the following to see the types that the SELinux user %(type)s can execut
 
 .B $ sesearch -A -s %(type)s -c process -p transition
 
-""" % {'user': self.domainname, 'type': self.type})
+""" % {'type': self.type})
 
     def _role_header(self):
         self.fd.write('.TH  "%(user)s_selinux"  "8"  "%(user)s" "[email protected]" "%(user)s SELinux Policy documentation"'
Signature · 2 lines
()  ascii ribbon campaign - against html e-mail 
/\  www.asciiribbon.org   - against proprietary attachments