All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] gui/semanagePage: Close "edit" and "add" dialogues when successfull
@ 2018-02-22 13:29 Vit Mojzis
  2018-02-26 14:51 ` Stephen Smalley
  0 siblings, 1 reply; 7+ messages in thread
From: Vit Mojzis @ 2018-02-22 13:29 UTC (permalink / raw)
  To: selinux

"Edit" and "add" dialogues weren't closed after successful transaction
("add" and "edit" methods return "None" if successful).

Signed-off-by: Vit Mojzis <vmojzis@redhat.com>
---
 gui/semanagePage.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gui/semanagePage.py b/gui/semanagePage.py
index 560ec077..4127804f 100644
--- a/gui/semanagePage.py
+++ b/gui/semanagePage.py
@@ -140,7 +140,7 @@ class semanagePage:
 
         while self.dialog.run() == Gtk.ResponseType.OK:
             try:
-                if not self.add():
+                if self.add() is False:
                     continue
                 break
             except ValueError as e:
@@ -153,7 +153,7 @@ class semanagePage:
         self.dialog.set_position(Gtk.WindowPosition.MOUSE)
         while self.dialog.run() == Gtk.ResponseType.OK:
             try:
-                if not self.modify():
+                if self.modify() is False:
                     continue
                 break
             except ValueError as e:
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] gui/semanagePage: Close "edit" and "add" dialogues when successfull
  2018-02-22 13:29 [PATCH] gui/semanagePage: Close "edit" and "add" dialogues when successfull Vit Mojzis
@ 2018-02-26 14:51 ` Stephen Smalley
  2018-03-01 10:59   ` Vit Mojzis
  0 siblings, 1 reply; 7+ messages in thread
From: Stephen Smalley @ 2018-02-26 14:51 UTC (permalink / raw)
  To: Vit Mojzis, selinux

On 02/22/2018 08:29 AM, Vit Mojzis wrote:
> "Edit" and "add" dialogues weren't closed after successful transaction
> ("add" and "edit" methods return "None" if successful).

I see the bug, but the behavior after applying the patch also seems to
be wrong:
Traceback (most recent call last):
  File "/usr/share/system-config-selinux/system-config-selinux.py", line
136, in add
    self.tabs[self.notebook.get_current_page()].addDialog()
  File "/usr/share/system-config-selinux/semanagePage.py", line 143, in
addDialog
    if self.add() is False:
  File "/usr/share/system-config-selinux/fcontextPage.py", line 192, in add
    ftype = list_model.get_value(it, 0)
TypeError: Argument 1 does not allow None as a value

> 
> Signed-off-by: Vit Mojzis <vmojzis@redhat.com>
> ---
>  gui/semanagePage.py | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/gui/semanagePage.py b/gui/semanagePage.py
> index 560ec077..4127804f 100644
> --- a/gui/semanagePage.py
> +++ b/gui/semanagePage.py
> @@ -140,7 +140,7 @@ class semanagePage:
>  
>          while self.dialog.run() == Gtk.ResponseType.OK:
>              try:
> -                if not self.add():
> +                if self.add() is False:
>                      continue
>                  break
>              except ValueError as e:
> @@ -153,7 +153,7 @@ class semanagePage:
>          self.dialog.set_position(Gtk.WindowPosition.MOUSE)
>          while self.dialog.run() == Gtk.ResponseType.OK:
>              try:
> -                if not self.modify():
> +                if self.modify() is False:
>                      continue
>                  break
>              except ValueError as e:
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] gui/semanagePage: Close "edit" and "add" dialogues when successfull
  2018-02-26 14:51 ` Stephen Smalley
@ 2018-03-01 10:59   ` Vit Mojzis
  2018-03-01 10:59     ` [PATCH 1/3] secilc: Fix documentation build for OS X systems Vit Mojzis
  2018-03-01 11:03     ` [PATCH] gui/fcontextPage: Set default object class in addDialog Vit Mojzis
  0 siblings, 2 replies; 7+ messages in thread
From: Vit Mojzis @ 2018-03-01 10:59 UTC (permalink / raw)
  To: selinux

The traceback was caused by leaving the object class combo box blank (therefore is not directly connected to this patch).
But I agree that is's undesirable behavior. I can either add a check that would notify the user that they left the option blank, or set a default value.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/3] secilc: Fix documentation build for OS X systems
  2018-03-01 10:59   ` Vit Mojzis
