* [PATCH] python/semanage/seobject.py: Fix undefined store check
@ 2018-05-04 11:51 Petr Lautrbach
2018-05-04 17:58 ` Stephen Smalley
2018-05-08 12:15 ` Stephen Smalley
0 siblings, 2 replies; 6+ messages in thread
From: Petr Lautrbach @ 2018-05-04 11:51 UTC (permalink / raw)
To: selinux
From: Vit Mojzis <vmojzis@redhat.com>
self.store is always a string (actual store name or "") because of
semanageRecords.__init__. Fix check for not defined store.
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1559174#c3
Signed-off-by: Vit Mojzis <vmojzis@redhat.com>
---
python/semanage/seobject.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/python/semanage/seobject.py b/python/semanage/seobject.py
index ac310ea6..c76dce85 100644
--- a/python/semanage/seobject.py
+++ b/python/semanage/seobject.py
@@ -2651,7 +2651,7 @@ class booleanRecords(semanageRecords):
self.current_booleans = []
ptype = None
- if self.store is None or self.store == ptype:
+ if self.store == "" or self.store == ptype:
self.modify_local = True
else:
self.modify_local = False
--
2.17.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] python/semanage/seobject.py: Fix undefined store check
2018-05-04 11:51 [PATCH] python/semanage/seobject.py: Fix undefined store check Petr Lautrbach
@ 2018-05-04 17:58 ` Stephen Smalley
2018-05-04 20:12 ` Petr Lautrbach
2018-05-08 12:15 ` Stephen Smalley
1 sibling, 1 reply; 6+ messages in thread
From: Stephen Smalley @ 2018-05-04 17:58 UTC (permalink / raw)
To: Petr Lautrbach, selinux
On 05/04/2018 07:51 AM, Petr Lautrbach wrote:
> From: Vit Mojzis <vmojzis@redhat.com>
>
> self.store is always a string (actual store name or "") because of
> semanageRecords.__init__. Fix check for not defined store.
>
> Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1559174#c3
>
> Signed-off-by: Vit Mojzis <vmojzis@redhat.com>
> ---
> python/semanage/seobject.py | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/python/semanage/seobject.py b/python/semanage/seobject.py
> index ac310ea6..c76dce85 100644
> --- a/python/semanage/seobject.py
> +++ b/python/semanage/seobject.py
> @@ -2651,7 +2651,7 @@ class booleanRecords(semanageRecords):
> self.current_booleans = []
> ptype = None
>
> - if self.store is None or self.store == ptype:
> + if self.store == "" or self.store == ptype:
> self.modify_local = True
> else:
> self.modify_local = False
>
Is there a reason you didn't use if not self.store here?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] python/semanage/seobject.py: Fix undefined store check
2018-05-04 17:58 ` Stephen Smalley
@ 2018-05-04 20:12 ` Petr Lautrbach
2018-05-07 13:58 ` Stephen Smalley
0 siblings, 1 reply; 6+ messages in thread
From: Petr Lautrbach @ 2018-05-04 20:12 UTC (permalink / raw)
To: Stephen Smalley; +Cc: selinux
[-- Attachment #1: Type: text/plain, Size: 1261 bytes --]
On Fri, May 04, 2018 at 01:58:08PM -0400, Stephen Smalley wrote:
> On 05/04/2018 07:51 AM, Petr Lautrbach wrote:
> > From: Vit Mojzis <vmojzis@redhat.com>
> >
> > self.store is always a string (actual store name or "") because of
> > semanageRecords.__init__. Fix check for not defined store.
> >
> > Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1559174#c3
> >
> > Signed-off-by: Vit Mojzis <vmojzis@redhat.com>
> > ---
> > python/semanage/seobject.py | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/python/semanage/seobject.py b/python/semanage/seobject.py
> > index ac310ea6..c76dce85 100644
> > --- a/python/semanage/seobject.py
> > +++ b/python/semanage/seobject.py
> > @@ -2651,7 +2651,7 @@ class booleanRecords(semanageRecords):
> > self.current_booleans = []
> > ptype = None
> >
> > - if self.store is None or self.store == ptype:
> > + if self.store == "" or self.store == ptype:
> > self.modify_local = True
> > else:
> > self.modify_local = False
> >
>
> Is there a reason you didn't use if not self.store here?
>
There's a similar check on line 258 and this just follows the same pattern.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] python/semanage/seobject.py: Fix undefined store check
2018-05-04 20:12 ` Petr Lautrbach
@ 2018-05-07 13:58 ` Stephen Smalley
2018-05-07 20:00 ` Petr Lautrbach
0 siblings, 1 reply; 6+ messages in thread
From: Stephen Smalley @ 2018-05-07 13:58 UTC (permalink / raw)
To: Petr Lautrbach; +Cc: selinux
On 05/04/2018 04:12 PM, Petr Lautrbach wrote:
> On Fri, May 04, 2018 at 01:58:08PM -0400, Stephen Smalley wrote:
>> On 05/04/2018 07:51 AM, Petr Lautrbach wrote:
>>> From: Vit Mojzis <vmojzis@redhat.com>
>>>
>>> self.store is always a string (actual store name or "") because of
>>> semanageRecords.__init__. Fix check for not defined store.
>>>
>>> Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1559174#c3
>>>
>>> Signed-off-by: Vit Mojzis <vmojzis@redhat.com>
>>> ---
>>> python/semanage/seobject.py | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/python/semanage/seobject.py b/python/semanage/seobject.py
>>> index ac310ea6..c76dce85 100644
>>> --- a/python/semanage/seobject.py
>>> +++ b/python/semanage/seobject.py
>>> @@ -2651,7 +2651,7 @@ class booleanRecords(semanageRecords):
>>> self.current_booleans = []
>>> ptype = None
>>>
>>> - if self.store is None or self.store == ptype:
>>> + if self.store == "" or self.store == ptype:
>>> self.modify_local = True
>>> else:
>>> self.modify_local = False
>>>
>>
>> Is there a reason you didn't use if not self.store here?
>>
>
> There's a similar check on line 258 and this just follows the same pattern.
Ok, I don't have a strong opinion on it either way, but noticed that it was recommended
to use not self.store in that bugzilla entry, comment #9, and was claimed to have been changed
in comment #10. Up to you.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] python/semanage/seobject.py: Fix undefined store check
2018-05-07 13:58 ` Stephen Smalley
@ 2018-05-07 20:00 ` Petr Lautrbach
0 siblings, 0 replies; 6+ messages in thread
From: Petr Lautrbach @ 2018-05-07 20:00 UTC (permalink / raw)
To: Stephen Smalley; +Cc: selinux
[-- Attachment #1: Type: text/plain, Size: 2176 bytes --]
On Mon, May 07, 2018 at 09:58:28AM -0400, Stephen Smalley wrote:
> On 05/04/2018 04:12 PM, Petr Lautrbach wrote:
> > On Fri, May 04, 2018 at 01:58:08PM -0400, Stephen Smalley wrote:
> >> On 05/04/2018 07:51 AM, Petr Lautrbach wrote:
> >>> From: Vit Mojzis <vmojzis@redhat.com>
> >>>
> >>> self.store is always a string (actual store name or "") because of
> >>> semanageRecords.__init__. Fix check for not defined store.
> >>>
> >>> Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1559174#c3
> >>>
> >>> Signed-off-by: Vit Mojzis <vmojzis@redhat.com>
> >>> ---
> >>> python/semanage/seobject.py | 2 +-
> >>> 1 file changed, 1 insertion(+), 1 deletion(-)
> >>>
> >>> diff --git a/python/semanage/seobject.py b/python/semanage/seobject.py
> >>> index ac310ea6..c76dce85 100644
> >>> --- a/python/semanage/seobject.py
> >>> +++ b/python/semanage/seobject.py
> >>> @@ -2651,7 +2651,7 @@ class booleanRecords(semanageRecords):
> >>> self.current_booleans = []
> >>> ptype = None
> >>>
> >>> - if self.store is None or self.store == ptype:
> >>> + if self.store == "" or self.store == ptype:
> >>> self.modify_local = True
> >>> else:
> >>> self.modify_local = False
> >>>
> >>
> >> Is there a reason you didn't use if not self.store here?
> >>
> >
> > There's a similar check on line 258 and this just follows the same pattern.
>
> Ok, I don't have a strong opinion on it either way, but noticed that it was recommended
> to use not self.store in that bugzilla entry, comment #9, and was claimed to have been changed
> in comment #10. Up to you.
>
I think that the important part of the message is not use
`self.store is ""` as it has unpredictable behavior.
The check `not self.store` is already in __init__ on line 252:
252 if not self.store:
253 self.store = getattr(args, "store", "")
If there's no objection, I'd leave as it is now.
FYI: I'll be offline most time of the week so I won't be able to
respond to emails during this time.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] python/semanage/seobject.py: Fix undefined store check
2018-05-04 11:51 [PATCH] python/semanage/seobject.py: Fix undefined store check Petr Lautrbach
2018-05-04 17:58 ` Stephen Smalley
@ 2018-05-08 12:15 ` Stephen Smalley
1 sibling, 0 replies; 6+ messages in thread
From: Stephen Smalley @ 2018-05-08 12:15 UTC (permalink / raw)
To: Petr Lautrbach, selinux
On 05/04/2018 07:51 AM, Petr Lautrbach wrote:
> From: Vit Mojzis <vmojzis@redhat.com>
>
> self.store is always a string (actual store name or "") because of
> semanageRecords.__init__. Fix check for not defined store.
>
> Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1559174#c3
>
> Signed-off-by: Vit Mojzis <vmojzis@redhat.com>
> ---
> python/semanage/seobject.py | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/python/semanage/seobject.py b/python/semanage/seobject.py
> index ac310ea6..c76dce85 100644
> --- a/python/semanage/seobject.py
> +++ b/python/semanage/seobject.py
> @@ -2651,7 +2651,7 @@ class booleanRecords(semanageRecords):
> self.current_booleans = []
> ptype = None
>
> - if self.store is None or self.store == ptype:
> + if self.store == "" or self.store == ptype:
> self.modify_local = True
> else:
> self.modify_local = False
>
Applied.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-05-08 12:15 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-04 11:51 [PATCH] python/semanage/seobject.py: Fix undefined store check Petr Lautrbach
2018-05-04 17:58 ` Stephen Smalley
2018-05-04 20:12 ` Petr Lautrbach
2018-05-07 13:58 ` Stephen Smalley
2018-05-07 20:00 ` Petr Lautrbach
2018-05-08 12:15 ` Stephen Smalley
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.