Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning/errors in profiles are not handled #9

Closed
gileri opened this issue Jun 6, 2020 · 13 comments
Closed

Warning/errors in profiles are not handled #9

gileri opened this issue Jun 6, 2020 · 13 comments

Comments

@gileri
Copy link

gileri commented Jun 6, 2020

Hello, thank you for this useful piece of software !

My ufw configuration is invalid :

# ufw status
WARN: Duplicate profile 'mosh', using last found
Status: inactive

While this warning should be fixed on my side, it shouldn't crash gufw (version 20.04.1):

# gufw
Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/gufw/gufw.py", line 30, in <module>
    gufw = Gufw(controler.get_frontend())
  File "/usr/lib/python3.8/site-packages/gufw/gufw/view/gufw.py", line 80, in __init__
    self._set_initial_values()
  File "/usr/lib/python3.8/site-packages/gufw/gufw/view/gufw.py", line 283, in _set_initial_values
    self.listening = ListeningReport(self)
  File "/usr/lib/python3.8/site-packages/gufw/gufw/view/listening.py", line 35, in __init__
    self._show_report()
  File "/usr/lib/python3.8/site-packages/gufw/gufw/view/listening.py", line 48, in _show_report
    self._view_report(report, self.previous_report)
  File "/usr/lib/python3.8/site-packages/gufw/gufw/view/listening.py", line 83, in _view_report
    self.gufw.listening_model.set_value(iter_row, 1, int(line_split[1].strip())) # port
ValueError: invalid literal for int() with base 10: 'WARN:'

