ufw crashed with TypeError in get_status()

Bug #346563 reported by Xie Shaohu
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ufw (Ubuntu)
Fix Released
High
Jamie Strandboge

Bug Description

Binary package hint: ufw

$ sudo ufw status
Traceback (most recent call last):
  File "/usr/sbin/ufw", line 115, in <module>
    res = ui.do_action(action, rule, ip_version)
  File "/usr/lib/python2.6/dist-packages/ufw/frontend.py", line 763, in do_action
    res = self.get_status()
  File "/usr/lib/python2.6/dist-packages/ufw/frontend.py", line 544, in get_status
    out = self.backend.get_status(verbose, show_count)
  File "/usr/lib/python2.6/dist-packages/ufw/backend_iptables.py", line 298, in get_status
    return _("Status: active%s") % (str)
TypeError: not all arguments converted during string formatting

ProblemType: Crash
Architecture: amd64
DistroRelease: Ubuntu 9.04
ExecutablePath: /usr/sbin/ufw
InterpreterPath: /usr/bin/python2.6
NonfreeKernelModules: nvidia
Package: ufw 0.27-0ubuntu1
PackageArchitecture: all
ProcAttrCurrent: unconfined
ProcCmdline: /usr/bin/python /usr/sbin/ufw status
ProcEnviron:
 PATH=(custom, no user)
 LANG=zh_CN.UTF-8
 SHELL=/bin/bash
PythonArgs: ['/usr/sbin/ufw', 'status']
SourcePackage: ufw
Title: ufw crashed with TypeError in get_status()
Uname: Linux 2.6.28-11-generic x86_64
UserGroups:

Related branches

Revision history for this message
Xie Shaohu (shaohu-xie) wrote :
Revision history for this message
Jamie Strandboge (jdstrand) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. Unfortunately we can't fix it, because your description didn't include enough information. At a minimum, we need: 1. the specific steps or actions you took that caused you to encounter the problem, 2. the behavior you expected, and 3. the behavior you actually encountered (in as much detail as possible). Please also add all the files from '/var/lib/ufw', '/etc/ufw' and '/etc/default/ufw' to this bug as separate attachments and give the version of ufw as seen with 'ufw --version'. Thanks in advance.

Changed in ufw:
assignee: nobody → jdstrand
status: New → Incomplete
Revision history for this message
Xie Shaohu (shaohu-xie) wrote :

I use "sudo ufw status" to view firewall state info, the command line didn't return firewall state info, but the following error happened.
Traceback (most recent call last):
  File "/usr/sbin/ufw", line 115, in <module>
    res = ui.do_action(action, rule, ip_version)
  File "/usr/lib/python2.6/dist-packages/ufw/frontend.py", line 763, in do_action
    res = self.get_status()
  File "/usr/lib/python2.6/dist-packages/ufw/frontend.py", line 544, in get_status
    out = self.backend.get_status(verbose, show_count)
  File "/usr/lib/python2.6/dist-packages/ufw/backend_iptables.py", line 298, in get_status
    return _("Status: active%s") % (str)
TypeError: not all arguments converted during string formatting

$ ufw --version
ufw 0.27-0ubuntu1
Copyright (C) 2008-2009 Canonical Ltd.

Revision history for this message
Xie Shaohu (shaohu-xie) wrote :
Revision history for this message
Xie Shaohu (shaohu-xie) wrote :
Revision history for this message
Jamie Strandboge (jdstrand) wrote :

I cannot reproduce this. I copied all your files into place and 'ufw status' works fine. Can you give steps to produce the problem, starting with a fresh install of ufw? That, do:
$ sudo dpkg --purge ufw
$ sudo rm -rf /var/lib/ufw /etc/ufw
$ sudo apt-get install ufw

If you are able to reproduce it, can you also state your locale?

Revision history for this message
Xie Shaohu (shaohu-xie) wrote :

I produce the following steps, and then the bug happened.