@ 2018-03-01 10:59     ` Vit Mojzis
  2018-03-01 11:03       ` Vit Mojzis
  2018-03-01 11:03     ` [PATCH] gui/fcontextPage: Set default object class in addDialog Vit Mojzis
  1 sibling, 1 reply; 7+ messages in thread
From: Vit Mojzis @ 2018-03-01 10:59 UTC (permalink / raw)
  To: selinux

From: Yuli Khodorkovskiy <ykhodo@gmail.com>

Since Darwin systems do not have GNU sed installed, the Darwin sed is
missing the "regexp-extended" flag needed to modify the secilc markdown
files before processing with pandoc.

A quick fix for Mac users is to `brew install gnu-sed` and to use gsed.

Signed-off-by: Yuli Khodorkovskiy <ykhodo@gmail.com>
---
 secilc/docs/Makefile | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/secilc/docs/Makefile b/secilc/docs/Makefile
index c0fa6b7f..6b07ce7f 100644
--- a/secilc/docs/Makefile
+++ b/secilc/docs/Makefile
@@ -31,6 +31,12 @@ PANDOC_FILE_LIST = $(addprefix $(TMPDIR)/,$(FILE_LIST))
 PDF_OUT=CIL_Reference_Guide.pdf
 HTML_OUT=CIL_Reference_Guide.html
 PANDOC = pandoc
+SED ?= sed
+
+OS := $(shell uname)
+ifeq ($(OS), Darwin)
+	SED := gsed
+endif
 
 all: html pdf
 
@@ -40,12 +46,12 @@ $(TMPDIR):
 $(TMPDIR)/%.md: %.md | $(TMPDIR)
 	cp -f $< $(TMPDIR)/
 	@# Substitute markdown links for conversion into PDF links
-	sed -i -re 's:(\[`[^`]*`\])\([^#]*([^\)]):\1\(\2:g' $@
+	$(SED) -i -re 's:(\[`[^`]*`\])\([^#]*([^\)]):\1\(\2:g' $@
 
 $(TMPDIR)/policy.cil: $(TESTDIR)/policy.cil
 	cp -f $< $@
 	@# add a title for the TOC to policy.cil. This is needed to play nicely with the PDF conversion.
-	sed -i '1i Example Policy\n=========\n```' $@
+	$(SED) -i '1i Example Policy\n=========\n```' $@
 	echo '```' >> $@
 
 html: $(PANDOC_FILE_LIST) $(TMPDIR)/policy.cil
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH] gui/fcontextPage: Set default object class in addDialog
  2018-03-01 10:59   ` Vit Mojzis
  2018-03-01 10:59     ` [PATCH 1/3] secilc: Fix documentation build for OS X systems Vit Mojzis
@ 2018-03-01 11:03     ` Vit Mojzis
  2018-03-01 14:49       ` Stephen Smalley
  1 sibling, 1 reply; 7+ messages in thread
From: Vit Mojzis @ 2018-03-01 11:03 UTC (permalink / raw)
  To: selinux

This ensures that user cannot leave the object class selection blank.

Signed-off-by: Vit Mojzis <vmojzis@redhat.com>
---
 gui/fcontextPage.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gui/fcontextPage.py b/gui/fcontextPage.py
index a6577ef7..370bbee4 100644
--- a/gui/fcontextPage.py
+++ b/gui/fcontextPage.py
@@ -164,6 +164,7 @@ class fcontextPage(semanagePage):
         self.fcontextEntry.set_text("")
         self.fcontextEntry.set_sensitive(True)
         self.fcontextFileTypeCombo.set_sensitive(True)
+        self.fcontextFileTypeCombo.set_active(0)
         self.fcontextTypeEntry.set_text("")
         self.fcontextMLSEntry.set_text("s0")
 
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/3] secilc: Fix documentation build for OS X systems
  2018-03-01 10:59     ` [PATCH 1/3] secilc: Fix documentation build for OS X systems Vit Mojzis
@ 2018-03-01 11:03       ` Vit Mojzis
  0 siblings, 0 replies; 7+ messages in thread
From: Vit Mojzis @ 2018-03-01 11:03 UTC (permalink / raw)
  To: selinux

