ufw 0.31.1-1 fails when one of its parent processes has space in argv[0]
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
ufw (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
This is very similar to bug #268084 except that I get the following trace:
remote: Traceback (most recent call last):
remote: File "/usr/sbin/ufw", line 111, in <module>
remote: res = ui.do_action(
remote: File "/usr/lib/
remote: res = self.reset(force)
remote: File "/usr/lib/
remote: if self.backend.
remote: File "/usr/lib/
remote: return under_ssh(ppid)
remote: File "/usr/lib/
remote: return under_ssh(ppid)
remote: File "/usr/lib/
remote: return under_ssh(ppid)
remote: File "/usr/lib/
remote: return under_ssh(ppid)
remote: File "/usr/lib/
remote: raise ValueError(err_msg)
remote: ValueError: Couldn't find parent pid for '16072'
Looking at the code, I found the cause of the error.
The file /proc/16072/stat contains:
16072 (redo-ifchange a) S 16060 15734 15734 0 -1 4202496 1463 0 0 0 2 0 0 0 20 0 1 0 77092203 9498624 1113 4294967295 134512640 136961996 3219574064 3219534684 4118799382 0 0 16781318 0 0 0 0 17 2 0 0 0 0 0
And the code contains in ufw/util.py line 372:
ppid = file(name)
Of course the index [3] fails in this case because of the space in "(redo-ifchange a)". I believe this is the argv[0] of the program, modified using the setproctitle python module. This is clearly a parsing error and should be fixed.
Alternatively, I used the --force option, so I don't even know why this was checked.
Thanks for using ufw and the detailed bug report. I've fixed this in r806 in trunk.