step 1、$ sudo dpkg --purge ufw
step 2、$ sudo rm -rf /var/lib/ufw /etc/ufw
step 3、$ sudo apt-get install ufw
step 4、/etc/ufw/applications.d$ ls
step 5、/etc/ufw/applications.d$ sudo cp /home/leo/samba samba
step 6、/etc/ufw/applications.d$ sudo cp /home/leo/qq qq
step 7、/etc/ufw/applications.d$ sudo cp /home/leo/cups cups
step 8、/etc/ufw/applications.d$ sudo cp /home/leo/postfix postfix
step 9、/etc/ufw/applications.d$ sudo cp /home/leo/amule amule
step 10、/etc/ufw/applications.d$ ls
amule cups postfix qq samba
step 11、/etc/ufw/applications.d$ sudo ufw allow amule
防火墙规则已更新
step 12、/etc/ufw/applications.d$ sudo ufw allow CUPS
防火墙规则已更新
step 13、/etc/ufw/applications.d$ sudo ufw allow qq
防火墙规则已更新
step 14、/etc/ufw/applications.d$ sudo ufw allow Postfix
防火墙规则已更新
step 15、/etc/ufw/applications.d$ sudo ufw allow Samba
防火墙规则已更新
step 16、/etc/ufw/applications.d$ sudo ufw default deny
默认政策被更改为 'deny'
(请相应地更新你的防火墙规则)
step 17、/etc/ufw/applications.d$ sudo ufw status
Status: inactive
leo@leo-laptop:/etc/ufw/applications.d$ sudo ufw enable
Firewall is active and enabled on system startup
leo@leo-laptop:/etc/ufw/applications.d$ sudo ufw status
Traceback (most recent call last):
  File "/usr/sbin/ufw", line 115, in <module>
    res = ui.do_action(action, rule, ip_version)
  File "/usr/lib/python2.6/dist-packages/ufw/frontend.py", line 763, in do_action
    res = self.get_status()
  File "/usr/lib/python2.6/dist-packages/ufw/frontend.py", line 544, in get_status
    out = self.backend.get_status(verbose, show_count)
  File "/usr/lib/python2.6/dist-packages/ufw/backend_iptables.py", line 298, in get_status
    return _("Status: active%s") % (str)
TypeError: not all arguments converted during string formatting

--------------------------------------------
my locale:
$ locale
LANG=zh_CN.UTF-8
LC_CTYPE="zh_CN.UTF-8"
LC_NUMERIC="zh_CN.UTF-8"
LC_TIME="zh_CN.UTF-8"
LC_COLLATE="zh_CN.UTF-8"
LC_MONETARY="zh_CN.UTF-8"
LC_MESSAGES="zh_CN.UTF-8"
LC_PAPER="zh_CN.UTF-8"
LC_NAME="zh_CN.UTF-8"
LC_ADDRESS="zh_CN.UTF-8"
LC_TELEPHONE="zh_CN.UTF-8"
LC_MEASUREMENT="zh_CN.UTF-8"
LC_IDENTIFICATION="zh_CN.UTF-8"
LC_ALL=

Revision history for this message
Jamie Strandboge (jdstrand) wrote :

I was able to reproduce this by changing my locale to zh_CN.UTF-8.

Changed in ufw (Ubuntu):
status: Incomplete → Confirmed
importance: Undecided → High
milestone: none → ubuntu-9.04
Changed in ufw (Ubuntu):
status: Confirmed → In Progress
Revision history for this message
Jamie Strandboge (jdstrand) wrote :

Fix committed in bzr. Will upload after testing.

Changed in ufw (Ubuntu):
status: In Progress → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package ufw - 0.27-0ubuntu2

---------------
ufw (0.27-0ubuntu2) jaunty; urgency=low

  * properly return translated string with formatted text (LP: #346563)

 -- Jamie Strandboge <email address hidden> Fri, 03 Apr 2009 10:07:33 -0500

Changed in ufw (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.