evilsocket / opensnitch

OpenSnitch is a GNU/Linux interactive application firewall inspired by Little Snitch.
GNU General Public License v3.0
9.86k stars 488 forks source link

xdg updates + autostart + lockfile #964

Closed munix9 closed 1 year ago

munix9 commented 1 year ago

I have summarized the various changes here:

See also https://github.com/evilsocket/opensnitch/issues/950

gustavo-iniguez-goya commented 1 year ago

This looks really good to me @munix9 , removing the pkill was a must.

Some general notes:

I see that pyxdg is packaged as python3-xdg on debian and ubuntu, and as python3-pyxdg/python36-pyxdg on fedora and opensuse. Only available since ubuntu >= 20.04, so we would be incompatible with ubuntu 18 and 16 (and the linux mint/mx equivalents). Just a note, nothing really important, but worth mentioning.

munix9 commented 1 year ago

This looks really good to me @munix9 , removing the pkill was a must.

Some general notes:

I see that pyxdg is packaged as python3-xdg on debian and ubuntu, and as python3-pyxdg/python36-pyxdg on fedora and opensuse. Only available since ubuntu >= 20.04, so we would be incompatible with ubuntu 18 and 16 (and the linux mint/mx equivalents). Just a note, nothing really important, but worth mentioning.

This is not nice. Maybe I can integrate the needed methods of pyxdg directly into xdg.py to avoid the dependency. I'll have a look at it.

munix9 commented 1 year ago

@gustavo-iniguez-goya pyxdg dependency is removed.

gustavo-iniguez-goya commented 1 year ago

@munix9 , did you see this error? it occurs when the ~/.config/autostart/opensnitch_ui.desktop already exists. We'll hit this error when users coming from v1.5.x install the next version.

  File "/usr/lib/python3/dist-packages/opensnitch/service.py", line 202, in _on_switch_autostart
    self._autostart.enable(self._menu_autostart.isChecked())
  File "/usr/lib/python3/dist-packages/opensnitch/utils/xdg.py", line 82, in enable
    shutil.copyfile(self.systemAutostart, self.userAutostart)
  File "/usr/lib/python3.8/shutil.py", line 244, in copyfile
    raise SameFileError("{!r} and {!r} are the same file".format(src, dst))
shutil.SameFileError: '/etc/xdg/autostart/opensnitch_ui.desktop' and '/home/ga/.config/autostart/opensnitch_ui.desktop' are the same file
gustavo-iniguez-goya commented 1 year ago

thank you @munix9 !