How to reproduce :

  • Archlinux : Install both mosh and ufw-extras packges
  • Other distros : Copy any profile to another file (# cp /etc/ufw/applications.d/mosh{,2})
@costales
Copy link
Owner

costales commented Jun 7, 2020

Hi,

Do you know how could I replicate that issue in ufw?

Best regards.

@gileri
Copy link
Author

gileri commented Jun 7, 2020

Oh, right ! I updated my first message.

@costales
Copy link
Owner

Hi,

ufw-extras doesn't exist in Ubuntu 20.04:

costales@T410:~/Desktop/gufw$ apt-cache search ufw | grep extras
costales@T410:~/Desktop/gufw$ dpkg -l | grep ufw | grep extra
costales@T410:~/Desktop/gufw$ 

@costales
Copy link
Owner

After checking this, I think the package ufw-extras is adding a config file to ufw. In my knowledge, the ufw-extras is not a distro package and it should not add that file.

@gileri
Copy link
Author

gileri commented Sep 12, 2020

Hi Costales, thank you for your answer. Please note that I have already addressed both points in the OP :

How to reproduce :
Archlinux : Install both mosh and ufw-extras packges
Other distros : Copy any profile to another file (# cp /etc/ufw/applications.d/mosh{,2})

While this warning should be fixed on my side, it shouldn't crash gufw

You're right that it is an ufw configuration error that should be fixed by packagers or users. But I think you'll agree that WARN level logs shouldn't crash downstream packages such as gufw.

@amitdhiman000
Copy link

amitdhiman000 commented Oct 6, 2020

I am also facing same issue. But I am able to UFW command from terminal.

When I try to launch the GUFW from terminal I get below output.

ls: cannot access '/usr/lib/python*/site-packages/gufw/gufw.py': No such file or directory
Traceback (most recent call last):
File "/usr/share/gufw/gufw/gufw.py", line 30, in
gufw = Gufw(controler.get_frontend())
File "/usr/share/gufw/gufw/gufw/view/gufw.py", line 80, in init
self._set_initial_values()
File "/usr/share/gufw/gufw/gufw/view/gufw.py", line 283, in _set_initial_values
self.listening = ListeningReport(self)
File "/usr/share/gufw/gufw/gufw/view/listening.py", line 35, in init
self._show_report()
File "/usr/share/gufw/gufw/gufw/view/listening.py", line 48, in _show_report
self._view_report(report, self.previous_report)
File "/usr/share/gufw/gufw/gufw/view/listening.py", line 83, in _view_report
self.gufw.listening_model.set_value(iter_row, 1, int(line_split[1].strip())) # port
ValueError: invalid literal for int() with base 10: 'WARN:'

Is something wrong with python path. I am seeing a regular expression * in the path. is that allowed ?
$ ls -l /usr/lib | grep python
drwxr-xr-x 27 root root 24576 May 8 07:20 python2.7
drwxr-xr-x 3 root root 4096 Apr 26 2018 python3
drwxr-xr-x 29 root root 20480 May 8 07:19 python3.6
drwxr-xr-x 31 root root 20480 Jul 25 08:39 python3.8

I have 4 different python versions installed.
python3.8 does have a site-packages directory inside it. but there is no such package gufw.

@costales
Copy link
Owner

costales commented Oct 23, 2020

Hi,
Could you confirm that the patch is fixing the issue? (sorry the .zip, Github doesn't allow .patch).

fix_9.zip

How to patch:

unzip fix_9.patch
sudo patch /usr/share/gufw/gufw/gufw/model/ufw_backend.py < fix_9.patch

Thanks in advance!

@amitdhiman000
Copy link

amitdhiman000 commented Oct 24, 2020

@costales

facing same issue after applying patch.

user@user-pc:~/Downloads$ sudo patch /usr/share/gufw/gufw/gufw/model/ufw_backend.py < fix_9.patch
[sudo] password for user: 
patching file /usr/share/gufw/gufw/gufw/model/ufw_backend.py
user@user-pc:~/Downloads$ sudo gufw
/usr/bin/gufw: line 2: [: =: unary operator expected
ls: cannot access '/usr/lib/python*/site-packages/gufw/gufw.py': No such file or directory
Traceback (most recent call last):
  File "/usr/share/gufw/gufw/gufw.py", line 30, in <module>
    gufw = Gufw(controler.get_frontend())
  File "/usr/share/gufw/gufw/gufw/view/gufw.py", line 80, in __init__
    self._set_initial_values()
  File "/usr/share/gufw/gufw/gufw/view/gufw.py", line 283, in _set_initial_values
    self.listening = ListeningReport(self)
  File "/usr/share/gufw/gufw/gufw/view/listening.py", line 35, in __init__
    self._show_report()
  File "/usr/share/gufw/gufw/gufw/view/listening.py", line 48, in _show_report
    self._view_report(report, self.previous_report)
  File "/usr/share/gufw/gufw/gufw/view/listening.py", line 83, in _view_report
    self.gufw.listening_model.set_value(iter_row, 1, int(line_split[1].strip())) # port
ValueError: invalid literal for int() with base 10: 'ERROR:'


@gileri
Copy link
Author

gileri commented Oct 24, 2020

Hi,
Could you confirm that the patch is fixing the issue? (sorry the .zip, Github doesn't allow .patch).
Thanks in advance!

Hi @costales, indeed that fixes this issues. May I recommend to also ignore lines starting with DEBUG ?

PS : Due to that commit the arch build doesn't work anymore as it expects to have gufw.py residing in site-packges

@gileri gileri closed this as completed Oct 24, 2020
@costales
Copy link
Owner

facing same issue after applying patch.

@amitdhiman000 Open another issue, this is not related. Thanks.

costales added a commit that referenced this issue Oct 25, 2020
@count00zero
Copy link

For me on Ubuntu Groovy that fix_9 solved the Problem!
Thanks a lot!

@pracplayopen
Copy link

also had this issue in linux mint 20.1 (non-upgrade).

fixed w/fix_9.patch tho, thx

@naufal18-bot
Copy link

Hi, Could you confirm that the patch is fixing the issue? (sorry the .zip, Github doesn't allow .patch).

fix_9.zip

How to patch:

unzip fix_9.patch
sudo patch /usr/share/gufw/gufw/gufw/model/ufw_backend.py < fix_9.patch

Thanks in advance!

This fixed mine
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants