2012-08-18 12:30:18

by Guido Trentalancia

[permalink] [raw]
Subject: [refpolicy] [PATCH]: clarify the file_contexts.subs_dist configuration file usage

Hello Sven.

>On Wed, Aug 15, 2012 at 10:13:26AM +0200, Guido Trentalancia wrote:
>> > This seems to break policycoreutils:
>> >
>> > # semanage fcontext -l
>> > /usr/sbin/semanage: too many values to unpack (expected 2)
>> >
>> > Undoing the comment change fixes things again.
>>
>> Is semanage using the standard library functions to read the file ?
>> Because I had a very quick look through the library and the #-comment
>> skipping code seemed to be there...
>
> fd = open(selinux.selinux_file_context_subs_dist_path(), "r")
> for i in fd.readlines():
> target, substitute = i.split()
> self.equiv_dist[target] = substitute
> fd.close()
>
>Just opens the file, reads lines and assumes there are always two
>values (target & substitute) on each line. This is from seobject.py.

You're right, I told you fibbs in my previous message.

seobject.py is buggy for it does not skip comments.

It needs to be patched, otherwise, as you noted, "semanage fcontext -l" does not work.

Regards,

Guido