Vit Mojzis <vmojzis@xxxxxxxxxx> writes: > A change in seobject.py file_type_str_to_option made the "file type" > list not compatible with items in this ComboBox. > See: 317743bbe2a235a5c68f1066b4153e0726a3118f > > Avoid this in the future by populating the ComboBox using keys from > file_type_str_to_option. > > This change disables translations on the file types, but those cause > other issues (adding file context fails the same way as with 'socket > file' since the translated strings differ form > file_type_str_to_option.keys, 'properties' of a file context entry > shows no file type for the same reason). > > Fixes: > 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 195, in add > (rc, out) = getstatusoutput("semanage fcontext -a -t %s -r %s -f '%s' '%s'" % (type, mls, seobject.file_type_str_to_option[ftype], fspec)) > KeyError: 'socket file' > > Signed-off-by: Vit Mojzis <vmojzis@xxxxxxxxxx> Acked-by: Petr Lautrbach <plautrba@xxxxxxxxxx> And merged. Thanks! > --- > Add missing "Signed-off-by". > > gui/fcontextPage.py | 7 +++++++ > gui/system-config-selinux.ui | 26 -------------------------- > 2 files changed, 7 insertions(+), 26 deletions(-) > > diff --git a/gui/fcontextPage.py b/gui/fcontextPage.py > index 370bbee4..d26aa1b4 100644 > --- a/gui/fcontextPage.py > +++ b/gui/fcontextPage.py > @@ -102,6 +102,13 @@ class fcontextPage(semanagePage): > self.load() > self.fcontextEntry = xml.get_object("fcontextEntry") > self.fcontextFileTypeCombo = xml.get_object("fcontextFileTypeCombo") > + # Populate file type combo_box > + liststore = self.fcontextFileTypeCombo.get_model() > + for ftype in seobject.file_type_str_to_option.keys(): > + iter = liststore.append() > + liststore.set_value(iter, 0, ftype) > + iter = liststore.get_iter_first() > + self.fcontextFileTypeCombo.set_active_iter(iter) > self.fcontextTypeEntry = xml.get_object("fcontextTypeEntry") > self.fcontextMLSEntry = xml.get_object("fcontextMLSEntry") > > diff --git a/gui/system-config-selinux.ui b/gui/system-config-selinux.ui > index 7cc1cc53..e7b84a64 100644 > --- a/gui/system-config-selinux.ui > +++ b/gui/system-config-selinux.ui > @@ -401,32 +401,6 @@ Level</property> > <!-- column-name gchararray --> > <column type="gchararray"/> > </columns> > - <data> > - <row> > - <col id="0" translatable="yes">all files</col> > - </row> > - <row> > - <col id="0" translatable="yes">regular file</col> > - </row> > - <row> > - <col id="0" translatable="yes">directory</col> > - </row> > - <row> > - <col id="0" translatable="yes">character device</col> > - </row> > - <row> > - <col id="0" translatable="yes">block device</col> > - </row> > - <row> > - <col id="0" translatable="yes">socket file</col> > - </row> > - <row> > - <col id="0" translatable="yes">symbolic link</col> > - </row> > - <row> > - <col id="0" translatable="yes">named pipe</col> > - </row> > - </data> > </object> > <object class="GtkDialog" id="fcontextDialog"> > <property name="can_focus">False</property> > -- > 2.29.2