Sorry, wrong patch, please ignore this.


On 1.3.2018 11:59, Vit Mojzis wrote:
> From: Yuli Khodorkovskiy <ykhodo@gmail.com>
>
> Since Darwin systems do not have GNU sed installed, the Darwin sed is
> missing the "regexp-extended" flag needed to modify the secilc markdown
> files before processing with pandoc.
>
> A quick fix for Mac users is to `brew install gnu-sed` and to use gsed.
>
> Signed-off-by: Yuli Khodorkovskiy <ykhodo@gmail.com>
> ---
>   secilc/docs/Makefile | 10 ++++++++--
>   1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/secilc/docs/Makefile b/secilc/docs/Makefile
> index c0fa6b7f..6b07ce7f 100644
> --- a/secilc/docs/Makefile
> +++ b/secilc/docs/Makefile
> @@ -31,6 +31,12 @@ PANDOC_FILE_LIST = $(addprefix $(TMPDIR)/,$(FILE_LIST))
>   PDF_OUT=CIL_Reference_Guide.pdf
>   HTML_OUT=CIL_Reference_Guide.html
>   PANDOC = pandoc
> +SED ?= sed
> +
> +OS := $(shell uname)
> +ifeq ($(OS), Darwin)
> +	SED := gsed
> +endif
>   
>   all: html pdf
>   
> @@ -40,12 +46,12 @@ $(TMPDIR):
>   $(TMPDIR)/%.md: %.md | $(TMPDIR)
>   	cp -f $< $(TMPDIR)/
>   	@# Substitute markdown links for conversion into PDF links
> -	sed -i -re 's:(\[`[^`]*`\])\([^#]*([^\)]):\1\(\2:g' $@
> +	$(SED) -i -re 's:(\[`[^`]*`\])\([^#]*([^\)]):\1\(\2:g' $@
>   
>   $(TMPDIR)/policy.cil: $(TESTDIR)/policy.cil
>   	cp -f $< $@
>   	@# add a title for the TOC to policy.cil. This is needed to play nicely with the PDF conversion.
> -	sed -i '1i Example Policy\n=========\n```' $@
> +	$(SED) -i '1i Example Policy\n=========\n```' $@
>   	echo '```' >> $@
>   
>   html: $(PANDOC_FILE_LIST) $(TMPDIR)/policy.cil

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] gui/fcontextPage: Set default object class in addDialog
  2018-03-01 11:03     ` [PATCH] gui/fcontextPage: Set default object class in addDialog Vit Mojzis
@ 2018-03-01 14:49       ` Stephen Smalley
  0 siblings, 0 replies; 7+ messages in thread
From: Stephen Smalley @ 2018-03-01 14:49 UTC (permalink / raw)
  To: Vit Mojzis, selinux

On 03/01/2018 06:03 AM, Vit Mojzis wrote:
> This ensures that user cannot leave the object class selection blank.

Thanks, applied both your previous gui/semanagePage patch and this one.

> 
> Signed-off-by: Vit Mojzis <vmojzis@redhat.com>
> ---
>  gui/fcontextPage.py | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/gui/fcontextPage.py b/gui/fcontextPage.py
> index a6577ef7..370bbee4 100644
> --- a/gui/fcontextPage.py
> +++ b/gui/fcontextPage.py
> @@ -164,6 +164,7 @@ class fcontextPage(semanagePage):
>          self.fcontextEntry.set_text("")
>          self.fcontextEntry.set_sensitive(True)
>          self.fcontextFileTypeCombo.set_sensitive(True)
> +        self.fcontextFileTypeCombo.set_active(0)
>          self.fcontextTypeEntry.set_text("")
>          self.fcontextMLSEntry.set_text("s0")
>  
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-03-01 14:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-22 13:29 [PATCH] gui/semanagePage: Close "edit" and "add" dialogues when successfull Vit Mojzis
2018-02-26 14:51 ` Stephen Smalley
2018-03-01 10:59   ` Vit Mojzis
2018-03-01 10:59     ` [PATCH 1/3] secilc: Fix documentation build for OS X systems Vit Mojzis
2018-03-01 11:03       ` Vit Mojzis
2018-03-01 11:03     ` [PATCH] gui/fcontextPage: Set default object class in addDialog Vit Mojzis
2018-03-01 14:49       ` 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.