Bug 1416372

Summary: sepolicy manpage -a / -d ... complains about InvalidRBACRuleType
Product: [Fedora] Fedora Reporter: Milos Malik <mmalik>
Component: policycoreutilsAssignee: Petr Lautrbach <plautrba>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: high    
Version: 26CC: dwalsh, lvrabec, mgrepl, plautrba, pmoore, vmojzis
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-03-01 07:35:56 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Milos Malik 2017-01-25 11:33:54 UTC
Description of problem:
* the tool always complains about InvalidRBACRuleType

Version-Release number of selected component (if applicable):
checkpolicy-2.6-0.1.fc25.x86_64
libselinux-2.6-0.1.fc25.x86_64
libselinux-python-2.6-0.1.fc25.x86_64
libselinux-python3-2.6-0.1.fc25.x86_64
libselinux-utils-2.6-0.1.fc25.x86_64
libsemanage-2.6-0.2.fc25.x86_64
libsemanage-python-2.6-0.2.fc25.x86_64
libsemanage-python3-2.6-0.2.fc25.x86_64
libsepol-2.6-0.2.fc25.x86_64
policycoreutils-2.6-0.5.fc25.x86_64
policycoreutils-devel-2.6-0.5.fc25.x86_64
policycoreutils-gui-2.6-0.5.fc25.x86_64
policycoreutils-python-2.6-0.5.fc25.x86_64
policycoreutils-python3-2.6-0.5.fc25.x86_64
policycoreutils-python-utils-2.6-0.5.fc25.x86_64
setools-console-4.0.1-0.2.fc25.x86_64
setools-python3-4.0.1-0.2.fc25.x86_64

How reproducible:
* always

Steps to Reproduce:
# sepolicy manpage -a
InvalidRBACRuleType: a is not a valid RBAC rule type.
# sepolicy manpage -d crond_t
InvalidRBACRuleType: a is not a valid RBAC rule type.
#

Actual results:
* no man page is generated

Expected results:
* appropriate man page is generated

Comment 1 Milos Malik 2017-02-06 15:05:48 UTC
# rpm -qa checkpolicy\* libselinux\* libsemanage\* libsepol\* policycoreutils\* setools\* | sort
checkpolicy-2.6-0.1.fc25.x86_64
libselinux-2.6-0.1.fc25.x86_64
libselinux-python-2.6-0.1.fc25.x86_64
libselinux-python3-2.6-0.1.fc25.x86_64
libselinux-utils-2.6-0.1.fc25.x86_64
libsemanage-2.6-0.2.fc25.x86_64
libsemanage-python-2.6-0.2.fc25.x86_64
libsemanage-python3-2.6-0.2.fc25.x86_64
libsepol-2.6-0.2.fc25.x86_64
policycoreutils-2.6-0.6.fc25.x86_64
policycoreutils-devel-2.6-0.6.fc25.x86_64
policycoreutils-python-2.6-0.6.fc25.x86_64
policycoreutils-python3-2.6-0.6.fc25.x86_64
policycoreutils-python-utils-2.6-0.6.fc25.x86_64
setools-console-4.1.0-0.3.fc25.x86_64
setools-gui-4.1.0-0.3.fc25.x86_64
setools-python3-4.1.0-0.3.fc25.x86_64
setools-python-4.1.0-0.3.fc25.x86_64
# sepolicy manpage -d crond_tTraceback (most recent call last):
  File "/usr/lib64/python3.5/site-packages/setools/policyrep/util.py", line 60, in lookup
    return cls(value)
  File "/usr/lib64/python3.5/enum.py", line 241, in __call__
    return cls.__new__(cls, value)
  File "/usr/lib64/python3.5/enum.py", line 476, in __new__
    raise ValueError("%r is not a valid %s" % (value, cls.__name__))
ValueError: 'a' is not a valid RBACRuletype

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/sepolicy", line 700, in <module>
    args.func(args)
  File "/usr/bin/sepolicy", line 358, in manpage
    m = ManPage(domain, path, args.root, args.source_files, args.web)
  File "/usr/lib/python3.5/site-packages/sepolicy/manpage.py", line 421, in __init__
    self.role_allows = sepolicy.get_all_role_allows()
  File "/usr/lib/python3.5/site-packages/sepolicy/__init__.py", line 750, in get_all_role_allows
    q = setools.RBACRuleQuery(_pol, ruletype='allow')
  File "/usr/lib64/python3.5/site-packages/setools/rbacrulequery.py", line 88, in __init__
    super(RBACRuleQuery, self).__init__(policy, **kwargs)
  File "/usr/lib64/python3.5/site-packages/setools/query.py", line 39, in __init__
    setattr(self, name, kwargs[name])
  File "/usr/lib64/python3.5/site-packages/setools/descriptors.py", line 114, in __set__
    self.instances[obj] = set(self.enum_class.lookup(v) for v in value)
  File "/usr/lib64/python3.5/site-packages/setools/descriptors.py", line 114, in <genexpr>
    self.instances[obj] = set(self.enum_class.lookup(v) for v in value)
  File "/usr/lib64/python3.5/site-packages/setools/policyrep/util.py", line 62, in lookup
    return cls[value]
  File "/usr/lib64/python3.5/enum.py", line 277, in __getitem__
    return cls._member_map_[name]
KeyError: 'a'
#

Comment 2 Lukas Vrabec 2017-02-27 11:18:29 UTC
This bug breaking selinux-policy build.
Raising priority.

Comment 4 Fedora End Of Life 2017-02-28 11:03:14 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 26 development cycle.
Changing version to '26'.

Comment 5 Petr Lautrbach 2017-03-01 07:35:56 UTC
Fixed in policycoreutils-2.6-3.fc26.

Note: 'semanage manpage' is really slow right now. I'll try to do improve it before Fedora 26 GA