ctc-oss / fapolicy-analyzer

Tools to assist with the configuration and management of fapolicyd.
https://ctc-oss.github.io/fapolicy-analyzer
GNU General Public License v3.0
12 stars 5 forks source link

Empty MainWindow pane on start-up in FC34 dev venv. #779

Closed tparchambault closed 1 year ago

tparchambault commented 1 year ago

This is over the older FC34 platform however this may be the issue that @egbicker has also observer over FC37.

My current git branch where this issue was observed was forked off of the current master with the recently introduce async trust feature. The issue was not observed after switching to the local branch, fa688_improve_error_loggingthat had not been merged locally with the latestmaster.`

(fapolicy-analyzer) [toma@fedora fapolicy-analyzer]$ python -m fapolicy_analyzer.ui -v
Verbosity enabled
INFO:root:SessionManager::set_autosave_filename: /home/toma/.local/state/fapolicy-analyzer/FaCurrentSession.tmp
fapolicy-analyzer v0.5.0+119.g92e00cc
INFO:root:FapdManager constructed, control:False
INFO:root:MainWindow::on_start()
<built-in function check_ancillary_trust>
BatchConf: tc:0, tl:0, bc:0, bl:0
thread '<unnamed>' panicked at 'assertion failed: `(left != right)`
  left: `0`,
 right: `0`: chunks cannot have a size of zero', /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/core/src/slice/mod.rs:821:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Traceback (most recent call last):
  File "/home/toma/Development/CTC/fapolicy-analyzer/fapolicy_analyzer/ui/main_window.py", line 195, in on_start
    self.__pack_main_content(router(ANALYZER_SELECTION.TRUST_DATABASE_ADMIN))
  File "/home/toma/Development/CTC/fapolicy-analyzer/fapolicy_analyzer/ui/main_window.py", line 62, in router
    return route(data) if data else route()
  File "/home/toma/Development/CTC/fapolicy-analyzer/fapolicy_analyzer/ui/database_admin_page.py", line 36, in __init__
    self.ancillaryTrustDbAdmin = AncillaryTrustDatabaseAdmin()
  File "/home/toma/Development/CTC/fapolicy-analyzer/fapolicy_analyzer/ui/ui_widget.py", line 39, in __call__
    obj = type.__call__(cls, *args, **kwargs)
  File "/home/toma/Development/CTC/fapolicy-analyzer/fapolicy_analyzer/ui/ancillary_trust_database_admin.py", line 52, in __init__
    self.trust_file_list = AncillaryTrustFileList(trust_func=self.__load_trust)
  File "/home/toma/Development/CTC/fapolicy-analyzer/fapolicy_analyzer/ui/ancillary_trust_file_list.py", line 39, in __init__
    super().__init__(trust_func, self.__status_markup, addBtn.get_ref())
  File "/home/toma/Development/CTC/fapolicy-analyzer/fapolicy_analyzer/ui/trust_file_list.py", line 75, in __init__
    self.refresh()
  File "/home/toma/Development/CTC/fapolicy-analyzer/fapolicy_analyzer/ui/trust_file_list.py", line 142, in refresh
    self.trust_func()
  File "/home/toma/Development/CTC/fapolicy-analyzer/fapolicy_analyzer/ui/ancillary_trust_database_admin.py", line 68, in __load_trust
    dispatch(request_ancillary_trust())
  File "/home/toma/Development/CTC/fapolicy-analyzer/fapolicy_analyzer/ui/store.py", line 45, in dispatch
    store.dispatch(action)
  File "/home/toma/.local/share/virtualenvs/fapolicy-analyzer-6GRQ6orK/lib/python3.9/site-packages/rx/subject/subject.py", line 55, in on_next
    super().on_next(value)
  File "/home/toma/.local/share/virtualenvs/fapolicy-analyzer-6GRQ6orK/lib/python3.9/site-packages/rx/core/observer/observer.py", line 26, in on_next
    self._on_next_core(value)
  File "/home/toma/.local/share/virtualenvs/fapolicy-analyzer-6GRQ6orK/lib/python3.9/site-packages/rx/subject/subject.py", line 62, in _on_next_core
    observer.on_next(value)
  File "/home/toma/.local/share/virtualenvs/fapolicy-analyzer-6GRQ6orK/lib/python3.9/site-packages/rx/core/observer/autodetachobserver.py", line 26, in on_next
    self._on_next(value)
  File "/home/toma/.local/share/virtualenvs/fapolicy-analyzer-6GRQ6orK/lib/python3.9/site-packages/rx/subject/subject.py", line 55, in on_next
    super().on_next(value)
  File "/home/toma/.local/share/virtualenvs/fapolicy-analyzer-6GRQ6orK/lib/python3.9/site-packages/rx/core/observer/observer.py", line 26, in on_next
    self._on_next_core(value)
  File "/home/toma/.local/share/virtualenvs/fapolicy-analyzer-6GRQ6orK/lib/python3.9/site-packages/rx/subject/subject.py", line 62, in _on_next_core
    observer.on_next(value)
  File "/home/toma/.local/share/virtualenvs/fapolicy-analyzer-6GRQ6orK/lib/python3.9/site-packages/rx/core/observer/autodetachobserver.py", line 26, in on_next
    self._on_next(value)
  File "/home/toma/.local/share/virtualenvs/fapolicy-analyzer-6GRQ6orK/lib/python3.9/site-packages/rx/core/observer/autodetachobserver.py", line 26, in on_next
    self._on_next(value)
  File "/home/toma/.local/share/virtualenvs/fapolicy-analyzer-6GRQ6orK/lib/python3.9/site-packages/rx/core/observer/autodetachobserver.py", line 26, in on_next
    self._on_next(value)
  File "/home/toma/.local/share/virtualenvs/fapolicy-analyzer-6GRQ6orK/lib/python3.9/site-packages/rx/core/operators/filter.py", line 34, in on_next
    observer.on_next(value)
  File "/home/toma/.local/share/virtualenvs/fapolicy-analyzer-6GRQ6orK/lib/python3.9/site-packages/rx/core/observer/autodetachobserver.py", line 26, in on_next
    self._on_next(value)
  File "/home/toma/.local/share/virtualenvs/fapolicy-analyzer-6GRQ6orK/lib/python3.9/site-packages/rx/core/operators/map.py", line 37, in on_next
    result = _mapper(value)
  File "/home/toma/Development/CTC/fapolicy-analyzer/fapolicy_analyzer/ui/features/system_feature.py", line 189, in _get_ancillary_trust
    total_to_check = check_ancillary_trust(_system, update, done)
pyo3_runtime.PanicException: assertion failed: `(left != right)`
  left: `0`,
 right: `0`: chunks cannot have a size of zero
BatchConf: tc:25, tl:4, bc:100, bl:447
INFO:root:SessionManager::cleanup()
(fapolicy-analyzer) [toma@fedora fapolicy-analyzer]$ 
(fapolicy-analyzer) [toma@fedora fapolicy-analyzer]$ 

##############################################################################
# Different local branch, fa688_improve_error_logging in the same repo, same
# FC34 system w/latest rustup tools. Works as expected.

[toma@fedora fapolicy-analyzer]$  . /home/toma/.local/share/virtualenvs/fapolicy-analyzer-6GRQ6orK/bin/activate
(fapolicy-analyzer) [toma@fedora fapolicy-analyzer]$ python -m fapolicy_analyzer.ui -v
Verbosity enabled
INFO:root:SessionManager::set_autosave_filename: /home/toma/.local/state/fapolicy-analyzer/FaCurrentSession.tmp
fapolicy-analyzer v0.5.0+123.g5dd8d1d
INFO:root:FapdManager constructed, control:False
INFO:root:MainWindow::on_start()
INFO:root:SessionManager searching for previous session
INFO:root:start_daemon_monitor(): ServiceStatus.FALSE
INFO:root:Spawning monitor thread...
INFO:root:SessionManager::cleanup()
(fapolicy-analyzer) [toma@fedora fapolicy-analyzer]$ 

##############################################################################
# in a new branch (essentially identical to master), again FC34 as above:

(fapolicy-analyzer) [toma@fedora fapolicy-analyzer]$ python -m fapolicy_analyzer.ui -v
Verbosity enabled
INFO:root:SessionManager::set_autosave_filename: /home/toma/.local/state/fapolicy-analyzer/FaCurrentSession.tmp
fapolicy-analyzer v0.5.0+119.g92e00cc
INFO:root:FapdManager constructed, control:False
INFO:root:MainWindow::on_start()
<built-in function check_ancillary_trust>
BatchConf: tc:0, tl:0, bc:0, bl:0
thread '<unnamed>' panicked at 'assertion failed: `(left != right)`
  left: `0`,
 right: `0`: chunks cannot have a size of zero', /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/core/src/slice/mod.rs:821:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Traceback (most recent call last):
  File "/home/toma/Development/CTC/fapolicy-analyzer/fapolicy_analyzer/ui/main_window.py", line 195, in on_start
    self.__pack_main_content(router(ANALYZER_SELECTION.TRUST_DATABASE_ADMIN))
  File "/home/toma/Development/CTC/fapolicy-analyzer/fapolicy_analyzer/ui/main_window.py", line 62, in router
    return route(data) if data else route()
  File "/home/toma/Development/CTC/fapolicy-analyzer/fapolicy_analyzer/ui/database_admin_page.py", line 36, in __init__
    self.ancillaryTrustDbAdmin = AncillaryTrustDatabaseAdmin()
  File "/home/toma/Development/CTC/fapolicy-analyzer/fapolicy_analyzer/ui/ui_widget.py", line 39, in __call__
    obj = type.__call__(cls, *args, **kwargs)
  File "/home/toma/Development/CTC/fapolicy-analyzer/fapolicy_analyzer/ui/ancillary_trust_database_admin.py", line 52, in __init__
    self.trust_file_list = AncillaryTrustFileList(trust_func=self.__load_trust)
  File "/home/toma/Development/CTC/fapolicy-analyzer/fapolicy_analyzer/ui/ancillary_trust_file_list.py", line 39, in __init__
    super().__init__(trust_func, self.__status_markup, addBtn.get_ref())
  File "/home/toma/Development/CTC/fapolicy-analyzer/fapolicy_analyzer/ui/trust_file_list.py", line 75, in __init__
    self.refresh()
  File "/home/toma/Development/CTC/fapolicy-analyzer/fapolicy_analyzer/ui/trust_file_list.py", line 142, in refresh
    self.trust_func()
  File "/home/toma/Development/CTC/fapolicy-analyzer/fapolicy_analyzer/ui/ancillary_trust_database_admin.py", line 68, in __load_trust
    dispatch(request_ancillary_trust())
  File "/home/toma/Development/CTC/fapolicy-analyzer/fapolicy_analyzer/ui/store.py", line 45, in dispatch
    store.dispatch(action)
  File "/home/toma/.local/share/virtualenvs/fapolicy-analyzer-6GRQ6orK/lib/python3.9/site-packages/rx/subject/subject.py", line 55, in on_next
    super().on_next(value)
  File "/home/toma/.local/share/virtualenvs/fapolicy-analyzer-6GRQ6orK/lib/python3.9/site-packages/rx/core/observer/observer.py", line 26, in on_next
    self._on_next_core(value)
  File "/home/toma/.local/share/virtualenvs/fapolicy-analyzer-6GRQ6orK/lib/python3.9/site-packages/rx/subject/subject.py", line 62, in _on_next_core
    observer.on_next(value)
  File "/home/toma/.local/share/virtualenvs/fapolicy-analyzer-6GRQ6orK/lib/python3.9/site-packages/rx/core/observer/autodetachobserver.py", line 26, in on_next
    self._on_next(value)
  File "/home/toma/.local/share/virtualenvs/fapolicy-analyzer-6GRQ6orK/lib/python3.9/site-packages/rx/subject/subject.py", line 55, in on_next
    super().on_next(value)
  File "/home/toma/.local/share/virtualenvs/fapolicy-analyzer-6GRQ6orK/lib/python3.9/site-packages/rx/core/observer/observer.py", line 26, in on_next
    self._on_next_core(value)
  File "/home/toma/.local/share/virtualenvs/fapolicy-analyzer-6GRQ6orK/lib/python3.9/site-packages/rx/subject/subject.py", line 62, in _on_next_core
    observer.on_next(value)
  File "/home/toma/.local/share/virtualenvs/fapolicy-analyzer-6GRQ6orK/lib/python3.9/site-packages/rx/core/observer/autodetachobserver.py", line 26, in on_next
    self._on_next(value)
  File "/home/toma/.local/share/virtualenvs/fapolicy-analyzer-6GRQ6orK/lib/python3.9/site-packages/rx/core/observer/autodetachobserver.py", line 26, in on_next
    self._on_next(value)
  File "/home/toma/.local/share/virtualenvs/fapolicy-analyzer-6GRQ6orK/lib/python3.9/site-packages/rx/core/observer/autodetachobserver.py", line 26, in on_next
    self._on_next(value)
  File "/home/toma/.local/share/virtualenvs/fapolicy-analyzer-6GRQ6orK/lib/python3.9/site-packages/rx/core/operators/filter.py", line 34, in on_next
    observer.on_next(value)
  File "/home/toma/.local/share/virtualenvs/fapolicy-analyzer-6GRQ6orK/lib/python3.9/site-packages/rx/core/observer/autodetachobserver.py", line 26, in on_next
    self._on_next(value)
  File "/home/toma/.local/share/virtualenvs/fapolicy-analyzer-6GRQ6orK/lib/python3.9/site-packages/rx/core/operators/map.py", line 37, in on_next
    result = _mapper(value)
  File "/home/toma/Development/CTC/fapolicy-analyzer/fapolicy_analyzer/ui/features/system_feature.py", line 189, in _get_ancillary_trust
    total_to_check = check_ancillary_trust(_system, update, done)
pyo3_runtime.PanicException: assertion failed: `(left != right)`
  left: `0`,
 right: `0`: chunks cannot have a size of zero
INFO:root:SessionManager::cleanup()
(fapolicy-analyzer) [toma@fedora fapolicy-analyzer]$ 
tparchambault commented 1 year ago

UnpopulatedTrustViewAtStartUp

tparchambault commented 1 year ago

Although, the MainWindow was unpopulated, mouse events were handled such that I could change to a different tool view and continue working via the GUI.

tparchambault commented 1 year ago

Executing the async_trust.py example:

(fapolicy-analyzer) [toma@fedora examples]$ python async_trust.py 
checking all trust
system created in 0.8145098686218262 seconds
system contains 44627 unchecked system trust entries
BatchConf: tc:25, tl:4, bc:100, bl:447
progress 21%
...
<which eventually displays>
...
progress 100%
done!
processed 44627 trust entries in 537.560628414154 seconds
(fapolicy-analyzer) [toma@fedora examples]$ echo $?
0
(fapolicy-analyzer) [toma@fedora examples]$ 
jw3 commented 1 year ago

Thanks @tparchambault , this is a bug in the trust check.

This gave it away

BatchConf: tc:0, tl:0, bc:0, bl:0

The case of no trust entries is not being handled properly.

Ill send a fix up. In the meantime add an ancillary entry manually and see if it fixes it.